/* ============================================================
   TopperTest.com — Main Stylesheet
   Government Exam Typing Practice Platform
   ============================================================ */

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

:root {
  --primary:      #1c1f26;
  --primary-dark: #101317;
  --accent:       #c9a227;
  --accent-dark:  #a8861d;
  --success:      #10b981;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #3b82f6;
  --bg:           #faf9f6;
  --card:         #ffffff;
  --text:         #23262b;
  --muted:        #6e6a63;
  --border:       #e8e5de;
  --sidebar-w:    260px;
  --radius:       12px;
  --shadow:       0 4px 20px rgba(0,0,0,.08);
  --font-head:    'Poppins', sans-serif;
  --font-body:    'Hind', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Typography ──────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-family: var(--font-head); font-weight: 700; line-height: 1.3; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; border-radius: 8px; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  transition: all .2s; text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,19,23,.35); }
.btn-accent    { background: var(--accent); color: #16181d; }
.btn-accent:hover { background: var(--accent-dark); color: #16181d; transform: translateY(-1px); }
.btn-outline   { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-sm        { padding: 6px 14px; font-size: 13px; }
.btn-lg        { padding: 14px 32px; font-size: 16px; }
.btn-block     { width: 100%; justify-content: center; }
.btn:disabled  { opacity: .6; cursor: not-allowed; transform: none !important; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-body { padding: 24px; }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-family: var(--font-body); font-size: 14px;
  transition: border-color .2s, box-shadow .2s; background: #fff;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,162,39,.22); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  background: var(--primary); color: #fff; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.navbar-brand { display: flex; align-items: center; gap: 10px; }
.navbar-brand img { height: 36px; }
.navbar-brand .brand-text { font-family: var(--font-head); font-size: 20px; font-weight: 800; color: #fff; }
.navbar-brand .brand-sub { font-size: 11px; color: rgba(255,255,255,.7); }
.nav-links { display: flex; align-items: center; gap: 8px; list-style: none; }
.nav-links a { color: rgba(255,255,255,.85); padding: 8px 14px; border-radius: 6px; font-weight: 500; font-size: 14px; transition: all .2s; }
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-links .btn { padding: 8px 18px; }

/* ── Sidebar Layout ──────────────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: var(--sidebar-w); background: var(--primary-dark); color: #fff;
  padding: 24px 0; position: fixed; top: 64px; left: 0;
  height: calc(100vh - 64px); overflow-y: auto; z-index: 100;
}
.sidebar-menu { list-style: none; padding: 0; }
.sidebar-menu li a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; color: rgba(255,255,255,.75); font-weight: 500;
  transition: all .2s; font-size: 14px;
}
.sidebar-menu li a:hover, .sidebar-menu li a.active {
  background: rgba(255,255,255,.1); color: #fff;
  border-right: 3px solid var(--accent);
}
.sidebar-menu li a .icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-section { padding: 8px 24px 4px; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: rgba(255,255,255,.4); text-transform: uppercase; margin-top: 8px; }
.main-content { margin-left: var(--sidebar-w); padding: 32px; flex: 1; }

/* ── Stats Cards ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); border-left: 4px solid var(--primary);
  position: relative; overflow: hidden;
}
.stat-card.accent { border-color: var(--accent); }
.stat-card.success { border-color: var(--success); }
.stat-card.info    { border-color: var(--info); }
.stat-card .stat-value { font-size: 32px; font-weight: 800; font-family: var(--font-head); color: var(--primary); }
.stat-card.accent .stat-value { color: var(--accent-dark); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.info .stat-value { color: var(--info); }
.stat-card .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.stat-card .stat-icon { position: absolute; right: 20px; top: 20px; font-size: 36px; opacity: .12; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-E { background: #d1fae5; color: #065f46; }
.badge-M { background: #fef3c7; color: #92400e; }
.badge-H { background: #fee2e2; color: #991b1b; }
.badge-hindi   { background: #f5edcf; color: #8a6d14; }
.badge-english { background: #eceef2; color: #3b4252; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:hover td { background: #f8fafc; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Loader ──────────────────────────────────────────────── */
.spinner { width: 36px; height: 36px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; z-index: 9999; }

/* ── Hero (home) ─────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #33333a 100%);
  color: #fff; padding: 80px 32px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero h1 { font-size: clamp(28px, 5vw, 52px); font-weight: 800; margin-bottom: 16px; position: relative; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 17px; opacity: .9; max-width: 640px; margin: 0 auto 32px; position: relative; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; }
.hero-btns .btn { font-size: 16px; padding: 12px 28px; }

/* ── Typing Test Window ──────────────────────────────────── */
.test-topbar {
  background: var(--primary); color: #fff; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius) var(--radius) 0 0;
}
.test-timer { font-size: 28px; font-weight: 800; font-family: var(--font-head); color: var(--accent); }
.test-timer.urgent { color: #ff4444; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

.test-stats-bar {
  display: flex; gap: 24px; background: #f8fafc;
  padding: 12px 24px; border: 1px solid var(--border); border-top: none;
}
.test-stat-item .value { font-size: 22px; font-weight: 700; font-family: var(--font-head); color: var(--primary); }
.test-stat-item .label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }

.passage-box {
  background: #fffbf0; border: 1px solid var(--border); border-top: none;
  padding: 24px; font-size: 16px; line-height: 2; min-height: 160px;
  font-family: 'Hind', sans-serif; user-select: none;
}
.passage-box .word-correct  { background: #bbf7d0; border-radius: 3px; }
.passage-box .word-wrong    { background: #fecaca; border-radius: 3px; text-decoration: underline; }
.passage-box .word-current  { background: #f2e6bd; border-radius: 3px; }

.typing-input-wrap {
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.typing-textarea {
  width: 100%; min-height: 140px; padding: 20px; border: none;
  font-size: 15px; font-family: 'Hind', sans-serif; line-height: 1.8;
  resize: none; outline: none; border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Progress Bar ────────────────────────────────────────── */
.progress { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--info)); border-radius: 99px; transition: width .3s; }

/* ── Steps ───────────────────────────────────────────────── */
.steps { display: flex; gap: 0; margin-bottom: 32px; }
.step { flex: 1; text-align: center; position: relative; }
.step::after { content: ''; position: absolute; top: 18px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.step:last-child::after { display: none; }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--border); color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; margin: 0 auto 8px; position: relative; z-index: 1; }
.step.active .step-num  { background: var(--primary); color: #fff; }
.step.done .step-num    { background: var(--success); color: #fff; }
.step-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.step.active .step-label { color: var(--primary); }

/* ── Utilities ───────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent-dark); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.p-4 { padding: 32px; } .p-3 { padding: 24px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.section-title { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 20px; }
.section-title span { color: var(--accent-dark); }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Icons ───────────────────────────────────────────────── */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.brand-icon { width: 26px; height: 26px; color: var(--accent); }
.exam-icon svg, .fi-icon svg { width: 32px; height: 32px; color: var(--primary); }
.yt-icon { width: 22px; height: 22px; }

/* ── Micro-animations ────────────────────────────────────── */
@keyframes anim-pop    { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes anim-float  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes anim-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }

/* button icons nudge on hover */
.btn .icon { transition: transform .25s ease; }
.btn:hover .icon { transform: scale(1.2) rotate(-8deg); }

/* navbar keyboard logo wiggles on hover */
.navbar-brand a:hover .brand-icon { animation: anim-wiggle .5s ease; }

/* card icons lift toward gold when their card is hovered */
.fi-icon svg, .tc-icon svg, .exam-card-top .icon svg, .eo-icon svg { transition: transform .25s ease, color .25s ease; }
.feature-item:hover .fi-icon svg { transform: translateY(-3px) scale(1.12); color: var(--accent-dark); }
.track-card:hover .tc-icon svg   { transform: translateY(-3px) scale(1.12); color: var(--accent-dark); }
.exam-card:hover .exam-card-top .icon svg { transform: translateY(-3px) scale(1.1) rotate(-5deg); }

/* scroll-reveal: app.js adds .anim-ready on load, .anim-in when visible */
.anim-ready { opacity: 0; }
.anim-in    { animation: anim-pop .55s cubic-bezier(.34,1.56,.64,1) both; }

@media (prefers-reduced-motion: reduce) {
  .anim-ready, .anim-in { opacity: 1 !important; animation: none !important; }
  .btn:hover .icon, .feature-item:hover .fi-icon svg, .track-card:hover .tc-icon svg,
  .exam-card:hover .exam-card-top .icon svg { transform: none !important; }
  .navbar-brand a:hover .brand-icon { animation: none !important; }
}

/* ── Footer ──────────────────────────────────────────────── */
footer { background: var(--primary-dark); color: rgba(255,255,255,.7); font-size: 13px; }
footer a { color: rgba(255,255,255,.75); transition: color .2s; }
footer a:hover { color: var(--accent); }
.footer-main {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px;
  max-width: 1100px; margin: 0 auto; padding: 48px 32px 32px;
}
.footer-brand .brand-text { color: #fff; font-size: 18px; }
.footer-brand p { margin-top: 10px; line-height: 1.7; max-width: 320px; }
.footer-col h4 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 14px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1); padding: 20px 32px; text-align: center;
  max-width: 1100px; margin: 0 auto;
}
@media (max-width: 768px) {
  .footer-main { grid-template-columns: 1fr; padding: 40px 24px 24px; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .navbar { padding: 0 16px; }
  .hero { padding: 48px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .test-stats-bar { flex-wrap: wrap; gap: 12px; }
}
