*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue: #27559e;
    --blue-d: #123466;
    --blue-l: #3a75d5;
    --gold: #dda941;
    --gold-l: #f5cf74;
    --bg: #f0f4f9;
    --card: #ffffff;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --sidebar-w: 240px;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: #1e293b;
    min-height: 100vh;
}

/* ─── LOGIN SCREEN ─────────────────────────────────── */
#screen-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blue-d) 0%, var(--blue) 60%, #1e40af 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 24px;
    padding: 48px 44px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

/* .login-logo {
            display: flex;
            align-items: center;
            gap: 14px;
            margin-bottom: 32px;
        }

        .login-logo img {
            width: 52px;
            height: 52px;
            border-radius: 50%;
            object-fit: cover;
        }

        .login-logo-text .title {
            font-size: 20px;
            font-weight: 800;
            color: var(--blue-d);
            line-height: 1.1;
        }

        .login-logo-text .sub {
            font-size: 13px;
            color: var(--muted);
            font-weight: 500;
        } */


.login-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Para humiwalay ang logos sa magkabilang dulo */
    margin-bottom: 32px;
}

.login-logo img {
    width: 55px;
    /* Pinalaki ng kaunti (mula 52px) */
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
}

/* BAGONG DAGDAG: Para maging sentro ang text */
.login-logo-text {
    text-align: center;
    flex: 1;
    /* Para sakupin nito ang gitnang espasyo */
    padding: 0 10px;
}

.login-logo-text .title {
    font-size: 22px;
    /* Pinalaki ng kaunti (mula 20px) */
    font-weight: 800;
    color: var(--blue-d);
    line-height: 1.1;
}

.login-logo-text .sub {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.login-card h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--blue-d);
    margin-bottom: 6px;
}

.login-card p {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 28px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}

.field input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    background: #f8fafc;
}

.field input:focus {
    outline: none;
    border-color: var(--blue);
    background: #fff;
}

.login-btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--blue-l), var(--blue));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    margin-top: 4px;
}

.login-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(39, 85, 158, 0.35);
}

.login-btn-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    background: #fee2e2;
    color: var(--danger);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 16px;
    display: none;
}

.register-link {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
}

.register-link a {
    color: var(--blue);
    font-weight: 600;
    cursor: pointer;
}

.divider-line {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ─── REGISTER TEACHER FORM (inside login card) ────── */
#register-form {
    display: none;
}

/* ─── DASHBOARD LAYOUT ─────────────────────────────── */
#screen-dashboard {
    display: none;
}

.dashboard-wrap {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--blue-d);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}

.sidebar-brand-text .name {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.sidebar-brand-text .role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 8px 10px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
    user-select: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 700;
}

.nav-item .icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.nav-item .badge-count {
    margin-left: auto;
    background: var(--gold);
    color: var(--blue-d);
    font-size: 11px;
    font-weight: 800;
    border-radius: 99px;
    padding: 2px 8px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.teacher-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
}

.teacher-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-l));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--blue-d);
    flex-shrink: 0;
}

.teacher-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.teacher-email {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 4px;
    transition: all 0.15s;
}

.logout-btn:hover {
    color: #fff;
    background: rgba(255, 0, 0, 0.2);
}

/* MAIN */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--blue-d);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content {
    padding: 28px;
}

/* ─── CARDS & STATS ────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border-radius: 16px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-icon {
    font-size: 36px;
}

.stat-val {
    font-size: 28px;
    font-weight: 800;
    color: var(--blue-d);
    line-height: 1;
}

.stat-lbl {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 2px;
}

/* TAB CONTENT */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ─── TABLE ────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--blue-d);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--blue-d);
    transform: translateY(-1px);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-gold {
    background: #fef3c7;
    color: #92400e;
}

.btn-gold:hover {
    background: var(--gold);
    color: var(--blue-d);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-ghost {
    background: var(--bg);
    color: var(--muted);
}

.card {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.card-body {
    padding: 20px 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f8fafc;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.elder-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.elder-photo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    background: #e2e8f0;
    flex-shrink: 0;
}

.elder-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.elder-brgy {
    font-size: 12px;
    color: var(--muted);
}

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
}

.pill-active {
    background: #dcfce7;
    color: var(--success);
}

.pill-inactive {
    background: #fee2e2;
    color: var(--danger);
}

.module-count {
    background: #dbeafe;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
}

/* ─── MODULE CARDS ─────────────────────────────────── */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.module-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.module-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.module-card .m-emoji {
    font-size: 40px;
    margin-bottom: 12px;
}

.module-card .m-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--blue-d);
    margin-bottom: 6px;
}

.module-card .m-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.module-card .m-url {
    font-size: 12px;
    color: var(--blue-l);
    margin-top: 8px;
    word-break: break-all;
}

.module-card .m-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.built-in-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #f0fdf4;
    color: var(--success);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 99px;
}

/* ─── QUESTION BUILDER ──────────────────────────────── */
.qtype-picker {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.qtype-btn {
    flex: 1;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--muted);
    transition: all 0.15s;
    text-align: center;
}

.qtype-btn.active {
    border-color: var(--blue);
    background: #dbeafe;
    color: var(--blue-d);
}

.qtype-btn:hover:not(.active) {
    border-color: var(--blue-l);
    background: #f0f7ff;
}

.q-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.q-item {
    background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    position: relative;
}

.q-item .q-item-text {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.q-item .q-item-meta {
    color: var(--muted);
    font-size: 12px;
}

.q-item .q-del {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--muted);
    line-height: 1;
}

.q-item .q-del:hover {
    color: var(--danger);
}

.add-q-form {
    background: #f0f7ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 14px;
    padding: 16px;
    margin-top: 14px;
}

.add-q-form .field {
    margin-bottom: 10px;
}

.add-q-form .field label {
    font-size: 12px;
    font-weight: 700;
    color: var(--blue-d);
    margin-bottom: 4px;
    display: block;
}

.add-q-form .field input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #bfdbfe;
    border-radius: 9px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    background: #fff;
}

.add-q-form .field input:focus {
    outline: none;
    border-color: var(--blue);
}

.choices-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.choice-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.choice-row input {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    background: #fff;
}

.choice-row input:focus {
    outline: none;
    border-color: var(--blue);
}

.correct-radio {
    accent-color: var(--blue);
    transform: scale(1.3);
    flex-shrink: 0;
}

.step-indicator {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 20px;
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.step-dot.done {
    background: var(--success);
    color: #fff;
}

.step-dot.active {
    background: var(--blue);
    color: #fff;
}

.step-dot.todo {
    background: var(--border);
    color: var(--muted);
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    border-radius: 99px;
}

.step-line.done {
    background: var(--success);
}

/* ─── ASSIGN PANEL ─────────────────────────────────── */
.assign-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.assign-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--blue-d);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.elder-list-assign {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 480px;
    overflow-y: auto;
}

.elder-select-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all 0.15s;
}

.elder-select-item:hover {
    border-color: var(--blue-l);
    background: #f0f7ff;
}

.elder-select-item.chosen {
    border-color: var(--blue);
    background: #dbeafe;
}

.elder-select-photo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
}

.module-assign-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.module-assign-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}

.module-assign-item:hover {
    border-color: var(--gold-l);
    background: #fffbeb;
}

.module-assign-item.assigned {
    border-color: var(--gold);
    background: #fef9c3;
}

.module-assign-item .ck {
    font-size: 20px;
}

.module-assign-item .m-info .t {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.module-assign-item .m-info .d {
    font-size: 12px;
    color: var(--muted);
}

/* ─── MODAL ────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: clamp(16px, 2.5vw, 40px);
    overflow-y: auto;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: var(--card);
    border-radius: clamp(16px, 1.2vw, 22px);
    padding: clamp(24px, 2.5vw, 38px);
    width: min(94vw, clamp(480px, 48vw, 760px));
    max-width: 94vw;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box.modal-box-lg {
    width: min(95vw, clamp(560px, 54vw, 860px));
    max-width: 95vw;
}

.modal-box.modal-box-sm {
    width: min(92vw, clamp(400px, 34vw, 520px));
    max-width: 92vw;
}

.modal-box h3 {
    font-size: clamp(18px, 1.4vw, 24px);
    font-weight: 800;
    color: var(--blue-d);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ─── TOAST ────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: #fff;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: none;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(60px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ─── SEARCH ───────────────────────────────────────── */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    width: 220px;
}

/* ─── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main {
        margin-left: 0;
    }

    .assign-layout {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state .emoji {
    font-size: 56px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 16px;
}

/* tag chips on elder row for assigned modules */
.tag-chip {
    background: #eff6ff;
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    display: inline-block;
    margin: 1px;
}

/* ── ITAGO ANG AUTOMATIC PASSWORD ICON NG BROWSER (EDGE) ── */
input::-ms-reveal,
input::-ms-clear {
    display: none;
}

/* ═══════════════════════════════════════════════
   ZOOM LEVEL RESILIENCE (75% - 80% BROWSER ZOOM & LARGE MONITORS)
   ═══════════════════════════════════════════════ */
@media screen and (min-width: 1440px) {
    .modal-box {
        width: min(94vw, 720px);
    }
    .modal-box.modal-box-lg {
        width: min(95vw, 840px);
    }
}

@media screen and (min-width: 1750px) {
    .modal-box {
        width: min(94vw, 820px);
        padding: 36px 40px;
    }
    .modal-box.modal-box-lg {
        width: min(95vw, 940px);
    }
    .modal-box h3 {
        font-size: 22px;
    }
}