/* IS Audit MCQ — Frontend Styles */
:root {
    --primary: #249371;
    --primary-dark: #1a6d54;
    --success: #057a55;
    --danger: #c81e1e;
    --warning: #ff8c00;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --white: #ffffff;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

.isamcq-app { font-family: 'Segoe UI', system-ui, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; color: var(--gray-800); position: relative; }
.isamcq-screen { display: none; }
.isamcq-screen.active { display: block; }

/* ── Start Screen ── */
.isamcq-start-card { background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 48px 40px; max-width: 640px; margin: 40px auto; text-align: center; }
.isamcq-logo { font-size: 64px; margin-bottom: 16px; }
.isamcq-start-card h1 { font-size: 2rem; font-weight: 700; margin-bottom: 28px; color: var(--gray-800); }
.isamcq-exam-details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.detail-item { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-size: 0.95rem; }
.detail-item .icon { font-size: 1.3rem; }
.isamcq-instructions { text-align: left; background: #edf7f3; border: 1px solid #a7dcc9; border-radius: 10px; padding: 20px 24px; margin-bottom: 24px; }
.isamcq-instructions h3 { margin: 0 0 10px; font-size: 1rem; color: var(--primary); }
.isamcq-instructions ul { margin: 0; padding-left: 20px; }
.isamcq-instructions li { margin-bottom: 6px; font-size: 0.9rem; line-height: 1.5; }
.isamcq-resume-notice { background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }

/* ── Buttons ── */
.isamcq-btn { display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: 8px; padding: 10px 20px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.isamcq-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.isamcq-btn-primary { background: var(--primary); color: white; padding: 14px 36px; font-size: 1.05rem; width: 100%; justify-content: center; }
.isamcq-btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.isamcq-btn-secondary { background: var(--gray-100); color: var(--gray-800); }
.isamcq-btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.isamcq-btn-danger { background: var(--danger); color: white; }
.isamcq-btn-danger:hover { background: #a01818; }
.isamcq-btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.isamcq-btn-ghost:hover { background: var(--gray-100); }

/* ── Exam Header ── */
.isamcq-exam-header { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px 20px; display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; box-shadow: var(--shadow); }
.isamcq-progress-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 160px; }
#isamcq-q-counter { font-weight: 700; font-size: 0.95rem; white-space: nowrap; color: var(--primary); }
.isamcq-progress-bar { flex: 1; height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
#isamcq-progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; width: 0%; }
.isamcq-answered-info { font-size: 0.85rem; color: var(--gray-600); white-space: nowrap; }
.isamcq-timer { font-size: 1.4rem; font-weight: 700; font-family: monospace; letter-spacing: 2px; color: var(--gray-800); padding: 6px 12px; background: var(--gray-100); border-radius: 8px; }
.isamcq-timer.warning { color: var(--warning); background: #fff7ed; }
.isamcq-timer.critical { color: var(--danger); background: #fef2f2; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

/* ── Exam Body ── */
.isamcq-exam-body { display: grid; grid-template-columns: 1fr 200px; gap: 16px; align-items: start; }
@media (max-width: 768px) { .isamcq-exam-body { grid-template-columns: 1fr; } .isamcq-sidebar { order: -1; } }

/* ── Question Panel ── */
.isamcq-question-panel { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.isamcq-question-text { font-size: 1.05rem; line-height: 1.7; margin-bottom: 24px; }
.q-num { color: var(--primary); font-weight: 700; margin-right: 6px; }
.isamcq-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.isamcq-option { display: flex; align-items: flex-start; gap: 14px; border: 2px solid var(--gray-200); border-radius: 10px; padding: 14px 16px; cursor: pointer; text-align: left; background: var(--white); transition: all 0.15s; width: 100%; }
.isamcq-option:hover { border-color: var(--primary); background: #edf7f3; }
.isamcq-option.selected { border-color: var(--primary); background: #edf7f3; }
.opt-letter { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--gray-100); font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.isamcq-option.selected .opt-letter { background: var(--primary); color: white; }
.opt-text { font-size: 0.95rem; line-height: 1.5; }
.isamcq-nav-btns { display: flex; gap: 10px; justify-content: space-between; }

/* ── Sidebar Grid ── */
.isamcq-sidebar { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.isamcq-sidebar h4 { margin: 0 0 12px; font-size: 0.85rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; }
.isamcq-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; max-height: 480px; overflow-y: auto; }
.isamcq-grid-cell { border: 1px solid var(--gray-200); border-radius: 4px; padding: 5px 2px; font-size: 0.7rem; font-weight: 600; cursor: pointer; background: var(--white); color: var(--gray-600); transition: all 0.1s; text-align: center; }
.isamcq-grid-cell:hover { background: var(--gray-100); }
.isamcq-grid-cell.answered { background: var(--primary); color: white; border-color: var(--primary); }
.isamcq-grid-cell.current { outline: 2px solid var(--warning); outline-offset: 1px; }
.isamcq-legend { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.legend-item { font-size: 0.72rem; display: flex; align-items: center; gap: 6px; }
.legend-item::before { content: ''; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--gray-200); display: inline-block; }
.legend-item.answered::before { background: var(--primary); border-color: var(--primary); }
.legend-item.current::before { outline: 2px solid var(--warning); }
.legend-item.unanswered::before { background: var(--white); }

/* ── Review Screen ── */
.isamcq-review-header { text-align: center; padding: 32px 20px 20px; }
.isamcq-review-header h1 { font-size: 2rem; margin-bottom: 24px; }
.isamcq-score-display { display: flex; align-items: center; justify-content: center; gap: 28px; margin-bottom: 28px; flex-wrap: wrap; }
.score-circle { width: 110px; height: 110px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; }
.score-circle.pass { background: #d1fae5; color: var(--success); border: 4px solid var(--success); }
.score-circle.fail { background: #fee2e2; color: var(--danger); border: 4px solid var(--danger); }
.score-details { text-align: left; }
.score-row { font-size: 1rem; margin-bottom: 6px; display: flex; gap: 10px; }
.score-row.pass-fail { font-size: 1.1rem; font-weight: 700; }
.score-row.pass-fail.pass { color: var(--success); }
.score-row.pass-fail.fail { color: var(--danger); }
.review-filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }
.filter-btn { background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 20px; padding: 6px 14px; font-size: 0.85rem; cursor: pointer; transition: all 0.15s; }
.filter-btn.active, .filter-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Review List ── */
.isamcq-review-list { display: flex; flex-direction: column; gap: 16px; padding: 0 0 40px; }
.review-item { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.review-item.correct { border-left: 4px solid var(--success); }
.review-item.wrong { border-left: 4px solid var(--danger); }
.review-item.skipped { border-left: 4px solid var(--gray-400); }
.review-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.review-q-num { font-weight: 700; font-size: 0.9rem; }
.review-status.skipped { font-size: 0.8rem; color: var(--gray-400); }
.review-q-text { font-size: 1rem; line-height: 1.65; margin-bottom: 16px; color: var(--gray-800); }
.review-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.review-option { display: flex; align-items: flex-start; gap: 12px; border: 2px solid var(--gray-200); border-radius: 8px; padding: 10px 14px; font-size: 0.9rem; position: relative; }
.review-option.correct-answer { border-color: var(--success); background: #f0fdf4; }
.review-option.wrong-answer { border-color: var(--danger); background: #fef2f2; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; margin-left: auto; white-space: nowrap; }
.correct-badge { background: var(--success); color: white; }
.wrong-badge { background: var(--danger); color: white; }
.review-feedback { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 12px 16px; font-size: 0.9rem; line-height: 1.55; margin-bottom: 8px; }
.review-reference { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 16px; font-size: 0.85rem; color: var(--gray-600); }
.isamcq-retake-area { text-align: center; padding: 20px 0 40px; }
.no-items { text-align: center; padding: 48px; color: var(--gray-400); }

/* ── Loading ── */
.isamcq-loading { position: fixed; inset: 0; background: rgba(255,255,255,0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; }
.isamcq-spinner { width: 48px; height: 48px; border: 4px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.isamcq-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--gray-800); color: white; padding: 12px 20px; border-radius: 8px; font-size: 0.9rem; opacity: 0; transition: all 0.3s; z-index: 10000; white-space: nowrap; }
.isamcq-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Login prompt ── */
.isamcq-login-prompt { text-align: center; padding: 48px; background: var(--gray-50); border-radius: var(--radius); border: 2px dashed var(--gray-200); }

/* ── Dashboard Tabs ── */
.isamcq-dashboard-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.dash-tab { background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 20px; font-size: 0.95rem; font-weight: 600; cursor: pointer; color: var(--gray-600); margin-bottom: -2px; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.dash-tab:hover { color: var(--primary); }
.dash-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge { background: var(--primary); color: white; font-size: 0.7rem; border-radius: 10px; padding: 1px 7px; font-weight: 700; }
.isamcq-tab-panel { display: none; }
.isamcq-tab-panel.active { display: block; }

/* ── History Panel ── */
.isamcq-history-panel { padding: 8px 0; }
.isamcq-history-loading { display: flex; align-items: center; gap: 10px; color: var(--gray-600); padding: 32px 0; }
.isamcq-spinner-sm { width: 20px; height: 20px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.isamcq-history-empty { text-align: center; padding: 48px; color: var(--gray-400); }
.isamcq-history-empty p { font-size: 1rem; margin: 12px 0 20px; }

/* ── History Cards Grid ── */
.isamcq-history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.history-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: box-shadow 0.15s; }
.history-card:hover { box-shadow: var(--shadow-lg); }
.history-card.pass { border-top: 4px solid var(--success); }
.history-card.fail { border-top: 4px solid var(--danger); }
.history-card-num { font-size: 0.8rem; color: var(--gray-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.history-score-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.history-score-circle { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 800; flex-shrink: 0; }
.history-score-circle.pass { background: #d1fae5; color: var(--success); border: 3px solid var(--success); }
.history-score-circle.fail { background: #fee2e2; color: var(--danger); border: 3px solid var(--danger); }
.history-meta { display: flex; flex-direction: column; gap: 4px; }
.hm-row { font-size: 0.88rem; color: var(--gray-600); }
.hm-row strong { color: var(--gray-800); }
.badge-pass { color: var(--success); font-weight: 700; }
.badge-fail { color: var(--danger); font-weight: 700; }
.history-date { font-size: 0.82rem; color: var(--gray-400); margin-bottom: 14px; }
.history-card .isamcq-btn { width: 100%; justify-content: center; }

/* ── Standalone Results Page ── */
.isamcq-results-standalone { max-width: 960px; margin: 0 auto; }
.isamcq-results-header { margin-bottom: 24px; }
.isamcq-results-header h2 { font-size: 1.6rem; margin-bottom: 6px; }
.results-sub { color: var(--gray-600); font-size: 0.95rem; }

.isamcq-summary-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px; }
@media (max-width: 600px) { .isamcq-summary-bar { grid-template-columns: repeat(2, 1fr); } }
.summary-stat { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow); }
.sstat-num { display: block; font-size: 1.6rem; font-weight: 800; color: #249371; }
.sstat-label { display: block; font-size: 0.8rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

.isamcq-review-panel { background: var(--white); border: 2px solid var(--gray-200); border-radius: 12px; padding: 28px; margin-bottom: 32px; box-shadow: var(--shadow-lg); }

/* ── Results-only page (standalone [is_audit_myresults] shortcode) ── */
.isamcq-results-only .isamcq-results-page-header { margin-bottom: 24px; }
.isamcq-results-only .isamcq-results-page-header h2 { font-size: 1.6rem; font-weight: 700; color: var(--gray-800); margin: 0 0 6px; }
.results-subheading { color: var(--gray-600); margin: 0 0 20px; font-size: 0.95rem; }

/* ── Login prompt ── */
.isamcq-login-prompt { text-align: center; padding: 48px 24px; background: var(--gray-50); border-radius: var(--radius); border: 2px dashed var(--gray-200); }
.isamcq-login-prompt .login-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.isamcq-login-prompt p { font-size: 1rem; color: var(--gray-600); }
.isamcq-login-prompt a { color: var(--primary); font-weight: 600; }

/* ── Admin stats bar brand color ── */
.isamcq-stats-bar { background: #249371; }
