/* ══════════════════════════════════════════════════
   MSU System Access Portal — AdminLTE-style CSS
   ══════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────── */
:root {
    /* Brand palette */
    --sap-ink:        #1A1A2E;
    --sap-primary:    #2A28D7;
    --sap-primary-h:  #1F1DCF;
    --sap-accent:     #3FA3FF;
    --sap-highlight:  #E9FF4E;

    /* Sidebar */
    --sb-bg:          #1E0C6B;
    --sb-bg-dark:     #150944;
    --sb-text:        rgba(255,255,255,0.80);
    --sb-text-muted:  rgba(255,255,255,0.45);
    --sb-active-bg:   rgba(255,255,255,0.12);
    --sb-hover-bg:    rgba(255,255,255,0.07);
    --sb-width:       260px;
    --sb-collapsed:   72px;

    /* Topbar */
    --tb-height:      56px;
    --tb-bg:          #ffffff;
    --tb-border:      #e9ecef;

    /* Content */
    --sap-bg:         #f4f6f9;   /* AdminLTE page background */
    --sap-card:       #ffffff;
    --sap-border:     #dee2e6;
    --sap-muted:      #6c757d;
    --sap-radius:     0.375rem;

    /* Bootstrap overrides */
    --bs-primary:         var(--sap-primary);
    --bs-link-color:      var(--sap-primary);
    --bs-link-hover-color: var(--sap-ink);
}

/* ── Reset / Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 0.9375rem;
    background: var(--sap-bg);
    color: #212529;
}

/* ══════════════════════════════════════════════════
   AUTHENTICATED LAYOUT
   ══════════════════════════════════════════════════ */

/* ── Sidebar ────────────────────────────────────── */
.alt-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sb-width);
    height: 100vh;
    background: var(--sb-bg);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, transform 0.25s ease;
    z-index: 1050;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.alt-sidebar::-webkit-scrollbar { width: 4px; }
.alt-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Brand ─────────────────────────── */
.alt-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--tb-height);
    flex-shrink: 0;
}
.alt-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.alt-brand-text { overflow: hidden; white-space: nowrap; }
.alt-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.alt-brand-sub {
    font-size: 0.72rem;
    color: var(--sb-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.alt-sidebar-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--sb-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: none;
}
@media (max-width: 991.98px) { .alt-sidebar-close { display: block; } }

/* Nav ───────────────────────────── */
.alt-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.alt-nav-section { display: flex; flex-direction: column; gap: 2px; }
.alt-nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sb-text-muted);
    padding: 0 12px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
}
.alt-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--sb-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
}
.alt-nav-item:hover {
    background: var(--sb-hover-bg);
    color: #fff;
}
.alt-nav-item.active {
    background: var(--sb-active-bg);
    color: #fff;
    font-weight: 600;
}
.alt-nav-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.alt-nav-text { flex: 1; font-size: 0.9rem; }

/* Sidebar Footer ────────────────── */
.alt-sidebar-footer {
    padding: 12px 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.alt-sidebar-footer-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sb-text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
}
.alt-sidebar-footer-link {
    font-size: 0.8rem;
    color: var(--sb-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    display: block;
}
.alt-sidebar-footer-link:hover { color: #fff; }

/* ── Wrapper (right side) ───────────────────────── */
.alt-wrapper {
    margin-left: var(--sb-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

/* ── Topbar ─────────────────────────────────────── */
.alt-topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--tb-height);
    background: var(--tb-bg);
    border-bottom: 1px solid var(--tb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.alt-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.alt-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.alt-toggle-btn {
    background: transparent;
    border: 1px solid var(--sap-border);
    border-radius: 6px;
    color: #495057;
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.alt-toggle-btn:hover { background: var(--sap-bg); color: var(--sap-primary); }

.alt-page-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
}
.alt-topbar-btn {
    background: transparent;
    border: 1px solid var(--sap-border);
    border-radius: 6px;
    color: #495057;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.alt-topbar-btn:hover { background: var(--sap-bg); color: var(--sap-primary); }

/* User button */
.alt-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--sap-border);
    border-radius: 999px;
    padding: 4px 12px 4px 4px;
    color: #212529;
    font-size: 0.875rem;
    transition: background 0.15s;
}
.alt-user-btn:hover { background: var(--sap-bg); }
.alt-user-btn::after { display: none; } /* hide BS caret—we add our own */
.alt-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--sap-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.alt-user-name { font-weight: 500; }
.alt-chevron { font-size: 0.65rem; color: var(--sap-muted); }
.alt-dropdown-menu { min-width: 200px; border-radius: 8px; border-color: var(--sap-border); }
.alt-dropdown-header { padding: 10px 16px 8px; }

/* ── Content ────────────────────────────────────── */
.alt-content {
    flex: 1;
    padding: 1.25rem 1.5rem 2rem;
    min-width: 0;
}

/* ── Sidebar overlay (mobile) ───────────────────── */
.alt-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1040;
    transition: opacity 0.2s;
}
.alt-overlay.show { display: block; }

/* ── Collapsed sidebar (desktop toggle) ─────────── */
body.sidebar-collapsed .alt-sidebar { width: var(--sb-collapsed); overflow: visible; }
body.sidebar-collapsed .alt-sidebar .alt-brand-text,
body.sidebar-collapsed .alt-sidebar .alt-nav-label,
body.sidebar-collapsed .alt-sidebar .alt-nav-text,
body.sidebar-collapsed .alt-sidebar .alt-sidebar-footer-label,
body.sidebar-collapsed .alt-sidebar .alt-sidebar-footer-link,
body.sidebar-collapsed .alt-sidebar .alt-sidebar-footer { display: none; }
body.sidebar-collapsed .alt-sidebar .alt-brand { justify-content: center; padding: 16px 0; }
body.sidebar-collapsed .alt-sidebar .alt-nav-item {
    justify-content: center;
    padding: 10px 0;
    width: 100%;
}
body.sidebar-collapsed .alt-sidebar .alt-nav-icon { font-size: 1.25rem; }
body.sidebar-collapsed .alt-wrapper { margin-left: var(--sb-collapsed); }

/* Hover-expand when collapsed */
body.sidebar-collapsed .alt-sidebar:hover { width: var(--sb-width); overflow-y: auto; overflow-x: hidden; }
body.sidebar-collapsed .alt-sidebar:hover .alt-brand-text,
body.sidebar-collapsed .alt-sidebar:hover .alt-nav-label,
body.sidebar-collapsed .alt-sidebar:hover .alt-nav-text,
body.sidebar-collapsed .alt-sidebar:hover .alt-sidebar-footer-label,
body.sidebar-collapsed .alt-sidebar:hover .alt-sidebar-footer-link,
body.sidebar-collapsed .alt-sidebar:hover .alt-sidebar-footer { display: block; }
body.sidebar-collapsed .alt-sidebar:hover .alt-brand { justify-content: flex-start; padding: 16px 14px; }
body.sidebar-collapsed .alt-sidebar:hover .alt-nav-item { justify-content: flex-start; padding: 9px 12px; }
body.sidebar-collapsed .alt-sidebar:hover .alt-nav-icon { font-size: 1rem; }

/* ── Mobile sidebar ─────────────────────────────── */
@media (max-width: 991.98px) {
    .alt-sidebar {
        transform: translateX(-100%);
        width: var(--sb-width) !important;
    }
    .alt-sidebar.open { transform: translateX(0); }
    .alt-wrapper { margin-left: 0 !important; }
    .alt-content { padding: 1rem; }
}

/* ══════════════════════════════════════════════════
   UNAUTHENTICATED (guest) LAYOUT
   ══════════════════════════════════════════════════ */
.alt-guest-main { min-height: 100vh; }

/* ══════════════════════════════════════════════════
   COMPONENT OVERRIDES
   ══════════════════════════════════════════════════ */

/* Cards */
.card {
    border: 1px solid var(--sap-border);
    border-radius: var(--sap-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--sap-border);
    font-weight: 600;
}

/* Gradient card header (used in auth views) */
.sap-auth-header {
    background: linear-gradient(135deg, var(--sap-ink), var(--sap-primary)) !important;
    border-bottom: 0;
}

/* Tables */
.table { --bs-table-border-color: var(--sap-border); }

/* Buttons */
.btn-primary {
    --bs-btn-bg: var(--sap-primary);
    --bs-btn-border-color: var(--sap-primary);
    --bs-btn-hover-bg: var(--sap-primary-h);
    --bs-btn-hover-border-color: var(--sap-primary-h);
    --bs-btn-active-bg: #1A19B5;
    --bs-btn-active-border-color: #1A19B5;
}
.btn-outline-primary {
    --bs-btn-color: var(--sap-primary);
    --bs-btn-border-color: var(--sap-primary);
    --bs-btn-hover-bg: rgba(42,40,215,0.08);
    --bs-btn-hover-border-color: var(--sap-ink);
    --bs-btn-hover-color: var(--sap-ink);
}

/* Alerts */
.alert { border-radius: var(--sap-radius); }

/* Info/stat boxes (AdminLTE-style small box) */
.alt-info-box {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: var(--sap-radius);
    border: 1px solid var(--sap-border);
    padding: 14px 16px;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.alt-info-box-icon {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.alt-info-box-icon.bg-primary   { background: rgba(42,40,215,0.12); color: var(--sap-primary); }
.alt-info-box-icon.bg-success   { background: rgba(25,135,84,0.12);  color: #198754; }
.alt-info-box-icon.bg-warning   { background: rgba(255,193,7,0.15);  color: #b48a00; }
.alt-info-box-icon.bg-danger    { background: rgba(220,53,69,0.12);  color: #dc3545; }
.alt-info-box-number { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.alt-info-box-label  { font-size: 0.8rem; color: var(--sap-muted); margin-top: 2px; }

/* Select2 override */
.select2-container--default .select2-selection--single {
    height: 38px;
    border-color: #ced4da;
    border-radius: 6px;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }

/* ── Custom Color Utilities ────────────────────── */
.bg-indigo { background-color: #6610f2 !important; }
.text-indigo { color: #6610f2 !important; }
.card-indigo.card-outline { border-top: 3px solid #6610f2; }

.bg-orange { background-color: #fd7e14 !important; }
.text-orange { color: #fd7e14 !important; }
.card-orange.card-outline { border-top: 3px solid #fd7e14; }

.bg-teal { background-color: #20c997 !important; }
.text-teal { color: #20c997 !important; }
.card-teal.card-outline { border-top: 3px solid #20c997; }

/* Indigo variant for info boxes */
.alt-info-box-icon.bg-indigo { background: rgba(102, 16, 242, 0.12); color: #6610f2; }
.alt-info-box-icon.bg-orange { background: rgba(253, 126, 20, 0.12); color: #fd7e14; }
.alt-info-box-icon.bg-teal   { background: rgba(32, 201, 151, 0.12); color: #20c997; }

/* Custom Buttons */
.btn-indigo {
    background-color: #6610f2;
    border-color: #6610f2;
    color: #ffffff !important;
}
.btn-indigo:hover {
    background-color: #520dc2;
    border-color: #520dc2;
    color: #ffffff !important;
}

.btn-orange {
    background-color: #fd7e14;
    border-color: #fd7e14;
    color: #ffffff !important;
}
.btn-orange:hover {
    background-color: #e46a02;
    border-color: #e46a02;
    color: #ffffff !important;
}

.btn-teal {
    background-color: #20c997;
    border-color: #20c997;
    color: #ffffff !important;
}
.btn-teal:hover {
    background-color: #1aa67e;
    border-color: #1aa67e;
    color: #ffffff !important;
}
