/* ===== Tu Tiên Theme - Modern Dark/Light CSS ===== */

/* ===== CSS Variables ===== */
:root {
  /* Theme toggle */
  --is-dark: 1;

  /* Primary Colors - Refined Blue */
  --primary: #2563eb;
  --primary-light: #60a5fa;
  --primary-dark: #1d4ed8;
  --secondary: #0ea5e9;
  --accent: #f59e0b;

  /* Neutral Colors - Dark Theme */
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-hover: rgba(51, 65, 85, 0.7);
  --bg-input: #1e293b;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border: rgba(255, 255, 255, 0.1);
  --border-focus: var(--primary-light);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Shadows & Effects */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 15px rgba(37, 99, 235, 0.4);
  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(255, 255, 255, 0.05);

  /* Transitions */
  --transition: all 0.3s ease;
}

/* Light Theme */
[data-theme="light"] {
  --is-dark: 0;

  --bg-dark: #f0f4f8;
  --bg-card: #ffffff;
  --bg-hover: #e2e8f0;
  --bg-input: #f8fafc;

  --text-primary: #1e293b;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border: #e2e8f0;
  --border-focus: #2563eb;

  /* Light mode Ngũ Hành colors */
  --kim: #b45309;
  --kim-bg: rgba(180, 83, 9, 0.1);
  --moc: #15803d;
  --moc-bg: rgba(21, 128, 61, 0.1);
  --thuy: #1d4ed8;
  --thuy-bg: rgba(29, 78, 216, 0.1);
  --hoa: #b91c1c;
  --hoa-bg: rgba(185, 28, 28, 0.1);
  --tho: #92400e;
  --tho-bg: rgba(146, 64, 14, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.1);
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Tu Tiên Background Effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(251, 191, 36, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
}

/* ===== Container ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== Header ===== */
/* ===== Hero Banner ===== */
.hero-banner {
  position: relative;
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  margin-bottom: 40px;
  border-bottom: 4px solid var(--primary);
  background: var(--bg-dark);
}

.banner-img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  transition: transform 0.5s ease;
}

/* Banner Slider Styles */
.banner-slider {
  width: 100%;
  height: 100%;
  position: relative;
}

.banner-slide {
  display: none;
  width: 100%;
  height: 100%;
}

.banner-slide.active {
  display: block;
  animation: fade 1.0s;
}

@keyframes fade {
  from {
    opacity: 0.4
  }

  to {
    opacity: 1
  }
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.3);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: var(--transition);
}

.slider-btn:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: translateY(-50%) scale(1.1);
}

.prev-btn {
  left: 20px;
}

.next-btn {
  right: 20px;
}

.slider-dots {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 20;
}

.dot {
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}

.dot.active,
.dot:hover {
  background: white;
  transform: scale(1.2);
}

.hero-banner:hover .banner-img {
  transform: scale(1.02);
}

.banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
  z-index: 10;
}

/* Header mystical decoration */
.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: twinkle 8s linear infinite;
  pointer-events: none;
}

@keyframes twinkle {

  0%,
  100% {
    opacity: 0.3;
    transform: rotate(0deg);
  }

  50% {
    opacity: 0.6;
    transform: rotate(1deg);
  }
}

.header h1 {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.header h1 i {
  margin-right: 12px;
}

.header p {
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 10px;
  position: relative;
  z-index: 1;
}

/* Header Actions */
.header-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.header-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  font-size: 0.875rem;
}

.header-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Theme Toggle */
.theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(20deg) scale(1.1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  opacity: 0;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.card:hover::before {
  opacity: 1;
}

.card-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-title i {
  color: var(--primary);
  font-size: 1.4rem;
}

/* ===== Grid Layout ===== */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input-sm {
  padding: 8px 12px;
  font-size: 0.875rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
  color: white;
}

.btn-success:hover {
  box-shadow: var(--shadow-glow-secondary);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.125rem;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Ngũ Hành Badges ===== */
.nguhanh-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: var(--transition);
}

.nguhanh-kim {
  background: var(--kim-bg);
  color: var(--kim);
  border: 1px solid var(--kim);
}

.nguhanh-moc {
  background: var(--moc-bg);
  color: var(--moc);
  border: 1px solid var(--moc);
}

.nguhanh-thuy {
  background: var(--thuy-bg);
  color: var(--thuy);
  border: 1px solid var(--thuy);
}

.nguhanh-hoa {
  background: var(--hoa-bg);
  color: var(--hoa);
  border: 1px solid var(--hoa);
}

.nguhanh-tho {
  background: var(--tho-bg);
  color: var(--tho);
  border: 1px solid var(--tho);
}

.nguhanh-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px currentColor;
}

/* ===== Score Input Grid ===== */
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.score-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  transition: var(--transition);
}

.score-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.score-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-item input {
  width: 100%;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
}

.score-item input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===== Bát Tự Display ===== */
.battu-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.battu-column {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-input) 100%);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.battu-column::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.1), transparent 70%);
  opacity: 0;
  transition: var(--transition);
}

.battu-column:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.battu-column:hover::before {
  opacity: 1;
}

.battu-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.battu-can {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
  position: relative;
  z-index: 1;
}

.battu-chi {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.battu-napam {
  font-size: 0.75rem;
  color: var(--accent);
  position: relative;
  z-index: 1;
}

/* ===== Results Table ===== */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.results-table th,
.results-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.results-table th {
  background: var(--bg-input);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-table tr:hover td {
  background: var(--bg-hover);
}

.results-table td {
  color: var(--text-primary);
}

/* ===== Khối Grid ===== */
.khoi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.khoi-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.khoi-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
  opacity: 0;
  transition: var(--transition);
}

.khoi-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.khoi-item:hover::before {
  opacity: 1;
}

.khoi-ma {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-light);
}

.khoi-ten {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 4px 0;
}

.khoi-diem {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary);
}

/* ===== Recommendations ===== */
.recommend-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recommend-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.recommend-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.recommend-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateX(8px);
}

.recommend-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.recommend-school {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.recommend-major {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 4px 0;
}

.recommend-score {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--secondary);
}

.recommend-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  padding: 4px 10px;
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ===== Selected Tags ===== */
.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 32px;
  padding: 4px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

/* Search input for filters */
#searchTruong,
#searchKhoi {
  margin-bottom: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

#searchTruong:focus,
#searchKhoi:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.selected-tag .remove-tag {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 0.8rem;
  padding: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
}

.selected-tag .remove-tag:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 32px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.modal-body {
  color: var(--text-secondary);
  line-height: 1.8;
}

.modal-body h3 {
  color: var(--text-primary);
  margin: 20px 0 10px;
}

.modal-body ul {
  margin-left: 20px;
}

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  transition: var(--transition);
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.tab:hover:not(.active) {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ===== Đại Vận Display ===== */
.daivan-timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0;
}

.daivan-item {
  flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  min-width: 100px;
  transition: var(--transition);
  cursor: pointer;
}

.daivan-item:hover,
.daivan-item.active {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
}

.daivan-item.active {
  box-shadow: var(--shadow-glow);
}

.daivan-tuoi {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.daivan-canchi {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 8px 0;
}

.daivan-nam {
  font-size: 0.75rem;
  color: var(--accent);
}

/* ===== Admin Specific ===== */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.data-table-container {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.data-table th {
  background: var(--bg-input);
  font-weight: 600;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.75rem;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.pagination-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0 12px;
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  backdrop-filter: blur(10px);
}

.toast.success {
  border-left: 4px solid var(--secondary);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), var(--bg-card));
}

.toast.error {
  border-left: 4px solid var(--danger);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1), var(--bg-card));
}

.toast.warning {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.1), var(--bg-card));
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== AI Analysis Result ===== */
.ai-result {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-top: 20px;
}

.ai-result h3 {
  color: var(--primary-light);
  margin-bottom: 16px;
}

.ai-result p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.ai-result strong {
  color: var(--text-primary);
}

.ai-result ul,
.ai-result ol {
  margin-left: 20px;
  color: var(--text-secondary);
}

.ai-result li {
  margin-bottom: 8px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
  color: var(--primary);
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* ===== File Input ===== */
.file-input-wrapper {
  position: relative;
  display: inline-block;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* ===== Radio Group ===== */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.radio-label:hover {
  border-color: var(--primary);
}

.radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.radio-custom {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  transition: var(--transition);
}

.radio-label input[type="radio"]:checked+.radio-custom {
  background: var(--primary);
  border-color: var(--primary);
}

.radio-label input[type="radio"]:checked+.radio-custom::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

/* ===== Status Badge ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
}

.status-local {
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary-light);
  border: 1px solid var(--primary);
}

.status-api {
  background: rgba(16, 185, 129, 0.2);
  color: var(--secondary);
  border: 1px solid var(--secondary);
}

.status-error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* ===== Card Header ===== */
.card-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-input);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ===== Affiliate Section ===== */
.affiliate-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.affiliate-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}

.affiliate-item.active {
  border-color: var(--secondary);
  background: rgba(16, 185, 129, 0.05);
}

.affiliate-info {
  flex: 1;
}

.affiliate-name {
  font-weight: 600;
  color: var(--text-primary);
}

.affiliate-url {
  font-size: 0.875rem;
  color: var(--text-muted);
  word-break: break-all;
}

.affiliate-stats {
  display: flex;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.affiliate-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .battu-display {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal {
    padding: 20px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

/* ===== Mobile & Performance Optimizations ===== */

/* Improved mobile responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .card {
    padding: 20px;
    margin-bottom: 20px;
  }

  .card-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }

  .grid {
    gap: 20px;
  }

  .score-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }

  .score-item {
    padding: 12px;
  }

  .score-item input {
    font-size: 1rem;
  }

  .khoi-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .khoi-item {
    padding: 16px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .btn-group {
    flex-direction: column;
    gap: 8px;
  }

  .btn-block {
    width: 100%;
  }

  .results-table {
    font-size: 0.8rem;
  }

  .results-table th,
  .results-table td {
    padding: 8px 10px;
  }

  .recommend-item {
    padding: 16px;
  }

  .recommend-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .recommend-school {
    font-size: 0.75rem;
  }

  .recommend-major {
    font-size: 1rem;
  }

  .recommend-score {
    font-size: 1.1rem;
  }

  .tabs {
    flex-direction: column;
    padding: 0;
  }

  .tab {
    padding: 10px 15px;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.25rem;
  }

  .header p {
    font-size: 0.9rem;
  }

  .card {
    padding: 16px;
  }

  .form-input,
  .form-select,
  .form-textarea {
    padding: 10px;
    font-size: 0.9rem;
  }

  .score-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .battu-display {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .battu-column {
    padding: 16px;
  }

  .battu-can {
    font-size: 2rem;
  }

  .battu-chi {
    font-size: 1.5rem;
  }

  .khoi-grid {
    grid-template-columns: 1fr;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    padding: 12px 16px;
  }
}

/* Performance optimizations */

/* Optimize animations */
* {
  will-change: auto;
}

/* Optimize for smoother scrolling */
html {
  scroll-behavior: smooth;
}

/* Optimize images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Optimize for touch devices */
button,
input,
select,
textarea {
  font-size: 16px;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

/* Optimize for faster rendering */
.card,
.btn,
.form-input,
.khoi-item,
.recommend-item {
  will-change: transform;
}

/* Optimize transitions */
.card,
.btn,
.khoi-item,
.recommend-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Optimize for better performance on lower-end devices */
@media (max-width: 768px) {
  body::before {
    background: none;
  }

  .card::before,
  .battu-column::before {
    display: none;
  }
}

/* Optimize for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Optimize for faster loading */
.loading {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive video container */
.video-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  /* 16:9 Aspect Ratio */
  overflow: hidden;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Footer styles */
.footer {
  background: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 50%, #7c3aed 100%);
  color: white;
  padding: 40px 0 20px;
  margin-top: 40px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.footer-section h3 {
  margin-bottom: 15px;
  color: white;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul li a {
  color: #e0e0e0;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-section ul li a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  margin-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    padding: 0 10px;
  }
}

.gradient-text {
  background: linear-gradient(90deg, #ff6a00, #ffcc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
}

.gradient-text i {
  color: #ffcc00;
}

/* ===== Course Suggestion Styles ===== */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-input);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  transition: background 0.2s;
}

.checkbox-item:hover {
  background: var(--bg-hover);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.course-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
}

.video-card {
  background: var(--bg-input);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.video-card:hover {
  transform: scale(1.02);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-glow);
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-info {
  padding: 15px;
}

.video-subject {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-light);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.video-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.video-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-tag {
  display: inline-block;
  font-size: 0.7rem;
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 5px;
  margin-top: 10px;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .hero-banner {
    height: 200px;
  }
}