/* apps/iam/public/css/iam_dark.css — Shared IAM v2 Light Utilities & High-Contrast Dark Mode */

/* Light-Mode Semantic Helpers */
.iam-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.5;
}

.iam-alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    font-weight: 600;
}

.iam-banner-info {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.iam-banner-warn {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 18px;
}

.iam-pre-slip {
    margin: 0;
    background: #ffffff;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.82rem;
    color: #0f172a;
    white-space: pre-wrap;
}

.iam-lockout-card {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 18px;
}

.iam-lockout-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    color: #0f172a;
    padding: 9px 14px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    flex-wrap: wrap;
    gap: 10px;
}

.iam-info-strip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.84rem;
    color: #334155;
}

.iam-subpanel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    color: #334155;
}

.iam-preset-box {
    background: #fdf2f4;
    border: 1px solid #fbcfe8;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.iam-preset-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: #862633;
}

.iam-muted-copy {
    color: #475569;
    line-height: 1.5;
}

.iam-text-muted {
    color: #64748b;
}

.iam-link-primary {
    color: var(--color-primary, #862633);
    text-decoration: none;
    font-weight: 600;
}

.iam-link-primary:hover {
    text-decoration: underline;
}

.iam-link-muted {
    color: #64748b;
    text-decoration: none;
    font-weight: 600;
}

.iam-link-muted:hover {
    color: #0f172a;
    text-decoration: underline;
}

.iam-card-foot {
    border-top: 1px solid #f1f5f9;
}

.iam-section-title,
.iam-modal-title,
.iam-user-name {
    color: #0f172a;
}

.iam-field-heading {
    color: #334155;
}

.btn-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #1e293b;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-top:hover {
    background: #fcecef;
    border-color: #862633;
    color: #862633;
    text-decoration: none;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 13px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.14s ease;
}

.nav-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    text-decoration: none;
}

.nav-pill.active {
    background: #862633;
    border-color: #862633;
    color: #ffffff;
}

.nav-pill.csv-pill {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

/* Auth Method Pills (session_logs.php) */
.auth-method-pill {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}
.auth-sso-ticket { background: #e0f2fe; color: #0369a1; }
.auth-sso-cookie { background: #f3e8ff; color: #6b21a8; }
.auth-resumed    { background: #f1f5f9; color: #475569; }
.auth-password   { background: #fef3c7; color: #92400e; }

/* ===================================================================
   HIGH-CONTRAST DARK MODE (@media screen ONLY — Print Stays Light)
   =================================================================== */
@media screen {
    body.dark-mode {
        background: #0f141b !important;
        background-color: #0f141b !important;
        color: #e2e8f0 !important;
    }

    /* Subbars across Portal, Dashboard, Session Logs, Server Health */
    body.dark-mode .portal-subbar,
    body.dark-mode .admin-subbar,
    body.dark-mode .sess-subbar,
    body.dark-mode .sh-subbar {
        background: #161b26 !important;
        border-bottom-color: #2d3548 !important;
    }

    body.dark-mode .portal-welcome,
    body.dark-mode .sess-title,
    body.dark-mode .sh-subbar-title {
        color: #f8fafc !important;
    }

    body.dark-mode .user-meta-pill {
        background: rgba(134, 38, 51, 0.32);
        border-color: rgba(255, 199, 44, 0.35);
        color: #fde68a;
    }

    /* Cards & Panels */
    body.dark-mode .app-card,
    body.dark-mode .security-card,
    body.dark-mode .portal-empty-card,
    body.dark-mode .kpi-box,
    body.dark-mode .kpi-card,
    body.dark-mode .panel-card,
    body.dark-mode .card,
    body.dark-mode .filter-bar,
    body.dark-mode .table-container,
    body.dark-mode .modal-dialog,
    body.dark-mode .totp-card,
    body.dark-mode .sh-kpi-card,
    body.dark-mode .sh-panel {
        background: #181e29 !important;
        border-color: #2d3548 !important;
        color: #e2e8f0 !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
    }

    body.dark-mode .app-card {
        border-top: 4px solid #ffc72c !important;
    }

    body.dark-mode .app-card:hover {
        border-color: #475569 !important;
        border-top-color: #ffc72c !important;
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5) !important;
    }

    body.dark-mode .app-icon-box {
        background: #222938;
        border-color: #334155;
    }

    body.dark-mode .app-title,
    body.dark-mode .sec-card-title,
    body.dark-mode .kpi-num,
    body.dark-mode .kpi-val,
    body.dark-mode .sh-kpi-val,
    body.dark-mode .iam-section-title,
    body.dark-mode .iam-modal-title,
    body.dark-mode .iam-user-name,
    body.dark-mode .totp-title,
    body.dark-mode .db-conn-name,
    body.dark-mode .cron-title,
    body.dark-mode .snap-ts {
        color: #f8fafc !important;
    }

    body.dark-mode .kpi-num-green { color: #4ade80 !important; }
    body.dark-mode .kpi-num-blue  { color: #38bdf8 !important; }
    body.dark-mode .kpi-num-amber { color: #fbbf24 !important; }
    body.dark-mode .kpi-num-purple { color: #c084fc !important; }

    body.dark-mode .app-sub,
    body.dark-mode .sec-card-sub,
    body.dark-mode .kpi-lbl,
    body.dark-mode .kpi-label,
    body.dark-mode .sh-kpi-title,
    body.dark-mode .sh-kpi-sub,
    body.dark-mode .iam-muted-copy,
    body.dark-mode .iam-text-muted,
    body.dark-mode .totp-sub,
    body.dark-mode .log-meta {
        color: #94a3b8 !important;
    }

    body.dark-mode .iam-field-heading,
    body.dark-mode .role-card-title {
        color: #e2e8f0 !important;
    }

    body.dark-mode .app-launch-row {
        border-top-color: #2d3548;
        color: #ffc72c;
    }

    body.dark-mode .role-pill {
        background: #222938;
        border-color: #334155;
        color: #e2e8f0;
    }

    body.dark-mode .role-pill.ferpa {
        background: rgba(245, 158, 11, 0.16);
        border-color: rgba(251, 191, 36, 0.4);
        color: #fde68a;
    }

    body.dark-mode .portal-footer {
        background: #0b0f15;
        border-top: 1px solid #1e293b;
        color: #94a3b8;
    }

    /* Tabs, Buttons & Pills */
    body.dark-mode .tab-btn,
    body.dark-mode .btn-outline,
    body.dark-mode .btn-sec,
    body.dark-mode .btn-top,
    body.dark-mode .nav-pill,
    body.dark-mode .cohort-pill,
    body.dark-mode .log-filter-btn {
        background: #1f2635 !important;
        border-color: #334155 !important;
        color: #e2e8f0 !important;
    }

    body.dark-mode .tab-btn:hover,
    body.dark-mode .btn-outline:hover,
    body.dark-mode .btn-sec:hover,
    body.dark-mode .btn-top:hover,
    body.dark-mode .nav-pill:hover,
    body.dark-mode .cohort-pill:hover,
    body.dark-mode .log-filter-btn:hover {
        background: #2a3346 !important;
        border-color: #ffc72c !important;
        color: #fde68a !important;
    }

    body.dark-mode .tab-btn.active {
        background: rgba(134, 38, 51, 0.36) !important;
        border-color: #ffc72c !important;
        color: #ffc72c !important;
        box-shadow: inset 3px 0 0 #ffc72c !important;
    }

    body.dark-mode .cohort-pill.active,
    body.dark-mode .log-filter-btn.active,
    body.dark-mode .nav-pill.active {
        background: #862633 !important;
        border-color: #ffc72c !important;
        color: #ffffff !important;
    }

    body.dark-mode .nav-pill.csv-pill {
        background: rgba(16, 185, 129, 0.16) !important;
        color: #6ee7b7 !important;
        border-color: rgba(52, 211, 153, 0.4) !important;
    }

    body.dark-mode .view-tabs,
    body.dark-mode .sh-tabs {
        background: #141923 !important;
        border-color: #2d3548 !important;
    }

    body.dark-mode .view-tab,
    body.dark-mode .sh-tab-btn {
        color: #cbd5e1 !important;
    }

    body.dark-mode .sh-tab-btn:hover {
        background: #222938 !important;
        color: #ffc72c !important;
    }

    body.dark-mode .view-tab.active,
    body.dark-mode .sh-tab-btn.active {
        background: #862633 !important;
        color: #ffffff !important;
        border-color: #ffc72c !important;
    }

    /* Inputs & Selects */
    body.dark-mode .ctrl-input,
    body.dark-mode .ctrl-select,
    body.dark-mode .ctrl,
    body.dark-mode .filter-select,
    body.dark-mode .filter-input,
    body.dark-mode .form-input {
        background: #111620 !important;
        border-color: #334155 !important;
        color: #f8fafc !important;
    }

    body.dark-mode .ctrl-input:focus,
    body.dark-mode .ctrl-select:focus,
    body.dark-mode .ctrl:focus,
    body.dark-mode .filter-select:focus,
    body.dark-mode .filter-input:focus {
        border-color: #ffc72c !important;
        outline: none;
    }

    /* Tables */
    body.dark-mode table.dir-table th,
    body.dark-mode .table-container th,
    body.dark-mode .card table th,
    body.dark-mode .db-table th {
        background: #141923 !important;
        border-bottom-color: #2d3548 !important;
        color: #cbd5e1 !important;
    }

    body.dark-mode table.dir-table td,
    body.dark-mode .table-container td,
    body.dark-mode .card table td,
    body.dark-mode .db-table td {
        border-bottom-color: #242c3d !important;
        color: #e2e8f0 !important;
    }

    body.dark-mode table.dir-table tr:hover,
    body.dark-mode .table-container tr:hover,
    body.dark-mode .card table tbody tr:hover,
    body.dark-mode .db-table tbody tr:hover {
        background: #1f2635 !important;
    }

    /* Bulk Matrix Table */
    body.dark-mode .matrix-scroll {
        border-color: #2d3548 !important;
    }

    body.dark-mode table.matrix-table td {
        background: #181e29 !important;
        border-bottom-color: #242c3d !important;
        border-right-color: #242c3d !important;
    }

    body.dark-mode table.matrix-table td.sticky-col {
        background: #141923 !important;
        border-right-color: #334155 !important;
    }

    body.dark-mode .matrix-sel {
        background: #111620 !important;
        border-color: #334155 !important;
        color: #cbd5e1 !important;
    }

    body.dark-mode .matrix-sel.has-role {
        background: rgba(59, 130, 246, 0.2) !important;
        border-color: #60a5fa !important;
        color: #bfdbfe !important;
    }

    body.dark-mode .matrix-sel.dirty {
        background: rgba(245, 158, 11, 0.24) !important;
        border-color: #fbbf24 !important;
        color: #fde68a !important;
    }

    /* Badges & Chips */
    body.dark-mode .cat-Admin    { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: rgba(248, 113, 113, 0.4); }
    body.dark-mode .cat-Faculty  { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border-color: rgba(96, 165, 250, 0.4); }
    body.dark-mode .cat-Staff    { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.4); }
    body.dark-mode .cat-External { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border-color: rgba(251, 191, 36, 0.4); }
    body.dark-mode .cat-Student,
    body.dark-mode .cat-pill     { background: #242c3d; color: #cbd5e1; border-color: #334155; }

    body.dark-mode .st-active,
    body.dark-mode .status-active,
    body.dark-mode .ev-ok,
    body.dark-mode .sh-pill.healthy {
        background: rgba(34, 197, 94, 0.2) !important;
        color: #86efac !important;
        border-color: rgba(74, 222, 128, 0.35) !important;
    }

    body.dark-mode .st-invited,
    body.dark-mode .status-logout,
    body.dark-mode .ev-info,
    body.dark-mode .sh-pill.dev {
        background: rgba(56, 189, 248, 0.2) !important;
        color: #7dd3fc !important;
        border-color: rgba(125, 211, 252, 0.35) !important;
    }

    body.dark-mode .st-suspended,
    body.dark-mode .status-terminated,
    body.dark-mode .ev-danger,
    body.dark-mode .sh-pill.critical,
    body.dark-mode .btn-end-sess {
        background: rgba(239, 68, 68, 0.2) !important;
        color: #fca5a5 !important;
        border-color: rgba(248, 113, 113, 0.4) !important;
    }

    body.dark-mode .st-inactive,
    body.dark-mode .status-ended {
        background: #242c3d !important;
        color: #94a3b8 !important;
    }

    body.dark-mode .status-idle,
    body.dark-mode .ev-warn,
    body.dark-mode .sh-pill.warning {
        background: rgba(245, 158, 11, 0.2) !important;
        color: #fcd34d !important;
        border-color: rgba(251, 191, 36, 0.35) !important;
    }

    body.dark-mode .app-chip {
        background: #222938;
        border-color: #334155;
        color: #e2e8f0;
    }

    body.dark-mode .app-chip.ferpa {
        background: rgba(245, 158, 11, 0.16);
        border-color: rgba(251, 191, 36, 0.4);
        color: #fde68a;
    }

    body.dark-mode .app-badge {
        background: rgba(134, 38, 51, 0.35);
        color: #fda4af;
    }

    body.dark-mode .auth-sso-ticket { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
    body.dark-mode .auth-sso-cookie { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
    body.dark-mode .auth-resumed    { background: #242c3d; color: #cbd5e1; }
    body.dark-mode .auth-password   { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }

    /* Subpanels, Role Grids, Alerts & Banners */
    body.dark-mode .roles-form-grid,
    body.dark-mode .iam-subpanel,
    body.dark-mode .iam-info-strip,
    body.dark-mode .qr-frame {
        background: #141923 !important;
        border-color: #2d3548 !important;
        color: #cbd5e1 !important;
    }

    body.dark-mode .role-field-card {
        background: #1b2230 !important;
        border-color: #2d3548 !important;
    }

    body.dark-mode .iam-preset-box {
        background: rgba(134, 38, 51, 0.22) !important;
        border-color: rgba(244, 63, 94, 0.35) !important;
    }

    body.dark-mode .iam-preset-label,
    body.dark-mode .totp-eyebrow {
        color: #fda4af !important;
    }

    body.dark-mode .totp-shield {
        background: rgba(134, 38, 51, 0.28) !important;
        border-color: rgba(255, 199, 44, 0.4) !important;
    }

    body.dark-mode .secret-pill {
        background: #0f141b !important;
        border-color: #334155 !important;
        color: #fde68a !important;
    }

    body.dark-mode .iam-alert-success {
        background: rgba(16, 185, 129, 0.15) !important;
        color: #6ee7b7 !important;
        border-color: rgba(52, 211, 153, 0.4) !important;
    }

    body.dark-mode .iam-alert-danger,
    body.dark-mode .iam-lockout-card {
        background: rgba(239, 68, 68, 0.14) !important;
        color: #fecaca !important;
        border-color: rgba(248, 113, 113, 0.4) !important;
    }

    body.dark-mode .iam-lockout-row {
        background: #181e29 !important;
        color: #e2e8f0 !important;
        border-color: rgba(248, 113, 113, 0.35) !important;
    }

    body.dark-mode .iam-banner-info {
        background: rgba(59, 130, 246, 0.15) !important;
        border-color: rgba(96, 165, 250, 0.4) !important;
        color: #bfdbfe !important;
    }

    body.dark-mode .iam-banner-info a {
        color: #7dd3fc !important;
    }

    body.dark-mode .iam-banner-warn {
        background: rgba(245, 158, 11, 0.14) !important;
        border-color: rgba(251, 191, 36, 0.4) !important;
        color: #fde68a !important;
    }

    body.dark-mode .iam-pre-slip {
        background: #111620 !important;
        border-color: #334155 !important;
        color: #f8fafc !important;
    }

    body.dark-mode .iam-link-primary {
        color: #ffc72c !important;
    }

    body.dark-mode .iam-link-muted {
        color: #94a3b8 !important;
    }

    body.dark-mode .iam-link-muted:hover {
        color: #f8fafc !important;
    }

    body.dark-mode .iam-card-foot {
        border-top-color: #2d3548 !important;
    }

    /* Audit & Import Rows */
    body.dark-mode .audit-ts,
    body.dark-mode .audit-ip {
        color: #94a3b8 !important;
    }

    body.dark-mode .audit-json {
        color: #cbd5e1 !important;
    }

    body.dark-mode .iam-import-report {
        border-color: #2d3548 !important;
    }

    body.dark-mode .iam-import-row {
        border-bottom-color: #242c3d !important;
    }

    body.dark-mode .iam-import-ok  { color: #4ade80 !important; }
    body.dark-mode .iam-import-err { color: #fca5a5 !important; }

    /* Server Health Specifics */
    body.dark-mode .sh-bar-track {
        background: #242c3d !important;
    }

    body.dark-mode .sh-h3 {
        color: #fde68a !important;
    }

    body.dark-mode .sh-summary-chip {
        background: #1f2635 !important;
        border-color: #334155 !important;
        color: #ffc72c !important;
    }

    body.dark-mode .log-card {
        background: #141923 !important;
        border-color: #2d3548 !important;
    }

    body.dark-mode .log-header {
        background: #1b2230 !important;
        border-bottom-color: #2d3548 !important;
    }

    body.dark-mode .log-title {
        color: #fda4af !important;
    }

    body.dark-mode .db-schema-code {
        background: #242c3d !important;
        color: #e2e8f0 !important;
    }

    body.dark-mode .db-expand-row {
        background: #141923 !important;
    }

    body.dark-mode .db-tbl-chip {
        background: #1b2230 !important;
        border-color: #2d3548 !important;
    }

    body.dark-mode .cron-card,
    body.dark-mode .guide-card {
        background: #141923 !important;
        border-color: #2d3548 !important;
    }

    body.dark-mode .guide-card {
        border-left: 4px solid #ffc72c !important;
    }

    body.dark-mode .guide-card h4 {
        color: #ffc72c !important;
    }

    body.dark-mode .guide-card p,
    body.dark-mode .guide-card li {
        color: #cbd5e1 !important;
    }

    body.dark-mode .cron-summary {
        background: #0f141b !important;
        border-color: #2d3548 !important;
        color: #cbd5e1 !important;
    }
}
