/* ═══════════════════════════════════════════════════════════════
   CHD CALABARZON ICT Applicant Examination Portal – Stylesheet
   Government Design System
   ═══════════════════════════════════════════════════════════════ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --gov-blue:    #003087;
  --gov-blue2:   #0050c8;
  --gov-gold:    #F9C900;
  --gov-light:   #e8f0fe;
  --bg:          #f0f4f8;
  --bg2:         #ffffff;
  --bg3:         #f5f8fc;
  --border:      #d0dbe8;
  --text:        #0a1628;
  --text2:       #4a5568;
  --text3:       #718096;
  --green:       #1a7a4a;
  --green-bg:    #e6f4ee;
  --red:         #c0392b;
  --red-bg:      #fce8e6;
  --yellow:      #b7791f;
  --yellow-bg:   #fef3cd;
  --blue:        #003087;
  --blue-bg:     #e8f0fe;
  --purple:      #5b21b6;
  --purple-bg:   #ede9fe;
  --radius:      8px;
  --shadow:      0 1px 4px rgba(0,48,135,0.10), 0 4px 16px rgba(0,48,135,0.06);
  --shadow-sm:   0 1px 3px rgba(0,48,135,0.08);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--gov-blue2); text-decoration: none; }
a:hover { text-decoration: underline; }
label { font-weight: 500; font-size: 13px; color: var(--text2); display: block; margin-bottom: 5px; }

/* ── Government Top Banner ─────────────────────────────────── */
.gov-banner {
  background: var(--gov-blue);
  color: #fff;
  padding: 0;
  position: relative;
  overflow: hidden;
}
.gov-banner-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  max-width: 1200px;
}
.gov-banner-logo {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  overflow: hidden;
}
.gov-banner-logo img { width: 90%; height: 90%; object-fit: contain; }
.gov-banner-text { flex: 1; }
.gov-banner-text .republic { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; opacity: 0.75; font-weight: 400; }
.gov-banner-text .agency  { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; line-height: 1.2; }
.gov-banner-text .system-name { font-size: 11px; opacity: 0.8; font-weight: 400; margin-top: 1px; }
.nav-wdivider {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.nav-wdivider::after {
  content: '';
  position: absolute; top: 0; left: -30%; width: 30%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.35), rgba(255,255,255,0.4), rgba(56,189,248,0.35), transparent);
  animation: travelLine 4s linear infinite;
}
@keyframes travelLine { 0%{ left: -30%; } 100%{ left: 130%; } }

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  background: #fff;
  border-bottom: 3px solid var(--gov-gold);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
  height: 52px;
}
.brand {
  font-weight: 700; font-size: 13px;
  color: var(--gov-blue);
  letter-spacing: 0.2px;
  flex-shrink: 0;
}
.brand span { color: var(--text3); font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--text2);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-links a:hover { background: var(--gov-light); color: var(--gov-blue); text-decoration: none; }
.nav-links a.active { background: var(--gov-light); color: var(--gov-blue); font-weight: 600; }
.btn-logout {
  margin-left: auto;
  background: transparent !important;
  border: 1px solid #ddd !important;
  color: var(--text2) !important;
  padding: 5px 12px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}
.btn-logout:hover { background: var(--red-bg) !important; color: var(--red) !important; border-color: var(--red) !important; }

/* ── Footer ────────────────────────────────────────────────── */
.gov-footer {
  background: var(--gov-blue);
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  text-align: center;
  padding: 10px 24px;
  position: relative;
  overflow: hidden;
  margin-top: auto;
}
.gov-footer strong { color: #fff; }
.gov-footer::before {
  content: '';
  position: absolute; top: 0; right: -30%; width: 30%; height: 3px;
  background: linear-gradient(90deg, transparent, rgba(249,201,0,0.5), rgba(255,255,255,0.6), rgba(249,201,0,0.5), transparent);
  animation: travelLineRTL 4s linear infinite;
}
@keyframes travelLineRTL { 0%{ right: -30%; } 100%{ right: 130%; } }

/* ── Layout ────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--gov-blue); }
.page-header p  { color: var(--text3); font-size: 13px; margin-top: 2px; }
.flex { display: flex; } .gap-2 { gap: 8px; }
.mt-4 { margin-top: 16px; } .mb-6 { margin-bottom: 24px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-sm { padding: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--gov-blue); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s;
  white-space: nowrap; text-decoration: none !important;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--gov-blue); color: #fff; }
.btn-primary:hover  { background: var(--gov-blue2); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg3); }
.btn-blue   { background: var(--blue-bg); color: var(--gov-blue); border: 1px solid #c0d3f5; }
.btn-blue:hover { background: #d0e4ff; }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid #f5c5c0; }
.btn-danger:hover { background: #fad5d0; }
.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid #a3d9be; }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 11px 24px; font-size: 15px; }
.w-full  { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit;
  background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  display: block;
}
.form-control:focus {
  outline: none;
  border-color: var(--gov-blue2);
  box-shadow: 0 0 0 3px rgba(0,80,200,0.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.req { color: var(--red); }
.score-input-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 14px; text-align: left;
  background: var(--bg3); color: var(--text2);
  font-weight: 600; font-size: 11px; letter-spacing: .5px; text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-blue   { background: var(--blue-bg);   color: var(--gov-blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gray   { background: #eee; color: #666; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 6px;
  font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #a3d9be; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid #f5c5c0; }
.alert-warning { background: var(--yellow-bg);color: var(--yellow); border: 1px solid #f0d070; }
.alert-info    { background: var(--blue-bg);  color: var(--gov-blue); border: 1px solid #c0d3f5; }

/* ── Stats Row ─────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); text-align: center;
  border-top: 3px solid var(--gov-gold);
}
.stat-val { font-size: 32px; font-weight: 700; color: var(--gov-blue); line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--text3); margin-top: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }

/* ── Progress ──────────────────────────────────────────────── */
.progress { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { background: var(--gov-blue); height: 100%; border-radius: 4px; transition: width .4s; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff; border-radius: 10px;
  width: 100%; max-width: 560px; margin: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0; margin-bottom: 16px;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--gov-blue); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text3); }
.modal form, .modal > p, .modal > div:not(.modal-header) { padding: 0 20px 20px; }

/* ── Code Editor ───────────────────────────────────────────── */
.editor-wrap { border: 1px solid #30363d; border-radius: 8px; overflow: hidden; margin-top: 14px; }
.editor-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #161b22; padding: 8px 14px;
  font-size: 12px; color: #8b949e;
}
.editor-toolbar .lang-tag {
  background: var(--gov-blue); color: #fff;
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.CodeMirror {
  height: 340px !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 13.5px !important;
  background: #0d1117 !important;
}
/* CRITICAL FIX: ensure editor is never read-only for examinees */
.code-editor-active .CodeMirror { cursor: text !important; }
.CodeMirror-cursor { border-left: 2px solid #58a6ff !important; }
.CodeMirror-scroll { padding-bottom: 8px; }

/* ── Question Cards ────────────────────────────────────────── */
.question-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.q-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(90deg, var(--gov-light), #fff);
  border-bottom: 1px solid var(--border);
}
.q-num { font-weight: 700; font-size: 13px; color: var(--gov-blue); }
.q-body { padding: 18px; }
.q-text { font-size: 14px; line-height: 1.7; margin-bottom: 16px; white-space: pre-wrap; }

/* ── MC Options ────────────────────────────────────────────── */
.mc-options-group { display: flex; flex-direction: column; gap: 8px; }
.mc-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer; transition: all .15s;
}
.mc-option:hover { border-color: var(--gov-blue2); background: var(--blue-bg); }
.mc-option.selected { border-color: var(--gov-blue); background: var(--blue-bg); }
.mc-option.correct  { border-color: var(--green); background: var(--green-bg); }
.mc-option.wrong    { border-color: var(--red);   background: var(--red-bg); }
.mc-option input[type="radio"] { margin-top: 2px; accent-color: var(--gov-blue); }
.mc-option label { cursor: pointer; font-weight: 400; margin: 0; }

/* ── Timer ─────────────────────────────────────────────────── */
.timer-bar {
  background: var(--gov-blue);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; gap: 12px; flex-wrap: wrap;
  position: sticky; top: 52px; z-index: 90;
}
.timer-display {
  font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  color: #fff; letter-spacing: 1px;
}
.timer-display.warning { color: var(--gov-gold); }
.timer-display.danger  { color: #ff6b6b; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }
.timer-bar .text-muted { color: rgba(255,255,255,0.7); }
.timer-bar .btn-secondary { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.3); }
.timer-bar .btn-secondary:hover { background: rgba(255,255,255,0.25); }
.timer-bar .btn-primary { background: var(--gov-gold); color: var(--gov-blue); }
.timer-bar .btn-primary:hover { background: #e6b800; }

/* ── Login Page ────────────────────────────────────────────── */
.login-page-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
}
.login-content {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  background: linear-gradient(135deg, #eaf0fb 0%, #f5f8fe 60%, #fef9e0 100%);
}
.login-card {
  width: 100%; max-width: 900px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,48,135,0.15);
  overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
}
.login-left {
  background: linear-gradient(160deg, var(--gov-blue) 0%, #0050c8 100%);
  padding: 48px 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 20px;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.06); border-radius: 50%;
}
.login-left::after {
  content: '';
  position: absolute; bottom: -40px; left: -40px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,0.05); border-radius: 50%;
}
.login-logo-wrap {
  width: 100px; height: 100px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%; border: 3px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; overflow: hidden; z-index: 1;
}
.login-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.login-left h2 {
  color: #fff; font-size: 22px; font-weight: 700;
  line-height: 1.3; z-index: 1;
}
.login-left p { color: rgba(255,255,255,0.75); font-size: 13px; z-index: 1; }
.login-left .welcome { font-size: 40px; font-weight: 900; color: #fff; letter-spacing: -1px; z-index: 1; }
.login-left .welcome span { color: var(--gov-gold); }
.login-right {
  padding: 48px 40px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-right .secure-tag {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--gov-blue2); margin-bottom: 8px;
}
.login-right .secure-tag::before {
  content: ''; display: block;
  width: 24px; height: 2px; background: var(--gov-blue2);
}
.login-right h1 { font-size: 28px; font-weight: 800; color: var(--gov-blue); margin-bottom: 24px; }
.login-authorized {
  text-align: center; margin-top: 20px;
  font-size: 11px; color: var(--text3); line-height: 1.6;
}
.login-authorized strong { color: var(--text2); }

/* ── Score display ─────────────────────────────────────────── */
.score-circle { display: inline-flex; align-items: baseline; gap: 4px; margin-bottom: 8px; }
.sc-val { font-size: 52px; font-weight: 800; color: var(--gov-blue); line-height: 1; }
.sc-total { font-size: 20px; color: var(--text3); }
.grading-section { border-left: 3px solid var(--gov-gold); }

/* ── Misc helpers ──────────────────────────────────────────── */
.text-muted { color: var(--text3); }
.text-sm    { font-size: 12px; }
.text-center { text-align: center; }
.mono { font-family: 'JetBrains Mono', monospace; }
.section-divider {
  border: none; border-top: 2px solid var(--border);
  margin: 32px 0;
}

/* ── Start exam page ───────────────────────────────────────── */
.start-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
}
.start-content {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  background: linear-gradient(135deg, #eaf0fb, #f5f8fe);
}
.start-card {
  max-width: 640px; width: 100%;
  background: #fff; border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,48,135,0.12);
  overflow: hidden; border: 1px solid var(--border);
}
.start-card-header {
  background: linear-gradient(135deg, var(--gov-blue), #0050c8);
  padding: 28px 32px; color: #fff; text-align: center;
}
.start-card-header h1 { font-size: 20px; font-weight: 700; }
.start-card-header p  { opacity: 0.8; font-size: 13px; margin-top: 4px; }
.start-card-body { padding: 32px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.info-item label { color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.info-item p { font-weight: 600; color: var(--gov-blue); font-size: 14px; }

/* ── Config / Settings ─────────────────────────────────────── */
.settings-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: #fff; color: var(--text2); transition: all .15s;
}
.tab-btn.active { background: var(--gov-blue); color: #fff; border-color: var(--gov-blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.config-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border); gap: 16px;
}
.config-item:last-child { border-bottom: none; }
.config-item-label { font-weight: 500; font-size: 13px; }
.config-item-desc  { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ── Done page ─────────────────────────────────────────────── */
.done-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
}
.done-content {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px; background: linear-gradient(135deg, #eaf0fb, #f5f8fe);
}
.done-card {
  max-width: 500px; width: 100%; background: #fff;
  border-radius: 12px; box-shadow: 0 8px 40px rgba(0,48,135,0.12);
  overflow: hidden; text-align: center; border: 1px solid var(--border);
}
.done-card-top {
  background: linear-gradient(135deg, var(--gov-blue), #0050c8);
  padding: 32px; color: #fff;
}
.done-card-top .check { font-size: 52px; margin-bottom: 8px; }
.done-card-top h1 { font-size: 22px; font-weight: 700; }
.done-card-body { padding: 32px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { padding: 32px 24px; }
  .info-grid { grid-template-columns: 1fr; }
  .gov-banner-inner { padding: 8px 16px; }
  .container { padding: 16px; }
}
