/* Rojgar Sathee - Premium responsive theme
   Mobile-first, dark-mode aware, glassmorphism, soft shadows. */

/* ========== Tokens ========== */
:root {
  --bg:        #f6f7fb;
  --bg-2:      #ffffff;
  --surface:   #ffffff;
  --surface-2: #f1f3f9;
  --text:      #0f172a;
  --text-2:    #475569;
  --muted:     #6b7280;
  --border:    #e6e8ef;
  --primary:   #4f46e5;
  --primary-2: #7c3aed;
  --primary-50:#eef2ff;
  --success:   #16a34a;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #0ea5e9;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 6px 20px rgba(15,23,42,.07);
  --shadow-lg: 0 24px 60px rgba(15,23,42,.14);
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --grad: linear-gradient(135deg,#4f46e5 0%,#7c3aed 50%,#ec4899 100%);
  --grad-soft: linear-gradient(135deg,#eef2ff 0%,#fce7f3 100%);
}

html[data-theme="dark"] {
  --bg:        #0b1020;
  --bg-2:      #0f1530;
  --surface:   #131a35;
  --surface-2: #0f1530;
  --text:      #e6e9f5;
  --text-2:    #c1c7e0;
  --muted:     #8a92b2;
  --border:    #1f2748;
  --primary:   #818cf8;
  --primary-2: #c084fc;
  --primary-50:#1b2247;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --shadow-lg: 0 30px 80px rgba(0,0,0,.55);
  --grad-soft: linear-gradient(135deg,#1b2247 0%,#2a1740 100%);
}

* { box-sizing: border-box; }
html, body { padding:0; margin:0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
h1,h2,h3,h4 { font-family: 'Sora','Inter', sans-serif; letter-spacing:-0.01em; line-height:1.2; margin:0 0 .5em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--muted); }
.skip-link { position:absolute; left:-9999px; top:auto; }
.skip-link:focus { left:8px; top:8px; background:#fff; padding:8px 12px; border-radius:8px; z-index:9999; }

/* ========== Topbar ========== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .topbar { background: rgba(11,16,32,.72); }
.topbar-row { display:flex; align-items:center; gap:14px; min-height:64px; }
.brand { display:flex; align-items:center; gap:10px; font-weight:700; color: var(--text); }
.brand:hover { text-decoration:none; }
.brand-logo {
  width:36px; height:36px; border-radius:10px; display:grid; place-items:center;
  color:#fff; font-weight:800; background: var(--grad); box-shadow: var(--shadow-sm);
}
.brand-name { font-family:'Sora',sans-serif; font-size:18px; }

.nav-main { display:none; gap:6px; margin-left: 18px; }
.nav-main a { color: var(--text-2); padding:8px 12px; border-radius: 10px; font-weight:500; }
.nav-main a:hover { background: var(--surface-2); text-decoration:none; color: var(--text); }

.nav-actions { margin-left:auto; display:flex; align-items:center; gap:8px; }
.icon-btn {
  width:40px; height:40px; border-radius:10px; border:1px solid var(--border);
  background: var(--surface); color: var(--text); cursor:pointer; display:grid; place-items:center;
}
.icon-btn:hover { background: var(--surface-2); }
.nav-toggle { display: inline-grid; }

.nav-drawer {
  display:none; flex-direction:column; gap:4px; padding: 10px 14px 16px;
  border-top:1px solid var(--border); background: var(--surface);
}
.nav-drawer.open { display:flex; }
.nav-drawer a { padding:10px 12px; border-radius:10px; color: var(--text-2); }
.nav-drawer a:hover { background: var(--surface-2); }

@media (min-width: 880px) {
  .nav-main { display:flex; }
  .nav-toggle { display:none; }
  .nav-drawer { display:none !important; }
}

/* ========== Buttons ========== */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  height:40px; padding: 0 16px; border-radius: 10px; font-weight:600;
  border:1px solid transparent; cursor:pointer; transition:all .18s ease;
  font-size: 14.5px;
}
.btn:hover { text-decoration:none; transform: translateY(-1px); }
.btn-primary  { background: var(--grad); color:#fff; box-shadow: 0 8px 18px rgba(79,70,229,.28); }
.btn-primary:hover { box-shadow: 0 12px 22px rgba(79,70,229,.36); }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost    { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--primary-50); color: var(--primary); }
.btn-danger   { background: var(--danger); color:#fff; }
.btn-success  { background: var(--success); color:#fff; }
.btn-block    { width:100%; }
.btn-lg       { height:48px; font-size:16px; padding: 0 22px; border-radius:12px; }
.btn-sm       { height:32px; font-size:13px; padding:0 12px; border-radius:8px; }

/* ========== Cards & utilities ========== */
.card {
  background: var(--surface); border:1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.grid { display:grid; gap:14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: 1fr; }
.grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) {
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.badge {
  display:inline-flex; align-items:center; gap:6px;
  background: var(--primary-50); color: var(--primary);
  border-radius: 999px; padding: 4px 10px; font-size:12px; font-weight:600;
}
.badge.green { background: #dcfce7; color: #166534; }
.badge.red   { background: #fee2e2; color: #991b1b; }
.badge.amber { background: #fef3c7; color: #92400e; }
html[data-theme="dark"] .badge.green { background:#062e1c; color:#86efac; }
html[data-theme="dark"] .badge.red   { background:#3f0f0f; color:#fecaca; }
html[data-theme="dark"] .badge.amber { background:#3a2607; color:#fde68a; }

/* ========== Forms ========== */
.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.input, .select, .textarea {
  background: var(--surface); border:1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: 10px; font: inherit; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 18%, transparent);
}
.textarea { min-height: 110px; resize: vertical; }

.alert {
  border-radius: 12px; padding: 12px 14px; margin: 12px 0;
  border: 1px solid var(--border); font-size: 14px;
}
.alert-success { background:#dcfce7; color:#166534; border-color:#bbf7d0; }
.alert-error   { background:#fee2e2; color:#991b1b; border-color:#fecaca; }
.alert-info    { background:#e0f2fe; color:#075985; border-color:#bae6fd; }
.alert-warning { background:#fef3c7; color:#92400e; border-color:#fde68a; }
html[data-theme="dark"] .alert-success { background:#062e1c; color:#86efac; border-color:#0d4f30; }
html[data-theme="dark"] .alert-error   { background:#3f0f0f; color:#fecaca; border-color:#5b1717; }
html[data-theme="dark"] .alert-info    { background:#0c2540; color:#bae6fd; border-color:#143759; }
html[data-theme="dark"] .alert-warning { background:#3a2607; color:#fde68a; border-color:#5a3a0b; }

/* ========== Layout pieces ========== */
.main-wrap { flex: 1 0 auto; padding: 24px 0 60px; }
.section-title { display:flex; justify-content:space-between; align-items:baseline; margin: 28px 0 14px; }
.section-title h2 { font-size: 24px; }
.section-title a { font-size: 14px; }

/* ========== Hero ========== */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 56px 24px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
}
.hero h1 { font-size: clamp(28px, 5vw, 46px); margin-bottom: 14px; }
.hero p { color: var(--text-2); font-size: clamp(15px, 2vw, 18px); max-width: 720px; }
.hero .cta { margin-top: 22px; display:flex; flex-wrap:wrap; gap: 10px; }
.hero .stats {
  margin-top: 28px; display:grid; gap:12px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 720px) { .hero .stats { grid-template-columns: repeat(4, 1fr); } }
.hero .stat {
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.hero .stat b { font-family:'Sora'; font-size: 22px; display:block; }
.hero::before {
  content:""; position:absolute; right:-80px; top:-80px; width:280px; height:280px;
  border-radius:50%; background: var(--grad); opacity:.20; filter: blur(30px);
}

/* ========== Category cards ========== */
.cat-card { display:flex; gap:12px; align-items:flex-start; }
.cat-card .ico {
  width:46px; height:46px; border-radius:12px; display:grid; place-items:center;
  background: var(--primary-50); color: var(--primary);
}
.cat-card h3 { font-size: 17px; margin-bottom: 4px; }
.cat-card p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ========== Test cards ========== */
.test-card { display:flex; flex-direction:column; gap:10px; }
.test-card .meta { display:flex; flex-wrap:wrap; gap:8px; color: var(--muted); font-size: 12.5px; }
.test-card h3 { font-size: 17px; }
.test-card .actions { margin-top:auto; display:flex; gap:8px; }

/* ========== Tables ========== */
.table-wrap { overflow:auto; border-radius: var(--radius); border:1px solid var(--border); background: var(--surface); }
table.table { width:100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td { padding: 12px 14px; text-align:left; border-bottom: 1px solid var(--border); }
table.table th { background: var(--surface-2); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); }
table.table tr:last-child td { border-bottom: 0; }

/* ========== Footer ========== */
.site-footer {
  background: var(--surface); border-top:1px solid var(--border);
  padding: 36px 0 18px; margin-top: 40px; color: var(--text-2);
}
.footer-grid { display:grid; gap: 22px; grid-template-columns: 1fr; }
.footer-grid h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.footer-grid a { display:block; padding: 4px 0; color: var(--text-2); font-size: 14px; }
.footer-grid a:hover { color: var(--primary); }
.copy { padding-top: 18px; border-top: 1px solid var(--border); margin-top: 22px; font-size: 13px; color: var(--muted); }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }

/* ========== Auth pages ========== */
.auth-wrap { max-width: 460px; margin: 30px auto; }
.auth-card { padding: 28px; border-radius: var(--radius-lg); }
.auth-card h1 { font-size: 26px; }
.auth-meta { font-size: 14px; color: var(--muted); margin-top: 14px; text-align:center; }

/* ========== Test engine ========== */
.test-shell { display:grid; gap: 16px; }
.test-header {
  position: sticky; top: 64px; z-index: 30;
  background: var(--surface); border:1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between;
  box-shadow: var(--shadow-sm);
}
.test-timer {
  font-family: 'Sora'; font-weight:700; font-size: 18px;
  background: var(--grad); color:#fff; padding: 8px 14px; border-radius: 10px; min-width: 110px; text-align:center;
}
.test-timer.warn { background: linear-gradient(135deg,#f59e0b,#ef4444); }

.test-body { display:grid; gap: 16px; }
@media (min-width: 980px) { .test-body { grid-template-columns: 1fr 320px; } }

.q-card { padding: 22px; border-radius: var(--radius); }
.q-text { font-size: 16.5px; line-height:1.7; margin-bottom: 16px; }
.options { display:grid; gap: 10px; }
.opt {
  display:flex; align-items:flex-start; gap:10px; padding: 12px 14px;
  border:1px solid var(--border); border-radius: 12px; cursor:pointer; background: var(--surface);
  transition: all .15s ease;
}
.opt:hover { border-color: var(--primary); background: var(--primary-50); }
.opt.selected { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent); }
.opt input { margin-top: 4px; accent-color: var(--primary); }
.opt .lbl { font-weight: 600; min-width: 22px; }

.q-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top: 18px; }

.palette { padding: 18px; }
.palette h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 10px; }
.palette-grid { display:grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pal-btn {
  height: 36px; border-radius: 10px; border:1px solid var(--border); background: var(--surface);
  font-weight: 700; cursor:pointer; color: var(--text); position: relative;
}
.pal-btn.answered     { background: #16a34a; color:#fff; border-color:#16a34a; }
.pal-btn.skipped      { background: #f1f3f9; color: var(--text-2); }
.pal-btn.review       { background: #f59e0b; color:#fff; border-color:#f59e0b; }
.pal-btn.review.answered { background: linear-gradient(135deg,#16a34a 50%, #f59e0b 50%); }
.pal-btn.current      { outline: 3px solid var(--primary); outline-offset: 2px; }
.pal-legend { display:flex; flex-wrap:wrap; gap: 8px; margin-top: 12px; font-size:12.5px; color: var(--muted); }
.pal-legend i { display:inline-block; width:12px; height:12px; border-radius:3px; margin-right:6px; vertical-align: middle; }

/* ========== Result page ========== */
.score-ring {
  --pct: 0;
  width: 160px; height: 160px; border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--pct)*1%), var(--surface-2) 0);
  display:grid; place-items:center; margin: 0 auto;
  box-shadow: var(--shadow);
}
.score-ring .inner {
  width: 130px; height:130px; border-radius:50%; background: var(--surface);
  display:grid; place-items:center; text-align:center; box-shadow: var(--shadow-sm);
}
.score-ring b { font-family:'Sora'; font-size: 28px; }

/* ========== Pagination ========== */
.pager { display:flex; gap:6px; justify-content:center; margin: 22px 0; flex-wrap:wrap; }
.pager a {
  min-width: 36px; height:36px; border-radius:10px; padding: 0 10px;
  display:inline-flex; align-items:center; justify-content:center;
  background: var(--surface); color: var(--text); border:1px solid var(--border);
}
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager a.active { background: var(--grad); color:#fff; border-color:transparent; }

/* ========== Ads ========== */
.ad-wrap { padding: 14px 0 0; }
.ad-slot {
  border:1px dashed var(--border); border-radius: 12px; padding: 6px;
  background: var(--surface); text-align:center; min-height: 40px;
}
.only-mobile  { display: block; }
.only-desktop { display: none; }
@media (min-width: 880px) {
  .only-mobile  { display: none; }
  .only-desktop { display: block; }
}
.footer-sticky-ad {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--surface); border-top:1px solid var(--border);
  padding: 6px 32px; box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.floating-corner-ad {
  position: fixed; right: 14px; bottom: 90px; z-index: 39;
  background: var(--surface); border:1px solid var(--border); border-radius: 12px;
  padding: 8px; box-shadow: var(--shadow);
}
.close-ad {
  position: absolute; top:-10px; right:-10px; width:24px; height:24px; border-radius:50%;
  background:#0f172a; color:#fff; border:0; cursor:pointer; line-height: 1;
}

/* ========== Animations ========== */
.fade-up { opacity: 0; transform: translateY(8px); animation: fadeUp .5s ease forwards; }
.fade-up.delay-1 { animation-delay: .08s; }
.fade-up.delay-2 { animation-delay: .16s; }
.fade-up.delay-3 { animation-delay: .24s; }
@keyframes fadeUp { to { opacity:1; transform:none; } }

/* ========== Anti-cheat overlay ========== */
.cheat-warning {
  position: fixed; inset: 0; background: rgba(11,16,32,.86); color:#fff;
  display: none; place-items:center; z-index: 9999; text-align:center; padding: 20px;
}
.cheat-warning.show { display: grid; }
.cheat-warning .box { max-width: 460px; padding: 28px; background: #131a35; border-radius: 18px; border:1px solid #1f2748; }

/* ========== Misc ========== */
.no-select { user-select: none; -webkit-user-select: none; }
.spinner {
  width: 22px; height: 22px; border:3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite; display:inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Admin layout ========== */
.admin-shell { display:grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .admin-shell { grid-template-columns: 240px 1fr; } }
.admin-side { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding: 12px; height: fit-content; }
.admin-side a { display:block; padding: 10px 12px; border-radius: 10px; color: var(--text-2); }
.admin-side a:hover, .admin-side a.active { background: var(--primary-50); color: var(--primary); text-decoration:none; }

/* Print friendly */
@media print {
  .topbar, .site-footer, .footer-sticky-ad, .floating-corner-ad, .ad-slot, .nav-actions { display:none !important; }
}


/* ========== Admin: duration input ========== */
.duration-input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.duration-fields {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.duration-fields > span { display: inline-flex; align-items: center; gap: 8px; }
.duration-fields .input { width: 90px; text-align: center; font-weight: 700; font-size: 18px; }
.duration-fields small { color: var(--muted); font-size: 13px; }
.duration-preview { margin-top: 10px; font-size: 13.5px; }
.duration-preview b { color: var(--primary); font-family: 'Sora', sans-serif; font-size: 18px; }
.duration-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.duration-presets .btn { background: var(--surface); border: 1px solid var(--border); }
.duration-presets .btn:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary); }

/* Test instructions: prominent duration card */
.duration-highlight {
  background: var(--grad-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; gap: 14px;
}
.duration-highlight .icon-circle {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--grad); color: #fff; display: grid; place-items: center; flex-shrink: 0;
}
.duration-highlight b { font-family: 'Sora', sans-serif; font-size: 20px; display: block; }



/* ========== Test engine: language switcher row ========== */
.q-top {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px; margin-bottom: 10px;
}
.q-lang-wrap { display: inline-flex; align-items: center; gap: 8px; }
.q-lang-sel {
  height: 36px; padding: 6px 32px 6px 12px; font-size: 14px;
  width: auto; min-width: 130px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); cursor: pointer;
}
.q-lang-sel:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent);
}
@media (max-width: 540px) {
  .q-lang-sel { min-width: 110px; }
}
