/* Variables */
:root {
  /* Core colors */
  --primary-color: rgb(2, 52, 104);
  --dark-bg: #081b29;
  --light-bg: #f8f9fa;
  --text-light: #fff;
  --text-dark: #333;

  /* Layout */
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 70px;
  --transition-speed: 0.3s;
  --header-height: 60px;

  /* Light Theme */
  --body-bg: var(--light-bg);
  --card-bg: #f0f4f8;
  --border-color: #dee2e6;
  --text-color: var(--text-dark);
  --sidebar-bg: #f0f4f8;
  --sidebar-text: #2d3748;
  --sidebar-hover: rgba(14, 255, 255, 0.1);
  --sidebar-active: rgba(14, 255, 255, 0.15);
  --sidebar-border: rgba(0, 0, 0, 0.1);
  --topbar-bg: #fff;
  --topbar-text: var(--text-dark);
  --input-bg: #fff;
  --input-border: #ced4da;
  --table-header-bg: #e9ecef;
  --table-border: #dee2e6;
  --table-hover: rgba(0, 0, 0, 0.075);
  --dropdown-bg: #fff;
  --dropdown-text: var(--text-dark);
  --dropdown-hover: #f8f9fa;
  --tooltip-bg: var(--dark-bg);
  --tooltip-text: var(--text-light);
  --scrollbar-track: #f1f1f1;
  --scrollbar-thumb: #888;
  --scrollbar-thumb-hover: #555;
  --bs-btn-hover-bg-custom: #00eeff;
  --bs-btn-hover-color: #000;
}

/* Dark Theme */
.dark {
  --primary-dard-color: rgb(154 196 239);
  --body-bg: #121212;
  --card-bg: #1e1e1e;
  --border-color: #ddcfcf;
  --text-color: #e0e0e0;
  --sidebar-bg: #0a0a0a;
  --sidebar-text: #e0e0e0;
  --sidebar-hover: rgba(14, 255, 255, 0.15);
  --sidebar-active: rgba(14, 255, 255, 0.25);
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --topbar-bg: #1a1a1a;
  --topbar-text: #e0e0e0;
  --input-bg: #2d2d2d;
  --input-border: #3d3d3d;
  --table-header-bg: #2a2a2a;
  --table-border: #3d3d3d;
  --table-hover: rgba(255, 255, 255, 0.05);
  --dropdown-bg: #2d2d2d;
  --dropdown-text: #e0e0e0;
  --dropdown-hover: #3d3d3d;
  --tooltip-bg: #2d2d2d;
  --tooltip-text: #e0e0e0;
  --scrollbar-track: #1a1a1a;
  --scrollbar-thumb: #3d3d3d;
  --scrollbar-thumb-hover: #4d4d4d;
}

/* Base Styles */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700;800;900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
}

body {
  background-color: var(--body-bg);
  color: var(--text-color);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Layout Components */
.container-fluid {
  padding: 0;
}

/* Sidebar */
.sidebar-wrapper {
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: width var(--transition-speed) ease-in-out, transform var(--transition-speed) ease-in-out, background-color
    0.3s ease;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.dark .sidebar-wrapper {
  box-shadow: 0 0 15px rgba(14, 255, 255, 0.1);
}

.sidebar-wrapper::-webkit-scrollbar {
  width: 5px;
}

.sidebar-wrapper::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.sidebar-wrapper::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-collapsed {
  width: var(--sidebar-collapsed-width) !important;
}

/* Logo Container */
.logo-container {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 70px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all var(--transition-speed) ease;
  white-space: nowrap;
}

.logo-icon {
  display: none;
  font-size: 24px;
  color: var(--primary-color);
}

.dark .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all var(--transition-speed) ease;
  white-space: nowrap;
}

.text-primary {
  color: var(--bs-primary-rgb) !important;
}

.sidebar-collapsed .logo {
  display: none;
}

.sidebar-collapsed .logo-icon {
  display: block;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}

.sidebar-toggle:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.sidebar-collapsed .sidebar-toggle:hover {
  transform: rotate(180deg) scale(1.1);
}

/* Sidebar Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}

.sidebar-content::-webkit-scrollbar {
  width: 5px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

/* Navigation Items */
.nav-item {
  position: relative;
  width: 100%;
  margin-bottom: 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: var(--sidebar-text) !important;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  white-space: nowrap;
}

.nav-link:before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--sidebar-hover), transparent);
  transition: all 0.5s ease;
  z-index: -1;
}

.nav-link:hover:before {
  left: 100%;
}

.nav-link i {
  min-width: 30px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: var(--sidebar-text);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--primary-color) !important;
  border-left: 4px solid var(--primary-color);
}

.dark .nav-link.active {
  background: var(--sidebar-active);
  color: var(--text-light) !important;
  border-left: 4px solid var(--text-light);
}

.nav-link.active i {
  color: var(--primary-color);
}

.dark .nav-link.active i {
  color: var(--text-light);
}

.nav-link:hover {
  background: var(--sidebar-hover);
}

/* Section Headers */
.sidebar-section-header {
  color: var(--primary-color);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 15px 15px 5px;
  margin-top: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.sidebar-section-header i {
  color: var(--primary-color);
}

.dark .sidebar-section-header i {
  color: var(--text-light);
}

.sidebar-section-header span {
  margin-left: 10px;
  color: var(--sidebar-text);
}

/* User Profile */
.user-profile {
  display: flex;
  align-items: center;
  padding: 15px;
  border-top: 1px solid var(--sidebar-border);
  margin-top: auto;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-weight: bold;
  margin-right: 10px;
  transition: all 0.3s ease;
}

.user-info {
  transition: all 0.3s ease;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-text);
}

.user-role {
  font-size: 12px;
  color: var(--sidebar-text);
  opacity: 0.7;
}

.sidebar-collapsed .user-info {
  display: none;
}

/* Main Content */
.main-content-wrapper {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-speed) ease-in-out;
  padding: 20px;
  position: relative;
  padding-top: calc(var(--header-height) + 20px);
  width: calc(100% - var(--sidebar-width));
}

.content-expanded {
  margin-left: var(--sidebar-collapsed-width) !important;
  width: calc(100% - var(--sidebar-collapsed-width)) !important;
}

/* Topbar */
.topbar {
  height: var(--header-height);
  background: var(--topbar-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 999;
  transition: left var(--transition-speed) ease-in-out;
  color: var(--topbar-text);
}

.topbar.expanded {
  left: var(--sidebar-collapsed-width);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--topbar-text);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: none;
}

.toggle-btn:hover {
  color: var(--primary-color);
}

/* Theme toggle button */
.theme-toggle-btn {
  background: transparent;
  border: none;
  color: var(--topbar-text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.theme-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.dark .theme-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Fullscreen button */
.fullscreen-btn {
  background: transparent;
  border: none;
  color: var(--topbar-text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 10px;
}

.fullscreen-btn:hover {
  color: var(--primary-color);
}

/* Card Styles */
.card {
  position: relative;
  margin-bottom: 20px;
  background-color: var(--card-bg);
  color: var(--text-color);
  border: none;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), #4facfe);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
}

.card:hover::before {
  transform: scaleX(1);
}

.card-header {
  border-bottom-color: var(--border-color);
}

.card-title,
.card-text {
  color: var(--text-color);
}

/* Vocabulary Card Specific Styles */
.vocabulary-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
}

.vocabulary-card .card-body {
  display: flex;
  flex-direction: column;
}

.vocabulary-card .card-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.vocabulary-audio {
  cursor: pointer;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(2, 52, 104, 0.1);
  transition: all 0.3s ease;
}

.dark .vocabulary-audio {
  color: var(--text-color) !important;
}

.dark .list-group-item {
  background-color: transparent;
  color: var(--text-color);

}

.vocabulary-audio:hover {
  background-color: rgba(2, 52, 104, 0.2);
  transform: scale(1.1);
}

.dark .vocabulary-audio {
  background-color: rgba(14, 255, 255, 0.1);
}

.dark .vocabulary-audio:hover {
  background-color: rgba(14, 255, 255, 0.2);
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.slide-in-right {
  animation: slideInRight 0.5s ease forwards;
}

.slide-in-left {
  animation: slideInLeft 0.5s ease forwards;
}

.slide-in-up {
  animation: slideInUp 0.5s ease forwards;
}

.zoom-in {
  animation: zoomIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(50px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Animation Delays */
.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

.delay-5 {
  animation-delay: 0.5s;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .toggle-btn {
    display: block;
  }

  .sidebar-wrapper {
    transform: translateX(-100%);
  }

  .sidebar-wrapper.mobile-open {
    transform: translateX(0);
  }

  .main-content-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .topbar {
    left: 0;
  }
}

@media (max-width: 992px) {
  .main-content-wrapper {
    padding: 15px;
    padding-top: calc(var(--header-height) + 15px);
  }

  .card-body {
    padding: 15px;
  }
}

/* Breadcrumb Styles */
.breadcrumb {
  background-color: transparent;
  margin-bottom: 0;
  padding: 0;
}

.breadcrumb-item {
  color: var(--text-color);
  opacity: 0.7;
}

.breadcrumb-item a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
  color: var(--text-color);
  opacity: 0.8;
}

.breadcrumb-item.active {
  color: var(--text-color);
  opacity: 1;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--text-color);
  opacity: 0.5;
}

/* Japanese Learning Specific Styles */
.japanese-text {
  font-size: 1.5rem;
  line-height: 1.8;
}

.pronunciation {
  color: #6c757d;
  font-style: italic;
}

.meaning {
  font-weight: 500;
}

/* Flashcard styles */
.flashcard-container {
  perspective: 1000px;
  width: 100%;
  height: 200px;
  margin: 20px 0;
}

.flashcard {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.flashcard-front {
  background-color: var(--card-bg);
  color: var(--text-color);
}

.flashcard-back {
  background-color: var(--primary-color);
  color: white;
  transform: rotateY(180deg);
}

/* Progress bar styling */
.progress {
  height: 10px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.dark .progress {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Custom button styles */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Dark mode adjustments */
.dark .card {
  border: 1px solid var(--border-color);
}

.dark .btn {
  color: var(--text-color);
}

.dark .btn-outline-primary {
  color: #0ef;
  border-color: #0ef;
}

.dark .btn-outline-primary:hover {
  background-color: #0ef;
  color: #081b29;
}

.dark .text-muted {
  color: var(--text-color) !important;
}

/* Pagination styling */
.pagination {
  display: flex;
  justify-content: center;
  padding-left: 0;
  list-style: none;
}

.pagination .page-item .page-link {
  color: var(--primary-color);
  background-color: var(--card-bg);
  border-color: var(--border-color);
}

.pagination .page-item.active .page-link {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.dark .pagination .page-item .page-link {
  background-color: var(--card-bg);
  color: var(--text-color);
}

.dark .pagination .page-item.active .page-link {
  background-color: var(--primary-color);
  color: white;
}

.dark .form-select, .dark input[type="text"] {
  background-color: var(--scrollbar-thumb-hover);
  color: var(--text-color);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-color);
  opacity: 0.6;
  transition: color 0.3s ease;
}

input:focus::placeholder,
textarea:focus::placeholder {
  color: var(--primary-color);
  opacity: 0.8;
}

/* Dark Theme Specific Styles (Nếu cần override) */
.dark input::placeholder,
.dark textarea::placeholder {
  color: var(--text-color);
  opacity: 0.7;
}

.dark input:focus::placeholder,
.dark textarea:focus::placeholder {
  color: var(--primary-color);
  opacity: 0.9;
}

.badge {
  color: var(--text-color) !important;
  background-color: var(--sidebar-active) !important;
}

.dark .breadcrumb-item a {
  color: var(--primary-dard-color) !important;
}