/* =========================================
   1. COLOR VARIABLES & THEME
   ========================================= */
:root {
  /* MÀU SÁNG - THIẾT KẾ iOS/NOTION CAO CẤP */
  --bg: #f6f8fb;
  --bg-soft: #e9f1ff;
  --list-bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --text: #101827;
  --text-sub: #5f6b7a;
  --border: rgba(15, 23, 42, 0.1);
  --accent: #2563eb;
  --accent-2: #0f9f6e;
  --accent-3: #f97316;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --nav-bg: rgba(246, 248, 251, 0.86);
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
  --shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.08);
  --blur: blur(20px);
}

body.dark-mode {
  /* MÀU TỐI - THIẾT KẾ iOS CAO CẤP */
  --bg: #090d14;
  --bg-soft: #111b2d;
  --list-bg: #111827;
  --surface: rgba(17, 24, 39, 0.78);
  --surface-strong: #141c2b;
  --text: #f8fafc;
  --text-sub: #a8b3c4;
  --border: rgba(148, 163, 184, 0.18);
  --accent: #60a5fa;
  --accent-2: #34d399;
  --accent-3: #fb923c;
  --accent-soft: rgba(96, 165, 250, 0.16);
  --nav-bg: rgba(9, 13, 20, 0.86);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.26);
}

/* =========================================
   2. RESET & BASE
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background:
    linear-gradient(135deg, var(--bg-soft), transparent 28rem),
    linear-gradient(180deg, var(--bg), var(--bg));
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  transition: background-color 0.4s ease, color 0.4s ease;
  padding-top: 70px;
  -webkit-font-smoothing: antialiased;
}

body.is-ready .hero-kicker,
body.is-ready .hero-title,
body.is-ready .hero-subtitle,
body.is-ready .resource-toolbar,
body.is-ready .semester-tabs-container {
  animation: riseIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body.is-ready .hero-title {
  animation-delay: 0.08s;
}

body.is-ready .hero-subtitle {
  animation-delay: 0.16s;
}

body.is-ready .resource-toolbar {
  animation-delay: 0.24s;
}

body.is-ready .semester-tabs-container {
  animation-delay: 0.3s;
}

h1,
h2,
h3,
h4,
h5,
h6,
.hero-title,
.empty-state h3,
.course-info h3 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

a {
  text-decoration: none !important;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* =========================================
   FLOATING UNIVERSITY CLOCK
   ========================================= */
.university-clock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(390px, calc(100vw - 32px));
  padding: 13px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.62)),
    var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow: hidden;
}

body.dark-mode .university-clock {
  background:
    linear-gradient(135deg, rgba(20, 28, 43, 0.92), rgba(17, 24, 39, 0.68)),
    var(--surface);
}

.university-clock::before {
  content: "";
  position: absolute;
  inset: -50% auto auto -12%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.22), transparent 64%);
  pointer-events: none;
}

.clock-icon {
  position: relative;
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}

.clock-icon::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 18px;
  animation: clockRing 2.8s ease-in-out infinite;
}

.clock-content {
  position: relative;
  min-width: 0;
  flex: 1;
}

.clock-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.clock-label,
#university-progress {
  display: block;
  color: var(--text-sub);
  font-size: 0.72rem;
  font-weight: 800;
}

#university-percent {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
}

#university-elapsed {
  display: block;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  line-height: 1.2;
}

.clock-progress {
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(138, 138, 142, 0.16);
}

.clock-detail-button {
  position: relative;
  z-index: 2;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.clock-detail-button i {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  font-size: 0.75rem;
}

.clock-detail-button:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.3);
  transform: translateY(-2px);
}

#university-progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.36);
  transition: width 0.45s ease;
}

@keyframes clockRing {

  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.45;
  }

  50% {
    transform: scale(1.04);
    opacity: 0.95;
  }
}

/* =========================================
   3. NAVBAR (Minimal App Style)
   ========================================= */
.navbar {
  background-color: var(--nav-bg) !important;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 0.5px solid var(--border);
  padding: 10px 0;
  transition: all 0.4s ease;
}

.navbar-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text) !important;
}

.navbar-nav .nav-link {
  color: var(--text-sub) !important;
  font-weight: 600;
  font-size: 0.95rem;
  margin-left: 20px;
  border-radius: 8px;
  transition: color 0.2s, background-color 0.2s;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
  color: var(--text) !important;
  background: var(--accent-soft);
}

/* Theme Toggle Button */
#theme-toggle {
  background: var(--list-bg);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.3rem;
  outline: none;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s, color 0.2s;
}

#theme-toggle:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.navbar-toggler {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  padding: 0 10px;
  outline: none;
}

/* =========================================
   4. HERO SECTION
   ========================================= */
.hero-section {
  position: relative;
  padding: 54px 20px 28px;
  text-align: center;
  max-width: 1080px;
  margin: 0 auto;
}

.hero-section::before {
  content: "";
  position: absolute;
  inset: 22px 20px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.hero-kicker i {
  animation: softPulse 2.4s ease-in-out infinite;
}

body.dark-mode .hero-kicker {
  background: rgba(17, 22, 32, 0.72);
}

.hero-title {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(2.25rem, 5vw, 4.75rem);
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 15px;
  color: var(--text);
  line-height: 1.02;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-sub);
  line-height: 1.6;
  max-width: 860px;
  margin: 0 auto 12px;
}

.messenger-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
  transition: color 0.2s;
}

.messenger-link:hover,
.messenger-link:focus {
  color: var(--accent-2);
}

/* =========================================
   HERO SERVICES & CONTACT — PREMIUM REDESIGN
   ========================================= */
.hero-services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  max-width: 940px;
  margin: 0 auto 34px;
}

@media (min-width: 768px) {
  .hero-services {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hero-services .service-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.35s ease,
              border-color 0.3s ease;
}

/* Decorative accent top bar */
.hero-services .service-item::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 18px 18px 0 0;
  transition: height 0.3s ease;
}

.service-item[data-accent="orange"]::before {
  background: linear-gradient(90deg, #f97316, #ef4444);
}

.service-item[data-accent="blue"]::before {
  background: linear-gradient(90deg, #0284c7, #2563eb);
}

.service-item[data-accent="purple"]::before {
  background: linear-gradient(90deg, #7c3aed, #db2777);
}

.hero-services .service-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
  border-color: rgba(37, 99, 235, 0.24);
}

.hero-services .service-item:hover::before {
  height: 5px;
}

body.dark-mode .hero-services .service-item {
  background: rgba(17, 24, 39, 0.85);
  border-color: rgba(148, 163, 184, 0.14);
}

body.dark-mode .hero-services .service-item:hover {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* ── Card Header ── */
.service-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 0;
}

.hero-services .service-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  color: #fff;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.service-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.service-title {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.service-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(239, 68, 68, 0.1));
  color: #c2410c;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.service-badge i {
  font-size: 0.58rem;
}

.service-badge.badge-green {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.15), rgba(34, 197, 94, 0.1));
  color: #047857;
}

body.dark-mode .service-badge.badge-green {
  color: #34d399;
}

.service-badge.badge-purple {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(219, 39, 119, 0.1));
  color: #6d28d9;
}

body.dark-mode .service-badge.badge-purple {
  color: #a78bfa;
}

body.dark-mode .service-badge {
  color: #fb923c;
}

/* ── Card Description ── */
.service-desc {
  margin: 0;
  padding: 12px 20px 0;
  font-size: 0.9rem;
  color: var(--text-sub);
  line-height: 1.55;
}

/* ── Toggle Button ── */
.service-detail-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 20px 18px;
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.service-detail-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.service-detail-toggle:active {
  transform: scale(0.97);
  box-shadow: none;
}

/* Toggle text show/hide */
.toggle-text-hide {
  display: none;
}

.service-item.expanded .toggle-text-show {
  display: none;
}

.service-item.expanded .toggle-text-hide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toggle-text-show {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toggle-text-show i,
.toggle-text-hide i {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.service-item.expanded .service-detail-toggle {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  margin-bottom: 0;
}

/* ── Detail Content Panel ── */
.service-detail-content {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              padding 0.35s ease;
  padding: 0 20px;
}

.service-item.expanded .service-detail-content {
  max-height: 320px;
  opacity: 1;
  padding: 14px 20px 20px;
}

.service-detail-content ul {
  list-style: none;
  padding: 16px;
  margin: 0;
  background: linear-gradient(135deg, var(--bg-soft), var(--bg));
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.dark-mode .service-detail-content ul {
  background: linear-gradient(135deg, rgba(17, 27, 45, 0.7), rgba(9, 13, 20, 0.5));
}

.service-detail-content li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-sub);
  line-height: 1.5;
  text-align: left;
}

.service-detail-content li i {
  color: var(--accent-2);
  font-size: 0.82rem;
  margin-top: 3px;
  flex-shrink: 0;
}

/* ── Expanded card visual boost ── */
.service-item.expanded {
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 12px 40px rgba(37, 99, 235, 0.1);
}

.service-item.expanded::before {
  height: 5px;
}

.hero-contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0 auto 45px;
  max-width: 760px;
  padding: 20px;
  background: var(--surface-strong);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

@media (min-width: 768px) {
  .hero-contact {
    flex-direction: row;
    justify-content: space-between;
    padding: 20px 30px;
  }
}

.contact-text {
  font-size: 1.05rem;
  color: var(--text);
  margin: 0;
  text-align: center;
}

@media (min-width: 768px) {
  .contact-text {
    text-align: left;
  }
}

.btn-messenger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: linear-gradient(135deg, #00B2FF, #006AFF);
  color: #fff !important;
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: 999px;
  text-decoration: none !important;
  box-shadow: 0 8px 24px rgba(0, 106, 255, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.btn-messenger:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 106, 255, 0.4);
}

/* =========================================
   4.5 RESOURCE TOOLBAR
   ========================================= */
.resource-toolbar {
  max-width: 760px;
  margin: 0 auto 22px;
  padding: 16px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

body.dark-mode .resource-toolbar {
  background: rgba(17, 22, 32, 0.76);
}

.search-box {
  min-width: 0;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-sub);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.search-box input::placeholder {
  color: var(--text-sub);
  font-weight: 600;
}

#clear-search {
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
}

#clear-search.is-visible {
  display: inline-flex;
}

/* =========================================
   5. STICKY TABS NAVIGATION
   ========================================= */
.semester-tabs-container {
  position: sticky;
  top: 70px;
  z-index: 900;
  background: transparent;
  padding: 12px 0 18px;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  border-bottom: 0;
}

/* Ẩn thanh cuộn nhưng cho phép cuộn ngang gọn gàng trên mobile */
.semester-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
  background: var(--surface);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-soft);
  max-width: 100%;
}

.semester-tabs::-webkit-scrollbar {
  display: none;
}

.semester-tabs .nav-link {
  border-radius: 9px;
  padding: 9px 16px;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.semester-tabs .nav-link:hover {
  color: var(--text);
}

.semester-tabs .nav-link.active {
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

body.dark-mode .semester-tabs .nav-link.active {
  background: #ffffff;
  color: #000000;
}

/* =========================================
   6. PREMIUM iOS-STYLE LIST VIEW
   ========================================= */
.tab-content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 15px 50px;
  animation: fadeInList 0.4s ease forwards;
}

.global-results {
  display: none;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 15px 50px;
}

.global-results.is-visible {
  display: block;
  animation: fadeInList 0.25s ease forwards;
}

.results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 14px;
}

.results-kicker {
  display: block;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.results-header h2 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
}

.results-count {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--list-bg);
  color: var(--text-sub);
  font-size: 0.85rem;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

@keyframes fadeInList {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

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

@keyframes softPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.78;
  }

  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@keyframes skeletonSweep {
  from {
    background-position: 220% 0;
  }

  to {
    background-position: -220% 0;
  }
}

.course-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.course-item {
  display: flex;
  align-items: center;
  position: relative;
  min-height: 132px;
  padding: 18px;
  background: var(--surface-strong);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.course-item::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--semester-accent, var(--accent));
  opacity: 0.8;
}

.course-item.reveal-card {
  opacity: 0;
  transform: translateY(20px) scale(0.98);
}

.course-item.reveal-card.is-visible {
  animation: cardReveal 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body:not(.is-ready) .course-item {
  background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  background-size: 220% 100%;
  animation: skeletonSweep 1.2s ease-in-out infinite;
}

.course-item:last-child {
  border-bottom: 0.5px solid var(--border);
}

.course-item:hover {
  border-color: rgba(37, 99, 235, 0.34);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.course-item.focus-flash {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow);
}

.course-item-coming {
  cursor: default;
}

.course-item-coming .course-action {
  background: rgba(138, 138, 142, 0.13);
  color: var(--text-sub);
}

body.dark-mode .course-item:hover {
  background: #162033;
}

.course-item:active {
  background: rgba(0, 0, 0, 0.05);
  /* Tap highlight */
}

.course-item:focus-visible,
#clear-search:focus-visible,
#theme-toggle:focus-visible,
.navbar-toggler:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Icon / Graphic Left */
.course-icon {
  width: 58px;
  height: 58px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  flex-shrink: 0;
  margin-right: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 10px 24px rgba(15, 23, 42, 0.12);
  transition: transform 0.25s;
}

.course-item:hover .course-icon {
  transform: rotate(-2deg) scale(1.06);
}

.course-item:hover .course-action {
  transform: translateX(3px);
}

/* Vibrant App Gradients */
.bg-gradient-1 {
  background: linear-gradient(135deg, #f97316, #ef4444);
}

.bg-gradient-2 {
  background: linear-gradient(135deg, #0284c7, #2563eb);
}

.bg-gradient-3 {
  background: linear-gradient(135deg, #059669, #22c55e);
}

.bg-gradient-4 {
  background: linear-gradient(135deg, #7c3aed, #db2777);
}

.bg-gradient-5 {
  background: linear-gradient(135deg, #ca8a04, #f97316);
}

.bg-gradient-6 {
  background: linear-gradient(135deg, #dc2626, #be123c);
}

/* Center Text Content */
.course-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.course-tools {
  position: absolute;
  top: 9px;
  right: 10px;
  display: inline-flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
}

.course-item:hover .course-tools,
.course-item:focus-within .course-tools {
  opacity: 1;
  transform: translateY(0);
}

.course-tool {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: rgba(138, 138, 142, 0.14);
  color: var(--text);
  cursor: pointer;
}

.course-tool.is-bookmarked {
  background: rgba(249, 115, 22, 0.16);
  color: var(--accent-3);
}

.course-status {
  color: var(--accent-3);
  background: rgba(249, 115, 22, 0.12);
}

.course-info h3 {
  font-size: 1.32rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-info p {
  font-size: 0.94rem;
  color: var(--text-sub);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges / Tags */
.tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(138, 138, 142, 0.15);
  color: var(--text-sub);
  padding: 5px 8px;
  border-radius: 8px;
}

.highlight-alert {
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.1);
}

.highlight-success {
  color: #34c759;
  background: rgba(52, 199, 89, 0.1);
}

.semester-tag {
  color: var(--accent);
  background: var(--accent-soft);
}

.hot-tag {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.new-tag {
  color: var(--accent-2);
  background: rgba(15, 159, 110, 0.12);
}

body.dark-mode .highlight-alert {
  color: #ff453a;
}

body.dark-mode .highlight-success {
  color: #32d74b;
}

/* Right Chevron */
.course-action {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
  margin-left: 10px;
  transition: transform 0.2s, background-color 0.2s;
}

body.dark-mode .course-action {
  color: rgba(235, 235, 245, 0.3);
}

.semester-theme-1 {
  --semester-accent: #f97316;
}

.semester-theme-2 {
  --semester-accent: #2563eb;
}

.semester-theme-3 {
  --semester-accent: #10b981;
}

.semester-theme-4 {
  --semester-accent: #7c3aed;
}

.semester-theme-5 {
  --semester-accent: #22c55e;
}

.semester-theme-6 {
  --semester-accent: #0ea5e9;
}

.semester-theme-7 {
  --semester-accent: #db2777;
}

.semester-theme-8 {
  --semester-accent: #14b8a6;
}

.semester-theme-9 {
  --semester-accent: #f59e0b;
}

/* =========================================
   7. EMPTY STATE (Trạng thái chờ)
   ========================================= */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  background: var(--surface-strong);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.no-results {
  display: none;
}

.no-results.is-visible {
  display: block;
}

.empty-icon {
  font-size: 3.5rem;
  color: var(--text-sub);
  margin-bottom: 15px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.empty-state p {
  font-size: 1rem;
  color: var(--text-sub);
}

/* =========================================
   8. FOOTER
   ========================================= */
footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 20px;
  color: var(--text-sub);
  font-size: 0.9rem;
}

#back-to-top {
  position: fixed;
  right: 18px;
  bottom: 118px;
  z-index: 1090;
  width: 44px;
  height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

#back-to-top.is-visible {
  display: inline-flex;
}

.toast-root {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1400;
  display: grid;
  gap: 10px;
}

.app-toast {
  padding: 11px 13px;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 850;
  animation: riseIn 0.25s ease both;
}

.app-toast.error {
  border-color: rgba(255, 59, 48, 0.4);
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

.course-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  padding: 18px;
  background: rgba(8, 13, 22, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.course-modal.is-open {
  display: grid;
  place-items: start center;
}

.modal-card {
  width: min(720px, 100%);
  margin-top: 8vh;
  padding: 14px;
  border: 0.5px solid var(--border);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.modal-card {
  position: relative;
  max-width: 620px;
}

.modal-visual {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 118px;
  margin: -2px -2px 18px;
  padding: 18px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 86% 18%, rgba(255, 255, 255, 0.34), transparent 28%),
    var(--modal-gradient);
  color: #fff;
  overflow: hidden;
}

.modal-visual-icon {
  width: 62px;
  height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 1.65rem;
}

.modal-visual span {
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  opacity: 0.82;
}

.modal-visual strong {
  display: block;
  margin-top: 4px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 900;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
}

.modal-course-head {
  display: flex;
  gap: 14px;
  padding-right: 40px;
}

.modal-course-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 900;
}

.modal-course-head p {
  color: var(--text-sub);
  font-weight: 750;
}

.modal-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.modal-info-grid div {
  padding: 12px;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.modal-info-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.modal-info-grid p {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions a,
.modal-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.social-icons {
  margin-bottom: 15px;
}

.social-icons .social-link {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin: 0 5px;
  border-radius: 50%;
  background: var(--list-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-size: 1.1rem;
  transition: all 0.2s;
}

.social-icons .social-link:hover {
  transform: scale(1.1);
  color: var(--accent);
}

/* =========================================
   9. MOBILE OPTIMIZATION
   ========================================= */
@media (max-width: 991px) {
  .navbar-collapse {
    background-color: var(--list-bg);
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    padding: 15px;
    border-radius: 16px;
    border: 0.5px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    z-index: 1000;
  }

  .navbar-nav .nav-link {
    margin-left: 0;
    padding: 12px 15px !important;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 60px;
  }

  .navbar {
    padding: 8px 0;
  }

  .navbar .container-fluid {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .navbar-brand {
    max-width: calc(100vw - 132px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.02rem;
  }

  .hero-section {
    padding: 26px 18px 14px;
    text-align: left;
  }

  .hero-section::before {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.08;
    margin-bottom: 12px;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 10px;
  }

  .hero-kicker {
    margin-bottom: 12px;
    font-size: 0.78rem;
  }

  main.container {
    max-width: none;
    padding-left: 12px;
    padding-right: 12px;
  }

  .resource-toolbar {
    max-width: none;
    margin: 4px 0 10px;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
  }

  .search-box {
    height: 46px;
    padding: 0 12px;
    border-radius: 10px;
  }

  .search-box input {
    font-size: 0.92rem;
  }

  .semester-tabs-container {
    top: 60px;
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--bg);
    overflow: hidden;
  }

  .semester-tabs {
    justify-content: flex-start;
    width: 100%;
    padding: 4px;
    border-radius: 12px;
  }

  .semester-tabs .nav-link {
    padding: 8px 13px;
    font-size: 0.84rem;
  }

  .course-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .course-item {
    min-height: 0;
    padding: 13px;
    border-radius: 12px;
    box-shadow: none;
  }

  .course-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    margin-right: 12px;
    font-size: 1.12rem;
    box-shadow: none;
  }

  .course-info h3 {
    font-size: 1.04rem;
    margin-bottom: 1px;
  }

  .course-info p {
    font-size: 0.86rem;
  }

  .tags {
    gap: 6px;
    margin-top: 8px;
  }

  .badge-tag {
    padding: 4px 7px;
    font-size: 0.68rem;
    border-radius: 7px;
  }

  .tab-content,
  .global-results {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 32px;
  }

  .results-header {
    margin: 4px 0 10px;
  }

  .results-header h2 {
    font-size: 1.12rem;
  }

  .results-count {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .course-tools {
    position: static;
    margin-left: auto;
    opacity: 1;
    transform: none;
  }

  .university-clock {
    display: none;
  }

  /* ── Hero Services Mobile ── */
  .hero-services {
    gap: 12px;
    margin-bottom: 20px;
  }

  .hero-services .service-item {
    border-radius: 16px;
  }

  .hero-services .service-item:hover {
    transform: none;
  }

  .service-card-header {
    padding: 16px 16px 0;
    gap: 12px;
  }

  .hero-services .service-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.1rem;
  }

  .service-title {
    font-size: 0.98rem;
  }

  .service-badge {
    font-size: 0.62rem;
    padding: 2px 8px;
  }

  .service-desc {
    padding: 10px 16px 0;
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .service-detail-toggle {
    margin: 12px 16px 14px;
    padding: 10px 16px;
    min-height: 42px;
    font-size: 0.82rem;
    border-radius: 10px;
  }

  .service-detail-toggle:hover {
    transform: none;
  }

  .service-item.expanded .service-detail-toggle {
    margin-bottom: 0;
  }

  .service-item.expanded .service-detail-content {
    padding: 12px 16px 16px;
  }

  .service-detail-content {
    padding: 0 16px;
  }

  .service-detail-content ul {
    padding: 12px 14px;
    border-radius: 10px;
    gap: 8px;
  }

  .service-detail-content li {
    font-size: 0.82rem;
    gap: 8px;
    line-height: 1.45;
  }

  .service-detail-content li i {
    font-size: 0.72rem;
    margin-top: 3px;
  }

}

@media (max-width: 900px) {
  .course-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-title {
    font-size: 1.82rem;
  }

  .hero-subtitle br {
    display: none;
  }

  .course-item {
    align-items: flex-start;
  }

  .course-action {
    display: none;
  }

  .course-icon {
    width: 40px;
    height: 40px;
    margin-right: 11px;
  }

  /* ── Hero Services Extra Small ── */
  .hero-services {
    gap: 10px;
  }

  .service-card-header {
    padding: 14px 14px 0;
    gap: 10px;
  }

  .hero-services .service-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 1rem;
  }

  .service-title {
    font-size: 0.92rem;
  }

  .service-desc {
    padding: 8px 14px 0;
    font-size: 0.82rem;
  }

  .service-detail-toggle {
    margin: 10px 14px 12px;
    padding: 9px 14px;
    font-size: 0.78rem;
    min-height: 40px;
  }

  .service-detail-content {
    padding: 0 14px;
  }

  .service-item.expanded .service-detail-content {
    padding: 10px 14px 14px;
  }

  .service-detail-content ul {
    padding: 10px 12px;
  }

  .service-detail-content li {
    font-size: 0.78rem;
    gap: 7px;
  }

  .course-info p {
    white-space: normal;
  }

  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #back-to-top {
    right: 14px;
    bottom: 96px;
  }

  .toast-root {
    left: 12px;
    right: 12px;
    bottom: 76px;
  }

  .course-modal {
    padding: 12px;
  }

  .modal-card {
    margin-top: 4vh;
  }

  .modal-info-grid {
    grid-template-columns: 1fr;
  }

  .modal-visual {
    min-height: 96px;
    padding: 14px;
  }

  .modal-visual strong {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .course-item.reveal-card {
    opacity: 1;
    transform: none;
  }
}