@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #0f3d1a;
  --primary-light: #1a6b2e;
  --primary-dark: #0a2e14;
  --accent: #1a6b2e;
  --accent-hover: #0f3d1a;
  --success: #2d9e4f;
  --success-light: #d4f5de;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --band-low: #ef4444;
  --band-mid: #f59e0b;
  --band-high: #2d9e4f;
  --bg: #eef6f1;
  --bg-card: #ffffff;
  --bg-header: #0f3d1a;
  --bg-input: #f0faf3;
  --text: #111714;
  --text-muted: #4a5c51;
  --text-light: #8fa898;
  --text-inverse: #ffffff;
  --border: #d6e8dc;
  --border-medium: #aee8c0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --sidebar-width: 230px;
  --header-height: 60px;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; border: none;
  cursor: pointer; transition: all 0.18s; white-space: nowrap; text-decoration: none;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: white; color: var(--primary); border: 1.5px solid var(--border-medium); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: #f0faf3; }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--radius-lg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── CARDS ──────────────────────────────────────────────── */
.card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge-blue { background: #d4f5de; color: #1a6b2e; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

/* ── SECTION SKILL ICONS ───────────────────────────────── */
.skill-icon {
  width: 34px; height: 34px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.skill-reading { background: #dbeafe; }
.skill-listening { background: #d1fae5; }
.skill-writing { background: #fef3c7; }
.skill-speaking { background: #fce7f3; }

/* ── BAND DISPLAY ───────────────────────────────────────── */
.band-display {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 15px; font-weight: 900; color: white; flex-shrink: 0;
}
.band-display.low  { background: var(--band-low); }
.band-display.mid  { background: var(--band-mid); }
.band-display.high { background: var(--band-high); }
.band-display.none { background: #cbd5e1; font-size: 12px; color: #64748b; }

/* ── ALERTS ─────────────────────────────────────────────── */
.alert {
  padding: 11px 15px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px;
}
.alert-error   { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.alert-info    { background: #d4f5de; color: #1a6b2e; border: 1px solid #8dd9a0; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-input {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border-medium);
  border-radius: var(--radius); font-size: 14px;
  background: var(--bg-input); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,107,46,0.15); }
.form-input::placeholder { color: var(--text-light); }

/* ── SPINNER / LOADING ──────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block; flex-shrink: 0;
}
.spinner-dark { border-color: rgba(0,0,0,0.12); border-top-color: var(--accent); }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PLATFORM HEADER ────────────────────────────────────── */
.platform-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-height); background: var(--bg-header);
  z-index: 200; display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.header-logo {
  flex: 1; display: flex; align-items: center; gap: 9px;
  color: white; font-size: 17px; font-weight: 800;
  letter-spacing: -0.3px; text-decoration: none; white-space: nowrap;
}
.header-logo-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-actions { flex: 1; display: flex; align-items: center; justify-content: flex-end; }
.header-nav-link {
  color: rgba(255,255,255,0.75); font-size: 13px; font-weight: 500;
  padding: 5px 12px; border-radius: var(--radius); transition: all 0.2s;
}
.header-nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.header-nav-link.active { background: rgba(255,255,255,0.15); color: white; }
.header-user { display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,0.9); font-size: 13px; font-weight: 500; }
.header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}

/* ── USER MENU DROPDOWN ─────────────────────────────────── */
.user-menu { position: relative; }
.user-menu-trigger {
  background: none; border: none; cursor: pointer; padding: 0;
  display: flex; align-items: center; border-radius: 50%;
  transition: opacity 0.15s;
}
.user-menu-trigger:hover { opacity: 0.85; }
.user-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 12px);
  background: white; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  min-width: 230px; z-index: 2000; overflow: hidden;
  animation: dropdownIn 0.15s ease;
}
.user-dropdown.open { display: block; }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.user-dropdown-info { display: flex; align-items: center; gap: 12px; padding: 16px; }
.user-dropdown-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-dropdown-name { font-size: 14px; font-weight: 600; color: #0f172a; }
.user-dropdown-email { font-size: 12px; color: #64748b; margin-top: 2px; word-break: break-all; }
.user-dropdown-divider { height: 1px; background: #e2e8f0; margin: 0; }
.user-dropdown-signout {
  width: 100%; text-align: left; padding: 12px 16px; border: none; background: none;
  font-size: 13px; color: #ef4444; font-weight: 500; cursor: pointer;
  font-family: var(--font); display: flex; align-items: center; gap: 8px;
}
.user-dropdown-signout:hover { background: #fef2f2; }

/* ── DASHBOARD LAYOUT ───────────────────────────────────── */
.dashboard-layout { display: flex; min-height: 100vh; padding-top: var(--header-height); }

.sidebar {
  width: var(--sidebar-width); background: var(--bg-header);
  position: fixed; top: var(--header-height); left: 0; bottom: 0;
  overflow-y: auto; z-index: 100; padding: 14px 10px;
}
.sidebar-section { margin-bottom: 22px; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: rgba(255,255,255,0.35);
  padding: 0 8px; margin-bottom: 6px; display: block;
}
.sidebar-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--radius);
  color: rgba(255,255,255,0.7); font-size: 13px; font-weight: 500;
  transition: all 0.18s; margin-bottom: 2px; text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar-link.active { background: rgba(255,255,255,0.15); color: white; }
.sidebar-link .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 26px; min-width: 0; }

/* ── PAGE HEADER ────────────────────────────────────────── */
.page-header { margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 900; color: var(--text); letter-spacing: -0.5px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── STATS GRID ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: white; border-radius: var(--radius-lg); padding: 18px 20px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 7px; }
.stat-value { font-size: 30px; font-weight: 900; color: var(--text); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.stat-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 32px; opacity: 0.1; }

/* ── SECTION TITLE ──────────────────────────────────────── */
.section-title {
  font-size: 15px; font-weight: 800; color: var(--text);
  margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between;
}

/* ── TEST CARDS ─────────────────────────────────────────── */
.tests-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.test-card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; display: flex; flex-direction: column;
}
.test-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.test-card-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.test-card-title { font-size: 14px; font-weight: 800; color: var(--text); }
.test-card-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.test-card-sections { padding: 14px 18px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.test-section-row { display: flex; align-items: center; gap: 10px; }
.test-section-info { flex: 1; min-width: 0; }
.test-section-name { font-size: 13px; font-weight: 600; color: var(--text); }
.test-section-meta { font-size: 11px; color: var(--text-muted); }
.test-card-footer {
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--bg); display: flex; align-items: center; justify-content: space-between;
}

/* ── RESULTS TABLE ──────────────────────────────────────── */
.results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.results-table th {
  text-align: left; padding: 9px 14px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); border-bottom: 1px solid var(--border); background: #f0faf3;
}
.results-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.results-table tr:last-child td { border-bottom: none; }
.results-table tbody tr:hover td { background: #f0faf3; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-icon { font-size: 44px; margin-bottom: 10px; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.empty-state p { font-size: 13px; }

/* ── LANDING PAGE ────────────────────────────────────────── */
.landing-body { background: white; }
.landing-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  padding: 110px 24px 80px; text-align: center; position: relative; overflow: hidden;
}
.landing-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 65% 35%, rgba(45,158,79,0.25) 0%, transparent 55%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.95); padding: 5px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600; margin-bottom: 22px;
}
.hero-title {
  font-size: clamp(30px, 5vw, 54px); font-weight: 900;
  color: white; line-height: 1.1; margin-bottom: 16px; letter-spacing: -1.5px;
}
.hero-title span { color: #4cbb70; }
.hero-subtitle { font-size: 17px; color: rgba(255,255,255,0.78); max-width: 480px; margin: 0 auto 32px; line-height: 1.7; }
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

.features-section { padding: 68px 24px; background: var(--bg); }
.features-container { max-width: 1100px; margin: 0 auto; }
.section-heading { text-align: center; margin-bottom: 44px; }
.section-heading h2 { font-size: 30px; font-weight: 900; color: var(--text); letter-spacing: -0.5px; margin-bottom: 7px; }
.section-heading p { font-size: 15px; color: var(--text-muted); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.feature-card { background: white; border-radius: var(--radius-lg); padding: 22px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.feature-icon { width: 46px; height: 46px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.feature-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.feature-desc { font-size: 12px; color: var(--text-muted); line-height: 1.65; }

/* ── AUTH PAGE ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
}
.auth-card { background: white; border-radius: var(--radius-xl); padding: 36px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 10px;
}
.auth-logo h1 { font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.auth-logo p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: var(--radius); padding: 3px; margin-bottom: 22px; }
.auth-tab {
  flex: 1; padding: 7px; border: none; background: transparent;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all 0.18s;
}
.auth-tab.active { background: white; color: var(--text); box-shadow: var(--shadow-sm); }
.auth-form { display: none; }
.auth-form.active { display: block; }

/* ── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: white; border-radius: var(--radius-xl);
  padding: 28px; max-width: 460px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 5px; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.modal-info-row { background: var(--bg); border-radius: var(--radius); padding: 14px; margin-bottom: 20px; display: flex; gap: 20px; font-size: 13px; color: var(--text); }
.modal-info-row strong { font-weight: 700; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tests-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  .platform-header { padding: 0 14px; }
}
@media (max-width: 480px) {
  .auth-card { padding: 24px 18px; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 28px; }
}
