/* ══════════════════════════════════════════════
   OnThi365 — Design System
   Aesthetic: Clean editorial, warm & trustworthy
   Font: Be Vietnam Pro (Vietnamese optimized)
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800;900&display=swap');

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Brand */
  --brand: #0066FF;
  --brand-dark: #0050CC;
  --brand-darker: #003D99;
  --brand-light: #E6F0FF;
  --brand-lighter: #F0F6FF;

  /* Accent (warm orange for CTAs) */
  --accent: #FF6B2C;
  --accent-dark: #E55A1B;
  --accent-light: #FFF3ED;

  /* Semantic */
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;

  /* Neutrals */
  --white: #FFFFFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --gray-950: #0A0F1A;

  /* Layout */
  --max-w: 1200px;
  --header-h: 68px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-brand: 0 4px 14px rgba(0,102,255,0.25);

  /* Font */
  --font: 'Be Vietnam Pro', -apple-system, sans-serif;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ── Utility ── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
@media (min-width: 768px) { .container { padding: 0 32px; } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ── Animations ── */
@keyframes fadeUp { from { opacity:0; transform:translateY(24px) } to { opacity:1; transform:translateY(0) } }
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }
@keyframes slideDown { from { opacity:0; transform:translateY(-12px) } to { opacity:1; transform:translateY(0) } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes marquee { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
@keyframes scaleIn { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }

/* ══════════════════
   HEADER — Plan C (2-row, search centered)
   ══════════════════ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: box-shadow 0.3s var(--ease);
}
.header.scrolled { box-shadow: var(--shadow-sm); }

/* Row 1: logo + search + actions */
.header-top {
  display: flex; align-items: center; padding: 0 28px; height: 54px;
  gap: 16px; border-bottom: 1px solid var(--gray-100);
}
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-mark {
  width: 32px; height: 32px; background: var(--brand); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.logo-mark::after {
  content: '365'; color: #fff; font-weight: 900; font-size: 11px; letter-spacing: -0.3px;
}
.logo-text {
  font-size: 19px; font-weight: 800; color: var(--gray-900); letter-spacing: -0.5px;
}
.logo-text em { font-style: normal; color: var(--brand); }

.header-search {
  flex: 1; max-width: 460px; height: 38px; border-radius: 20px;
  background: var(--gray-50); border: 1.5px solid var(--gray-200);
  display: flex; align-items: center; padding: 0 14px; gap: 8px;
  transition: all 0.2s var(--ease); margin: 0 12px;
}
.header-search:focus-within {
  border-color: var(--brand); background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,102,255,0.06);
}
.header-search svg { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.header-search input {
  border: none; background: transparent; flex: 1; font-size: 13px;
  outline: none; font-family: inherit; color: var(--gray-700);
}
.header-search input::placeholder { color: var(--gray-400); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-ghost {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; color: var(--gray-600);
  border: 1px solid var(--gray-200); transition: all 0.15s var(--ease);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-accent-sm {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; background: var(--accent); color: #fff;
  transition: all 0.15s var(--ease);
}
.btn-accent-sm:hover { background: var(--accent-dark); }
.btn-brand {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; background: var(--brand); color: #fff;
  transition: all 0.15s var(--ease);
}
.btn-brand:hover { background: var(--brand-dark); }

/* Logged-in avatar */
.header-user {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 12px 3px 3px; border-radius: var(--radius-full);
  background: var(--gray-50); border: 1px solid var(--gray-200);
  font-size: 12px; font-weight: 600; color: var(--gray-700);
  cursor: pointer; transition: all 0.15s;
}
.header-user:hover { border-color: var(--brand); }
.header-user .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}

/* Row 2: sub nav */
.header-sub {
  display: flex; align-items: center; padding: 0 28px; height: 40px;
  gap: 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--gray-100);
}
.header-sub::-webkit-scrollbar { display: none; }
.sub-link {
  padding: 9px 16px; font-size: 13px; font-weight: 500; color: var(--gray-500);
  white-space: nowrap; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s var(--ease);
}
.sub-link:hover { color: var(--gray-800); }
.sub-link.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.mobile-toggle { display: none; }

/* Header height for page offset */
:root { --header-h: 95px; }

/* ══════════════════
   REUSABLE COMPONENTS
   ══════════════════ */

/* Section */
.section { padding: 64px 0; }
@media (min-width: 768px) { .section { padding: 80px 0; } }
.section.alt { background: var(--gray-50); }
.section.dark { background: var(--gray-950); color: #fff; }

.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 32px; gap: 16px;
}
.section-title {
  font-size: 24px; font-weight: 700; color: var(--gray-900);
  letter-spacing: -0.3px;
}
@media (min-width: 768px) { .section-title { font-size: 28px; } }
.section.dark .section-title { color: #fff; }

.section-link {
  font-size: 14px; font-weight: 600; color: var(--brand);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  transition: all 0.2s var(--ease); white-space: nowrap;
  flex-shrink: 0;
}
.section-link:hover { background: var(--brand-light); }
.section-link::after { content: '→'; transition: transform 0.2s var(--ease); }
.section-link:hover::after { transform: translateX(3px); }
.section.dark .section-link { color: var(--accent); }
.section.dark .section-link:hover { background: rgba(255,107,44,0.1); }

/* Tags / Badges */
.tag {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: var(--radius-full); font-size: 12px; font-weight: 600;
}
.tag-brand { background: var(--brand-light); color: var(--brand); }
.tag-accent { background: var(--accent-light); color: var(--accent-dark); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-gray { background: var(--gray-100); color: var(--gray-600); }

/* Subject colors */
.subj-ly { --subj: #2563EB; --subj-bg: #EFF6FF; }
.subj-toan { --subj: #D97706; --subj-bg: #FFFBEB; }
.subj-hoa { --subj: #059669; --subj-bg: #ECFDF5; }
.subj-sinh { --subj: #7C3AED; --subj-bg: #F5F3FF; }
.subj-anh { --subj: #DB2777; --subj-bg: #FDF2F8; }
.subj-van { --subj: #DC2626; --subj-bg: #FEF2F2; }

/* Card base */
.card {
  background: var(--white); border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  transition: all 0.3s var(--ease);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: transparent; transform: translateY(-3px); }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 7px 18px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; color: var(--gray-600);
  background: var(--gray-100); transition: all 0.2s var(--ease);
}
.tab:hover { background: var(--gray-200); }
.tab.active { background: var(--brand); color: #fff; }

/* Course card */
.course-card { display: flex; flex-direction: column; }
.course-card .thumb {
  aspect-ratio: 16/10; position: relative; overflow: hidden;
  background: var(--gray-100);
}
.course-card .thumb-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.course-card:hover .thumb-img { transform: scale(1.05); }
.course-card .thumb-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);
}
.course-card .thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center; font-weight: 600; font-size: 13px; color: #fff;
}
.course-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-card .title {
  font-size: 14px; font-weight: 600; line-height: 1.5; color: var(--gray-800);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 10px; flex: 1;
}
.course-card .meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--gray-500);
}
.course-card .avatar-mini {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; flex-shrink: 0;
}
.course-card .price-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-100);
}
.course-card .price {
  font-size: 16px; font-weight: 700; color: var(--accent);
}
.course-card .price-old {
  font-size: 12px; color: var(--gray-400); text-decoration: line-through; margin-left: 6px;
}
.course-card .btn-enroll {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: var(--brand-light); transition: all 0.2s;
}
.course-card:hover .btn-enroll { background: var(--brand); color: #fff; }

/* Courses grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Teacher card */
.teacher-card {
  flex-shrink: 0; width: 140px; text-align: center;
  padding: 8px; transition: transform 0.3s var(--ease);
}
.teacher-card:hover { transform: translateY(-4px); }
.teacher-avatar {
  width: 100px; height: 100px; border-radius: 50%;
  margin: 0 auto 10px; overflow: hidden;
  border: 3px solid var(--gray-100);
  transition: border-color 0.3s;
  background: var(--gray-100);
}
.teacher-card:hover .teacher-avatar { border-color: var(--brand); }
.teacher-avatar-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
}
.teacher-name { font-size: 13px; font-weight: 600; color: var(--gray-700); line-height: 1.35; }

/* Exam card */
.exam-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--white);
  border-radius: var(--radius-md); border: 1px solid var(--gray-200);
  transition: all 0.2s var(--ease);
}
.exam-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand); }
.exam-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
  color: var(--subj); background: var(--subj-bg);
}
.exam-info { flex: 1; min-width: 0; }
.exam-name {
  font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--gray-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exam-details { display: flex; gap: 10px; margin-top: 5px; font-size: 12px; color: var(--gray-400); align-items: center; }

/* Arena card */
.arena-card {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md); padding: 24px;
  transition: all 0.3s var(--ease); position: relative;
}
.arena-card:hover {
  background: rgba(255,255,255,0.08); border-color: var(--accent);
  transform: translateY(-3px);
}
.arena-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; margin-bottom: 12px;
}
.arena-status.open { background: rgba(16,185,129,0.15); color: #34D399; }
.arena-status.open::before {
  content:''; width:6px; height:6px; border-radius:50%;
  background:#34D399; animation: pulse 2s infinite;
}
.arena-status.closed { background: rgba(239,68,68,0.15); color: #F87171; }
.arena-subject {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent); margin-bottom: 6px;
}
.arena-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; color: #fff; }
.arena-meta { display: flex; gap: 16px; font-size: 12px; color: rgba(255,255,255,0.4); }

/* ══════════════════
   FOOTER
   ══════════════════ */
.footer { background: var(--gray-900); color: rgba(255,255,255,0.6); padding: 56px 0 0; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
  gap: 40px; margin-bottom: 40px;
}
.footer .logo { margin-bottom: 14px; }
.footer .logo-text { color: #fff; }
.footer-desc { font-size: 14px; line-height: 1.7; margin-bottom: 16px; }
.footer-contact { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.footer h4 { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 18px; }
.footer-links a {
  display: block; font-size: 13px; padding: 4px 0;
  color: rgba(255,255,255,0.5); transition: color 0.2s;
}
.footer-links a:hover { color: #fff; }
.footer-newsletter { display: flex; gap: 6px; }
.footer-newsletter input {
  flex: 1; padding: 9px 12px; border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm); background: rgba(255,255,255,0.05);
  color: #fff; font-size: 13px; min-width: 0;
}
.footer-newsletter input::placeholder { color: rgba(255,255,255,0.3); }
.footer-newsletter button {
  padding: 9px 16px; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: background 0.2s;
}
.footer-newsletter button:hover { background: var(--brand-dark); }
.footer-social { display: flex; gap: 8px; margin-top: 16px; }
.footer-social a {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: rgba(255,255,255,0.5); transition: all 0.2s;
}
.footer-social a:hover { background: var(--brand); color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 18px 0; text-align: center;
  font-size: 12px; color: rgba(255,255,255,0.25);
}

/* Floating buttons */
.float-btns {
  position: fixed; bottom: 20px; right: 20px; z-index: 900;
  display: flex; flex-direction: column; gap: 10px;
}
.float-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; box-shadow: var(--shadow-lg);
  transition: all 0.2s var(--ease);
}
.float-btn:hover { transform: scale(1.1); }
.float-btn.messenger { background: #0084FF; }
.float-btn.zalo { background: #0068FF; }
.float-btn.phone { background: var(--success); }

/* ══════════════════
   RESPONSIVE
   ══════════════════ */
@media (max-width: 900px) {
  .header-search { display: none; }
  .header-sub { padding: 0 16px; }
  .sub-link { padding: 9px 12px; font-size: 12px; }
  .mobile-toggle { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .btn-accent-sm { display: none; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
  .courses-grid { grid-template-columns: 1fr; }
  .header-actions .btn-ghost { display: none; }
}

/* ── Placeholder gradient colors ── */
.grad-1 { background: linear-gradient(135deg, #0066FF, #00C2FF); }
.grad-2 { background: linear-gradient(135deg, #FF6B2C, #FFB347); }
.grad-3 { background: linear-gradient(135deg, #10B981, #34D399); }
.grad-4 { background: linear-gradient(135deg, #8B5CF6, #A78BFA); }
.grad-5 { background: linear-gradient(135deg, #EC4899, #F472B6); }
.grad-6 { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
