/* PAK Exam Readiness — Stylesheet */
:root {
  --blue: #1B4F72; --light-blue: #2E86C1; --green: #27AE60;
  --red: #E74C3C; --amber: #F39C12; --gray: #5D6D7E;
  --light-gray: #F2F4F4; --bg: #F8F9FA; --white: #FFFFFF;
  --shadow: 0 2px 8px rgba(0,0,0,0.08); --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: #2C3E50; min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px; flex: 1; }

/* Nav */
.nav { background: var(--blue); padding: 0 20px; }
.nav-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav-brand { color: white; text-decoration: none; font-weight: 700; font-size: 18px; }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-link { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 14px; }
.nav-link:hover { color: white; }
.nav-link-logout { background: rgba(255,255,255,0.15); padding: 6px 14px; border-radius: 6px; }
.nav-user { color: rgba(255,255,255,0.6); font-size: 14px; }

/* Footer */
.footer { text-align: center; padding: 16px; color: var(--gray); font-size: 13px; }

/* Auth */
.auth-card { max-width: 400px; margin: 60px auto; background: white; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card h1 { color: var(--blue); margin-bottom: 8px; }
.auth-subtitle { color: var(--gray); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-group input { width: 100%; padding: 10px 14px; border: 2px solid #E0E0E0; border-radius: 8px; font-size: 15px; transition: border-color 0.2s; }
.form-group input:focus { outline: none; border-color: var(--light-blue); }
.auth-footer { text-align: center; margin-top: 16px; font-size: 14px; color: var(--gray); }
.auth-footer a { color: var(--light-blue); }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 15px; cursor: pointer; border: none; text-decoration: none; transition: all 0.2s; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #154360; }
.btn-primary:disabled { background: #AEB6BF; cursor: not-allowed; }
.btn-outline { background: white; color: var(--blue); border: 2px solid var(--blue); }
.btn-outline:hover { background: var(--blue); color: white; }
.btn-full { width: 100%; text-align: center; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #FDEDEC; color: var(--red); border: 1px solid #F5B7B1; }

/* Dashboard */
h1 { color: var(--blue); margin-bottom: 4px; }
.subtitle { color: var(--gray); margin-bottom: 24px; }
.exam-section { background: white; border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.exam-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.exam-header h2 { color: var(--blue); margin: 0; }
.exam-title { color: var(--gray); font-size: 14px; }
.stat-line { color: var(--gray); font-size: 14px; margin-bottom: 16px; }

/* Readiness Badge */
.readiness-badge { text-align: center; padding: 12px 20px; border-radius: var(--radius); min-width: 80px; }
.readiness-pct { font-size: 28px; font-weight: 700; display: block; }
.readiness-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }
.readiness-good { background: #E8F8F5; color: var(--green); }
.readiness-mid { background: #FEF9E7; color: var(--amber); }
.readiness-low { background: #FDEDEC; color: var(--red); }

/* Topic Grid */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.topic-card { background: var(--light-gray); border-radius: 10px; padding: 16px; transition: transform 0.2s; }
.topic-card:hover { transform: translateY(-2px); }
.topic-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.topic-card h3 { font-size: 15px; color: var(--blue); margin: 0; flex: 1; }
.freq-badge { background: var(--blue); color: white; font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; margin-left: 8px; cursor: help; }
.tooltip-box { 
  position: fixed; background: #2C3E50; color: white; padding: 10px 14px; border-radius: 8px;
  font-size: 13px; max-width: 300px; z-index: 9999; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25); line-height: 1.4;
}
.topic-meta { color: var(--gray); font-size: 13px; margin-bottom: 8px; }
.topic-score { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.score-bar { flex: 1; height: 8px; background: #E0E0E0; border-radius: 4px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.score-good { background: var(--green); }
.score-mid { background: var(--amber); }
.score-low { background: var(--red); }
.score-text { font-weight: 700; font-size: 14px; min-width: 35px; }
.topic-stats { color: var(--gray); font-size: 12px; margin-bottom: 10px; }
.topic-not-started { color: #AEB6BF; font-style: italic; }
.topic-card .btn { width: 100%; text-align: center; }

/* Quiz */
.quiz-container { max-width: 750px; margin: 0 auto; }
.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.quiz-header h2 { color: var(--blue); font-size: 20px; margin: 0; }
.quiz-progress-text { color: var(--gray); font-size: 14px; }
.progress-bar { height: 6px; background: #E0E0E0; border-radius: 3px; margin-bottom: 24px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--light-blue), var(--green)); border-radius: 3px; transition: width 0.3s; }
.quiz-card { background: white; border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.question-text { font-size: 16px; line-height: 1.6; margin-bottom: 20px; color: #2C3E50; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.choice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border: 2px solid #E0E0E0; border-radius: 10px; cursor: pointer; transition: all 0.2s; }
.choice:hover { border-color: var(--light-blue); background: #EBF5FB; }
.choice.selected { border-color: var(--light-blue); background: #EBF5FB; }
.choice.correct { border-color: var(--green); background: #E8F8F5; }
.choice.wrong { border-color: var(--red); background: #FDEDEC; }
.choice-letter { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: white; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.choice-text { font-size: 15px; line-height: 1.5; padding-top: 3px; }
.quiz-actions { display: flex; gap: 12px; justify-content: flex-end; }
.hidden { display: none !important; }

/* Feedback */
.feedback { padding: 16px; border-radius: 10px; margin-bottom: 16px; }
.fb-correct { color: var(--green); font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.fb-wrong { color: var(--red); font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.fb-explanation { color: #2C3E50; font-size: 14px; line-height: 1.6; background: #F8F9FA; padding: 12px; border-radius: 8px; border-left: 4px solid var(--light-blue); }

/* Results */
.results-card { background: white; border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow); text-align: center; }
.results-card h2 { color: var(--blue); margin-bottom: 24px; }
.results-score { margin-bottom: 20px; }
.pct-big { font-size: 64px; font-weight: 700; }
.pct-good { color: var(--green); }
.pct-mid { color: var(--amber); }
.pct-low { color: var(--red); }
.pct-sub { font-size: 18px; color: var(--gray); }
.results-readiness { margin: 20px 0; padding: 16px; background: var(--light-gray); border-radius: 10px; font-size: 15px; text-align: left; }
.results-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }

/* Admin */
.admin-table { width: 100%; border-collapse: collapse; margin: 16px 0 32px; background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table th { background: var(--blue); color: white; padding: 12px 16px; text-align: left; font-size: 14px; }
.admin-table td { padding: 10px 16px; border-bottom: 1px solid #F0F0F0; font-size: 14px; }
.admin-table tr:hover td { background: #F8F9FA; }
.score-good-text { color: var(--green); font-weight: 600; }
.score-mid-text { color: var(--amber); font-weight: 600; }
.score-low-text { color: var(--red); font-weight: 600; }

/* Responsive */
@media (max-width: 600px) {
  .topic-grid { grid-template-columns: 1fr; }
  .exam-header { flex-direction: column; gap: 12px; }
  .quiz-header { flex-direction: column; gap: 8px; }
  .exam-select-grid { grid-template-columns: 1fr; }
}

/* Exam Selection */
.exam-select-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; margin-top: 24px; }
.exam-select-card { background: white; border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); text-align: center; transition: transform 0.2s; }
.exam-select-card:hover { transform: translateY(-4px); }
.exam-select-icon { font-size: 48px; margin-bottom: 12px; }
.exam-select-card h2 { color: var(--blue); margin-bottom: 4px; }
.exam-select-title { color: var(--gray); font-size: 14px; margin-bottom: 16px; }
.exam-select-stats { color: var(--gray); font-size: 13px; margin-bottom: 16px; }
.exam-select-stats span { margin: 0 4px; }
.exam-select-actions { margin-top: 16px; }
.exam-select-card .readiness-badge { display: inline-block; margin-bottom: 16px; }

/* Full Exam Verdict */
.results-verdict { margin: 20px 0; padding: 20px; border-radius: var(--radius); text-align: left; font-size: 15px; line-height: 1.6; }
.verdict-good { background: #E8F8F5; border-left: 6px solid var(--green); }
.verdict-mid { background: #FEF9E7; border-left: 6px solid var(--amber); }
.verdict-low { background: #FDEDEC; border-left: 6px solid var(--red); }

/* Admin */
.admin-section { background: white; border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.admin-section h2 { color: var(--blue); margin-bottom: 16px; font-size: 18px; }
.admin-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-form input { padding: 8px 12px; border: 2px solid #E0E0E0; border-radius: 8px; font-size: 14px; }
.admin-form input:focus { outline: none; border-color: var(--light-blue); }
.inline-form { display: inline-flex; align-items: center; gap: 4px; }
.inline-form input { padding: 4px 8px; border: 1px solid #E0E0E0; border-radius: 4px; font-size: 13px; }
.inline-form input:focus { outline: none; border-color: var(--light-blue); }
.btn-sm-action { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; }
.btn-sm-action:hover { background: #F0F0F0; }
.btn-delete:hover { background: #FDEDEC; }
.actions-cell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert-success { background: #E8F8F5; color: var(--green); border: 1px solid #82E0AA; }
.exam-access-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.exam-checkbox { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; white-space: nowrap; }
.exam-checkbox input[type="checkbox"] { margin: 0; }
