/* KTI Question Bank — template carried over from the legacy system (header.php / footer.php / dashboard.php) */
:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --primary-dark: #3f37c9;
    --secondary: #f72585;
    --success: #06d6a0;
    --warning: #ffb703;
    --danger: #e63946;
    --dark: #2b2d42;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border-radius: 16px;
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 20px 60px rgba(67, 97, 238, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; min-height: 100vh; display: flex; flex-direction: column; }
main.app-main { flex: 1; }
a { color: var(--primary); }

/* ── Top navigation (two rows) ─────────────────────────────── */
.top-nav { background: rgba(255,255,255,.97); box-shadow: 0 2px 20px rgba(0,0,0,.07); position: sticky; top: 0; z-index: 1000; backdrop-filter: blur(12px); border-bottom: 1px solid rgba(0,0,0,.06); }
.nav-top-row { max-width: 1600px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: .55rem 2rem; position: relative; }
.nav-links-row { border-top: 1px solid rgba(0,0,0,.05); background: rgba(248,249,250,.6); display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .2rem; padding: .35rem 2rem; }
.nav-brand { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; font-weight: 700; text-decoration: none; }
.nav-brand img { height: 38px; }
.nav-brand span { background: linear-gradient(135deg, #4361ee, #f72585); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-link-custom { padding: .5rem 1rem; border-radius: 8px; color: #2b2d42; font-weight: 500; transition: var(--transition); display: flex; align-items: center; gap: .5rem; text-decoration: none; font-size: .9rem; }
.nav-link-custom:hover, .nav-link-custom.active { background: #4361ee; color: #fff; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(67,97,238,.3); }
.nav-link-custom .count { background: var(--secondary); color: #fff; border-radius: 50px; font-size: .7rem; padding: .05rem .45rem; }
.user-menu { display: flex; align-items: center; gap: 1rem; }
.user-greeting { color: #6c757d; font-weight: 500; font-size: .9rem; text-align: right; line-height: 1.2; }
.user-greeting small { display: block; color: var(--primary); font-size: .75rem; }
.user-avatar { width: 38px; height: 38px; background: linear-gradient(135deg, #4361ee, #f72585); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; cursor: pointer; transition: var(--transition); }
.user-avatar:hover { transform: scale(1.05); box-shadow: 0 10px 25px rgba(67,97,238,.3); }
.bell-btn { position: relative; width: 38px; height: 38px; border-radius: 8px; background: #f0f4ff; color: var(--primary); display: flex; align-items: center; justify-content: center; border: 0; }
.bell-btn .dot { position: absolute; top: -4px; right: -4px; background: var(--secondary); color: #fff; font-size: .65rem; border-radius: 50px; padding: .05rem .38rem; font-weight: 700; }
.notif-menu { width: 360px; max-width: 92vw; border-radius: 14px; padding: .4rem; }
.notif-item { display: flex; gap: .7rem; padding: .6rem; border-radius: 10px; text-decoration: none; color: var(--dark); }
.notif-item:hover { background: #f0f4ff; }
.notif-item i { margin-top: .2rem; }
.notif-item .t { font-weight: 600; font-size: .85rem; }
.notif-item .m { font-size: .78rem; color: var(--gray); }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.3rem; color: #2b2d42; padding: .5rem; }

/* Semester pill */
.sem-pill-wrap { position: absolute; left: 50%; transform: translateX(-50%); z-index: 1001; }
.sem-pill { display: flex; align-items: center; gap: .65rem; background: linear-gradient(135deg, #4361ee 0%, #7b2fff 100%); border-radius: 50px; padding: .62rem 1.35rem .62rem 1.1rem; cursor: pointer; user-select: none; white-space: nowrap; transition: all .25s ease; box-shadow: 0 4px 18px rgba(67,97,238,.38); border: 0; }
.sem-pill:hover, .sem-pill.open { box-shadow: 0 6px 26px rgba(67,97,238,.55); transform: translateY(-1px); }
.sem-pill-icon { font-size: .88rem; color: rgba(255,255,255,.75); }
.sem-pill-name { font-size: .95rem; font-weight: 700; color: #fff; }
.sem-pill-dot { color: rgba(255,255,255,.4); }
.sem-pill-year { font-size: .84rem; font-weight: 500; color: rgba(255,255,255,.82); }
.sem-pill-caret { font-size: .72rem; color: rgba(255,255,255,.65); transition: transform .25s ease; }
.sem-pill.open .sem-pill-caret { transform: rotate(180deg); }
.sem-popup { position: absolute; top: calc(100% + .8rem); left: 50%; transform: translateX(-50%); width: 320px; background: #fff; border-radius: 18px; box-shadow: 0 24px 70px rgba(67,97,238,.22), 0 0 0 1px rgba(67,97,238,.08); overflow: hidden; z-index: 99999; display: none; animation: popIn .2s ease; }
.sem-popup.open { display: block; }
@keyframes popIn { from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.97); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
.sem-popup-header { background: linear-gradient(135deg, #4361ee, #7b2fff); color: #fff; padding: .9rem 1.15rem; font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.sem-popup-list { padding: .55rem; max-height: 60vh; overflow: auto; }
.sem-popup-item { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; border-radius: 10px; padding: .8rem .95rem; text-align: left; cursor: pointer; gap: .75rem; }
.sem-popup-item:hover { background: #f0f4ff; }
.sem-popup-item.active { background: linear-gradient(135deg, rgba(67,97,238,.1), rgba(123,47,255,.06)); border-left: 3px solid #4361ee; }
.sem-popup-item-name { display: block; font-size: .92rem; font-weight: 700; color: #2b2d42; }
.sem-popup-item-year { display: block; font-size: .78rem; color: #6c757d; }
.sem-popup-check { color: #4361ee; opacity: 0; }
.sem-popup-item.active .sem-popup-check { opacity: 1; }
.sem-tag { font-size: .68rem; border-radius: 4px; padding: .1rem .4rem; margin-left: .3rem; }
.sem-tag-ended { background: rgba(230,57,70,.12); color: #c82333; }
.sem-tag-current { background: rgba(6,214,160,.15); color: #05936e; }

/* ── Page scaffolding ─────────────────────────────────────── */
.main-wrapper { padding: 2rem; max-width: 1600px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem; }
.page-title { font-size: 1.85rem; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0; }
.page-subtitle { color: var(--gray); margin: .25rem 0 0; }
.btn-primary-custom { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; border: none; padding: .65rem 1.3rem; border-radius: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: .5rem; transition: var(--transition); box-shadow: 0 5px 15px rgba(67,97,238,.3); text-decoration: none; }
.btn-primary-custom:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(67,97,238,.4); color: #fff; }
.btn-success-custom { background: linear-gradient(135deg, #06d6a0, #05b588); color: #fff; border: 0; padding: .65rem 1.3rem; border-radius: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: .5rem; box-shadow: 0 5px 15px rgba(6,214,160,.3); transition: var(--transition); text-decoration: none; }
.btn-success-custom:hover { transform: translateY(-3px); color: #fff; }
.btn-danger-soft { background: rgba(230,57,70,.1); color: var(--danger); border: 0; border-radius: 10px; padding: .45rem .9rem; font-weight: 500; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-light-custom { background: #fff; color: var(--dark); border: 2px solid #e9ecef; border-radius: 12px; padding: .55rem 1.1rem; font-weight: 500; display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; transition: var(--transition); }
.btn-light-custom:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: #f0f4ff; color: var(--primary); transition: var(--transition); text-decoration: none; }
.btn-icon:hover { background: var(--primary); color: #fff; }
.btn-icon.danger { background: rgba(230,57,70,.1); color: var(--danger); }
.btn-icon.danger:hover { background: var(--danger); color: #fff; }
.role-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; background: rgba(67,97,238,.1); border-radius: 50px; color: var(--primary); font-weight: 500; font-size: .9rem; }

/* Cards */
.card-modern { background: #fff; border-radius: var(--border-radius); box-shadow: var(--card-shadow); border: 0; margin-bottom: 1.5rem; overflow: hidden; }
.card-modern .card-head { padding: 1.1rem 1.5rem; border-bottom: 1px solid #eef0f4; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-modern .card-head h5 { margin: 0; font-weight: 600; color: var(--dark); font-size: 1.05rem; }
.card-modern .card-head h5 i { color: var(--primary); margin-right: .4rem; }
.card-modern .card-body-p { padding: 1.5rem; }

.welcome-card { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 20px; padding: 2rem; color: #fff; margin-bottom: 2rem; position: relative; overflow: hidden; box-shadow: 0 20px 40px rgba(102,126,234,.3); }
.welcome-card::before { content: ''; position: absolute; top: -50%; right: -50%; width: 200%; height: 200%; background: rgba(255,255,255,.08); transform: rotate(45deg); animation: shimmer 4s infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%) rotate(45deg); } 100% { transform: translateX(100%) rotate(45deg); } }
.welcome-content { position: relative; z-index: 2; }
.welcome-title { font-size: 1.9rem; font-weight: 700; margin-bottom: .4rem; }
.welcome-subtitle { opacity: .9; margin-bottom: 1rem; }
.welcome-stats { display: flex; gap: 2.2rem; flex-wrap: wrap; }
.welcome-stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.welcome-stat .label { font-size: .75rem; opacity: .85; text-transform: uppercase; letter-spacing: .5px; }
.welcome-icon { position: absolute; bottom: 10px; right: 25px; font-size: 7rem; opacity: .1; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 1.75rem; }
.stat-card { background: #fff; border-radius: var(--border-radius); padding: 1.35rem; box-shadow: var(--card-shadow); transition: var(--transition); display: flex; align-items: center; gap: 1rem; text-decoration: none; color: inherit; }
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--hover-shadow); color: inherit; }
.stat-icon { width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.5rem; flex-shrink: 0; }
.stat-icon.success { background: linear-gradient(135deg, #06d6a0, #05b588); }
.stat-icon.warning { background: linear-gradient(135deg, #ffb703, #fb8500); }
.stat-icon.danger { background: linear-gradient(135deg, #e63946, #c82333); }
.stat-icon.pink { background: linear-gradient(135deg, #f72585, #b5179e); }
.stat-icon.dark { background: linear-gradient(135deg, #2b2d42, #4a4e69); }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--dark); line-height: 1.15; }
.stat-label { color: var(--gray); font-weight: 500; font-size: .87rem; }

/* Tables */
.table-modern { width: 100%; margin: 0; }
.table-modern thead th { background: #f8f9fc; color: #5a6072; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .85rem 1rem; border-bottom: 1px solid #eef0f4; white-space: nowrap; }
.table-modern tbody td { padding: .85rem 1rem; vertical-align: middle; border-bottom: 1px solid #f1f3f7; font-size: .9rem; }
.table-modern tbody tr:hover { background: #fafbff; }
.table-modern tbody tr:last-child td { border-bottom: 0; }
.q-text-cell { max-width: 520px; }

/* Forms */
.form-label { font-weight: 600; color: var(--dark); font-size: .87rem; margin-bottom: .35rem; }
.form-control, .form-select { border: 2px solid #e9ecef; border-radius: 10px; padding: .55rem .85rem; transition: var(--transition); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(67,97,238,.1); }
.form-section-title { font-weight: 700; color: var(--dark); font-size: 1rem; margin: 1.25rem 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.form-section-title i { color: var(--primary); }
.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.filter-bar > div { min-width: 160px; flex: 1; }

/* Badges */
.badge-soft { display: inline-flex; align-items: center; padding: .3rem .7rem; border-radius: 50px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-soft-success { background: rgba(6,214,160,.15); color: #05936e; }
.badge-soft-warning { background: rgba(255,183,3,.18); color: #b07d00; }
.badge-soft-danger { background: rgba(230,57,70,.12); color: #c82333; }
.badge-soft-info { background: rgba(72,149,239,.15); color: #2667b8; }
.badge-soft-primary { background: rgba(67,97,238,.12); color: var(--primary); }
.badge-soft-secondary { background: #eef0f4; color: #5a6072; }
.badge-soft-dark { background: #2b2d42; color: #fff; }
.bloom-pill { display: inline-block; padding: .2rem .6rem; border-radius: 50px; font-size: .72rem; font-weight: 600; }
.bloom-remember { background: #e0f2fe; color: #0369a1; }
.bloom-understand { background: #dcfce7; color: #15803d; }
.bloom-apply { background: #fef9c3; color: #a16207; }
.bloom-analyze { background: #ffedd5; color: #c2410c; }
.bloom-evaluate { background: #fce7f3; color: #be185d; }
.bloom-create { background: #ede9fe; color: #6d28d9; }

/* Agent findings */
.finding { display: flex; gap: .75rem; padding: .7rem .9rem; border-radius: 10px; margin-bottom: .5rem; font-size: .9rem; align-items: flex-start; }
.finding i { margin-top: .2rem; }
.finding-error { background: rgba(230,57,70,.08); color: #9b1c27; }
.finding-warning { background: rgba(255,183,3,.12); color: #7a5600; }
.finding-info { background: rgba(72,149,239,.1); color: #1f4f8a; }
.finding .rule { font-size: .72rem; opacity: .7; display: block; }
.agent-banner { border-radius: 14px; padding: 1rem 1.25rem; display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; }
.agent-banner .ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff; flex-shrink: 0; }
.agent-banner.passed { background: rgba(6,214,160,.1); } .agent-banner.passed .ico { background: #06d6a0; }
.agent-banner.warning { background: rgba(255,183,3,.12); } .agent-banner.warning .ico { background: #ffb703; }
.agent-banner.failed { background: rgba(230,57,70,.08); } .agent-banner.failed .ico { background: #e63946; }

/* Workflow stepper (§4) */
.stepper { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.step { flex: 1; min-width: 140px; background: #fff; border-radius: 12px; padding: .75rem .9rem; box-shadow: 0 4px 15px rgba(0,0,0,.05); border-top: 4px solid #e9ecef; font-size: .82rem; }
.step .n { font-weight: 700; color: var(--gray); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.step .l { font-weight: 600; color: var(--dark); }
.step.done { border-top-color: var(--success); }
.step.current { border-top-color: var(--primary); box-shadow: 0 8px 25px rgba(67,97,238,.18); }
.step.blocked { border-top-color: var(--danger); }

/* Question preview */
.q-preview { border: 1px solid #eef0f4; border-radius: 12px; padding: 1rem 1.15rem; margin-bottom: .75rem; background: #fff; }
.q-preview.flagged { border-color: rgba(230,57,70,.5); background: #fff8f8; }
.q-preview .q-meta { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; font-size: .75rem; color: var(--gray); }
.q-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .35rem .9rem; margin-top: .5rem; }
.q-opt { padding: .3rem .6rem; border-radius: 8px; background: #f8f9fc; font-size: .9rem; }
.q-opt.correct { background: rgba(6,214,160,.15); font-weight: 600; }
.q-content img { max-width: 100%; height: auto; }
.q-content p { margin-bottom: .25rem; }
.q-content table { border-collapse: collapse; } .q-content td, .q-content th { border: 1px solid #ccc; padding: 2px 6px; }

.progress-thin { height: 8px; border-radius: 50px; background: #eef0f4; overflow: hidden; }
.progress-thin > div { height: 100%; border-radius: 50px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray); }
.empty-state i { font-size: 3rem; opacity: .35; margin-bottom: 1rem; display: block; }

/* Login */
.auth-body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; position: relative; overflow: hidden; }
.auth-body::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 50px 50px; }
.auth-card { position: relative; background: rgba(255,255,255,.98); border-radius: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.25); width: 100%; max-width: 440px; padding: 2.5rem; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo img { height: 80px; }
.auth-title { text-align: center; font-weight: 700; font-size: 1.5rem; color: var(--dark); }
.auth-sub { text-align: center; color: var(--gray); margin-bottom: 1.75rem; font-size: .92rem; }

/* Footer (legacy modern-footer) */
.modern-footer { position: relative; background: linear-gradient(135deg, #2b2d42 0%, #1a1b2f 100%); color: #fff; margin-top: 3rem; overflow: hidden; }
.footer-wave { position: absolute; top: -1px; left: 0; width: 100%; line-height: 0; color: rgba(255,255,255,.03); }
.footer-wave svg { display: block; width: 100%; height: 60px; }
.footer-content { position: relative; z-index: 2; padding: 3.5rem 0 1.75rem; }
.footer-brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.brand-icon { width: 50px; height: 50px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; box-shadow: 0 5px 15px rgba(67,97,238,.3); }
.brand-name { font-size: 1.4rem; font-weight: 700; margin: 0; }
.brand-description { color: rgba(255,255,255,.7); line-height: 1.6; }
.footer-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 1.25rem; position: relative; padding-bottom: .5rem; }
.footer-title::after { content: ''; position: absolute; bottom: 0; left: 0; width: 50px; height: 2px; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.footer-links, .contact-info { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .65rem; }
.footer-links a { color: rgba(255,255,255,.7); text-decoration: none; transition: var(--transition); display: inline-flex; align-items: center; gap: .5rem; }
.footer-links a i { font-size: .75rem; color: var(--primary); }
.footer-links a:hover { color: #fff; transform: translateX(5px); }
.contact-info li { display: flex; gap: 1rem; margin-bottom: .9rem; color: rgba(255,255,255,.7); }
.contact-info li i { width: 20px; color: var(--primary); margin-top: .2rem; }
.footer-bottom { margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.6); font-size: .88rem; }

.alert-modern { border-radius: 12px; border: 0; box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.swal2-popup { border-radius: 20px !important; }

@media (max-width: 992px) {
    .mobile-menu-btn { display: block; }
    .nav-links-row { display: none; flex-direction: column; align-items: stretch; padding: .5rem 1rem .75rem; }
    .nav-links-row.show { display: flex; }
    .user-greeting { display: none; }
    .sem-pill-wrap { position: static; transform: none; order: 3; width: 100%; display: flex; justify-content: center; padding: .3rem 0; }
    .nav-top-row { flex-wrap: wrap; gap: .4rem; padding: .5rem 1rem; }
    .sem-popup { width: calc(100vw - 2rem); }
    .main-wrapper { padding: 1.25rem 1rem; }
}
@media (max-width: 480px) { .sem-pill-year, .sem-pill-dot { display: none; } }
