/* ============================================================
   PROCOTE EXAMINATION SYSTEM - Main Stylesheet
   Aesthetic: Refined elegance — warm ivory, deep slate, gold
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Jost:wght@300;400;500;600&display=swap');

:root {
  --bg-primary: #f9f7f4;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f4f2ee;
  --accent: #b8860b;
  --accent-dim: #9a6e08;
  --accent-glow: rgba(184,134,11,0.12);
  --accent-light: #fef9ec;
  --blue: #2a6fb5;
  --blue-dim: #1e5a96;
  --green: #2d7a4f;
  --red: #c0392b;
  --text-primary: #1a1714;
  --text-secondary: #5a5248;
  --text-muted: #a09890;
  --border: rgba(90,82,72,0.12);
  --border-hover: rgba(184,134,11,0.4);
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 16px rgba(26,23,20,0.08), 0 1px 3px rgba(26,23,20,0.06);
  --shadow-hover: 0 8px 32px rgba(26,23,20,0.12), 0 2px 6px rgba(26,23,20,0.06);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Jost', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #c8bfb0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a09890; }

/* ---- Typography ---- */
h1,h2,h3,h4 { font-family: var(--font-display); letter-spacing: -0.01em; color: var(--text-primary); }
h1 { font-size: 2.2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p { color: var(--text-secondary); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-wrap { padding: 32px 0; }

/* ---- Top Nav ---- */
.topnav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(26,23,20,0.05);
}
.topnav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  color: var(--text-primary);
}
.logo-icon {
  width: 36px; height: 36px; background: var(--accent);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
  box-shadow: 0 2px 8px rgba(184,134,11,0.3);
}
.logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 6px 14px; border-radius: 6px; font-size: 0.875rem;
  color: var(--text-secondary); font-weight: 500; transition: all 0.18s;
  letter-spacing: 0.01em;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary); background: var(--bg-primary);
}
.nav-links a.active { color: var(--accent); }
.nav-user {
  display: flex; align-items: center; gap: 10px; font-size: 0.875rem;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-light); border: 2px solid rgba(184,134,11,0.3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 700; color: var(--accent);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-sm { padding: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; color: var(--text-primary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 0.875rem; font-weight: 500;
  font-family: var(--font-body); cursor: pointer; border: none; transition: all 0.18s;
  text-decoration: none; white-space: nowrap; letter-spacing: 0.01em;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(184,134,11,0.25); }
.btn-primary:hover { background: var(--accent-dim); color: #fff; box-shadow: 0 4px 14px rgba(184,134,11,0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-primary); }
.btn-danger { background: rgba(192,57,43,0.08); color: var(--red); border: 1px solid rgba(192,57,43,0.2); }
.btn-danger:hover { background: rgba(192,57,43,0.14); }
.btn-success { background: rgba(45,122,79,0.08); color: var(--green); border: 1px solid rgba(45,122,79,0.2); }
.btn-success:hover { background: rgba(45,122,79,0.14); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--font-body); }
.form-control, .form-select {
  width: 100%; padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-primary); font-family: var(--font-body); font-size: 0.9rem;
  transition: border-color 0.18s, box-shadow 0.18s; outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-select { appearance: none; cursor: pointer; }
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  text-align: left; padding: 10px 14px; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted);
  border-bottom: 2px solid var(--border); font-family: var(--font-body);
  background: var(--bg-primary);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fbf9f6; }
td strong { color: var(--text-primary); font-weight: 500; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
}
.badge-success { background: rgba(45,122,79,0.1); color: #236040; border: 1px solid rgba(45,122,79,0.2); }
.badge-danger { background: rgba(192,57,43,0.1); color: #a0291d; border: 1px solid rgba(192,57,43,0.2); }
.badge-warning { background: rgba(184,134,11,0.1); color: var(--accent); border: 1px solid rgba(184,134,11,0.25); }
.badge-info { background: rgba(42,111,181,0.1); color: #1e5a96; border: 1px solid rgba(42,111,181,0.2); }
.badge-neutral { background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border); }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow); transition: all 0.2s;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.stat-card:hover::after { opacity: 1; }
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; font-weight: 600; }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--text-primary); }
.stat-value.accent { color: var(--accent); }
.stat-change { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 16px; border-left: 3px solid; }
.alert-danger { background: rgba(192,57,43,0.06); border-color: var(--red); color: #a0291d; }
.alert-success { background: rgba(45,122,79,0.06); border-color: var(--green); color: #1d6040; }
.alert-warning { background: rgba(184,134,11,0.08); border-color: var(--accent); color: var(--accent-dim); }
.alert-info { background: rgba(42,111,181,0.06); border-color: var(--blue); color: var(--blue-dim); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,23,20,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(26,23,20,0.2);
  transform: translateY(16px); transition: transform 0.25s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 4px; transition: color 0.15s; }
.modal-close:hover { color: var(--text-primary); }

/* ---- Page Header ---- */
.page-header { margin-bottom: 28px; }
.page-header h2 { color: var(--text-primary); }
.page-header p { font-size: 0.875rem; margin-top: 4px; color: var(--text-muted); }
.page-header-row { display: flex; align-items: center; justify-content: space-between; }

/* ---- Question builder ---- */
.q-type-select { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.q-type-btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-secondary); font-size: 0.8rem;
  cursor: pointer; transition: all 0.18s; font-family: var(--font-body);
}
.q-type-btn:hover, .q-type-btn.active {
  border-color: var(--accent); color: var(--accent); background: var(--accent-light);
}
.option-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.option-row input[type=text] { flex: 1; }
.correct-checkbox { accent-color: var(--green); width: 16px; height: 16px; cursor: pointer; }
.add-option-btn {
  background: none; border: 1px dashed rgba(184,134,11,0.3);
  color: var(--text-muted); padding: 8px 14px; border-radius: 8px;
  font-size: 0.8rem; cursor: pointer; font-family: var(--font-body); transition: all 0.18s;
}
.add-option-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ---- Exam Viewer ---- */
.exam-header-bar {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  z-index: 200; height: 58px; display: flex; align-items: center;
  box-shadow: 0 2px 12px rgba(26,23,20,0.08);
}
.exam-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0 24px;
}
.timer-box {
  display: flex; align-items: center; gap: 8px; background: var(--accent-light);
  border: 1px solid rgba(184,134,11,0.25); border-radius: 8px; padding: 6px 14px;
}
.timer-digits {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--accent);
  letter-spacing: 0.05em;
}
.timer-digits.danger { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.exam-body { padding-top: 80px; padding-bottom: 100px; }
.question-nav {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px;
}
.q-nav-btn {
  width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-muted); font-size: 0.8rem;
  cursor: pointer; transition: all 0.18s; font-family: var(--font-display); font-weight: 600;
}
.q-nav-btn.answered { background: rgba(45,122,79,0.1); border-color: rgba(45,122,79,0.4); color: var(--green); }
.q-nav-btn.current { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(184,134,11,0.3); }
.q-nav-btn.skipped { background: var(--accent-light); border-color: rgba(184,134,11,0.35); color: var(--accent); }

.question-block { animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.question-number {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent); margin-bottom: 6px;
}
.question-text {
  font-size: 1.05rem; color: var(--text-primary); margin-bottom: 18px; line-height: 1.75;
  font-family: var(--font-display); font-weight: 400;
}
.question-marks {
  font-size: 0.75rem; color: var(--text-muted); margin-bottom: 14px;
}
.mcq-options { display: flex; flex-direction: column; gap: 10px; }
.mcq-option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all 0.18s;
  background: var(--bg-card);
}
.mcq-option:hover { border-color: var(--border-hover); background: var(--accent-light); box-shadow: 0 2px 8px rgba(184,134,11,0.08); }
.mcq-option.selected { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-glow); }
.mcq-option input[type=radio], .mcq-option input[type=checkbox] { accent-color: var(--accent); margin-top: 2px; }
.mcq-option-label { color: var(--text-primary); font-size: 0.9rem; cursor: pointer; }

.exam-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; z-index: 200;
  box-shadow: 0 -2px 12px rgba(26,23,20,0.06);
}
.progress-bar {
  height: 4px; background: var(--bg-input); border-radius: 2px; margin-top: 6px;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #d4a017); border-radius: 2px; transition: width 0.4s;
}

/* ---- Security Overlay ---- */
.security-overlay {
  position: fixed; inset: 0; background: rgba(249,247,244,0.96);
  z-index: 9999; display: none; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  backdrop-filter: blur(8px);
}
.security-overlay.show { display: flex; }
.security-icon { font-size: 3rem; margin-bottom: 16px; }
.security-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--red); margin-bottom: 8px; }
.security-msg { color: var(--text-secondary); margin-bottom: 24px; max-width: 360px; }
.security-count { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }

/* ---- Fullscreen warning ---- */
.fullscreen-badge {
  position: fixed; top: 8px; right: 8px; z-index: 9998;
  background: rgba(192,57,43,0.9); color: #fff;
  padding: 6px 12px; border-radius: 6px; font-size: 0.78rem; font-weight: 600;
  display: none;
}

/* ---- Tabs ---- */
.tabs { display: flex; gap: 2px; background: var(--bg-input); border-radius: 10px; padding: 3px; margin-bottom: 24px; }
.tab-btn {
  flex: 1; padding: 8px 16px; border: none; background: none;
  border-radius: 8px; color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.18s; font-family: var(--font-body);
}
.tab-btn.active { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 1px 4px rgba(26,23,20,0.08); }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 60% 40% at 70% 10%, rgba(184,134,11,0.08), transparent),
    radial-gradient(ellipse 50% 60% at 20% 80%, rgba(42,111,181,0.05), transparent);
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 44px; width: 100%; max-width: 420px;
  box-shadow: 0 8px 40px rgba(26,23,20,0.12), 0 2px 8px rgba(26,23,20,0.06);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
  width: 54px; height: 54px; background: var(--accent); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 14px; font-weight: 800; color: #fff;
  font-family: var(--font-display);
  box-shadow: 0 4px 16px rgba(184,134,11,0.3);
}

/* ---- Evaluation ---- */
.response-block {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.score-input { width: 80px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topnav-inner { padding: 0 12px; }
  h1 { font-size: 1.5rem; }
}

/* ---- Utilities ---- */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }
.font-display { font-family: var(--font-display); }
.font-bold { font-weight: 700; }
.d-none { display: none !important; }
.separator { height: 1px; background: var(--border); margin: 20px 0; }
