/* =============================================================
   portal.css – EduPortal overrides on FlexAdmin Pro
   Loaded AFTER main.css so specificity wins without !important
   ============================================================= */

/* ── Brand tokens ─────────────────────────────────────────── */
:root {
    --portal-accent:        #2563eb;   /* blue-600 — primary action */
    --portal-accent-soft:   #eff6ff;   /* blue-50  — tinted backgrounds */
    --portal-accent-dark:   #1d4ed8;   /* blue-700 — hover */
    --portal-success:       #16a34a;
    --portal-warning:       #d97706;
    --portal-danger:        #dc2626;
    --portal-text:          #1e293b;
    --portal-muted:         #64748b;
    --portal-border:        #e2e8f0;
    --portal-surface:       #ffffff;
    --portal-bg:            #f8fafc;
    --portal-radius:        8px;
    --portal-radius-lg:     12px;
    --portal-shadow-sm:     0 1px 2px 0 rgba(0,0,0,.05);
    --portal-shadow:        0 1px 3px 0 rgba(0,0,0,.10), 0 1px 2px -1px rgba(0,0,0,.10);
}

[data-bs-theme="dark"] {
    --portal-accent-soft:   #1e3a5f;
    --portal-text:          #e2e8f0;
    --portal-muted:         #94a3b8;
    --portal-border:        #334155;
    --portal-surface:       #1e293b;
    --portal-bg:            #0f172a;
}

/* ── Page background ──────────────────────────────────────── */
body {
    background-color: var(--portal-bg);
}

/* ── Avatar initials (replaces profile image when none set) ── */
.portal-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--portal-accent);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .025em;
    flex-shrink: 0;
    user-select: none;
}
.portal-avatar-sm  { width: 28px; height: 28px; font-size: 11px; }
.portal-avatar-lg  { width: 44px; height: 44px; font-size: 16px; }

/* ── Scope context chip in header ─────────────────────────── */
.portal-scope-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--portal-accent-soft);
    color: var(--portal-accent);
    font-size: 12px;
    font-weight: 600;
    margin-left: 12px;
    flex-shrink: 0;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--portal-text);
    margin: 0;
    line-height: 1.3;
}
.page-subtitle {
    color: var(--portal-muted);
    font-size: 0.875rem;
    margin: 4px 0 0;
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.portal-breadcrumb .breadcrumb {
    font-size: 0.8rem;
    background: none;
    padding: 0;
    --bs-breadcrumb-divider: '›';
    color: var(--portal-muted);
}
.portal-breadcrumb .breadcrumb-item a {
    color: var(--portal-muted);
    text-decoration: none;
}
.portal-breadcrumb .breadcrumb-item a:hover { color: var(--portal-accent); }
.portal-breadcrumb .breadcrumb-item.active { color: var(--portal-text); }

/* ── Sidebar: accent the active item ─────────────────────── */
.sidebar .nav-link.active,
.sidebar .nav-link.active:hover {
    background-color: var(--portal-accent-soft);
    color: var(--contrast-color);
}
    .sidebar .nav-link.active .nav-icon i {
        /*color: var(--portal-accent);*/
        color: var(--contrast-color);
    }

/* ── Card defaults ────────────────────────────────────────── */
.card {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
    box-shadow: var(--portal-shadow-sm);
    background: var(--portal-surface);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--portal-border);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.9375rem;
}
.card-body { padding: 20px; }

/* ── Stat cards (KPI widgets) ─────────────────────────────── */
.portal-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
    box-shadow: var(--portal-shadow-sm);
}
.portal-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--portal-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.portal-stat-icon.blue   { background: var(--portal-accent-soft); color: var(--portal-accent); }
.portal-stat-icon.green  { background: #f0fdf4; color: var(--portal-success); }
.portal-stat-icon.amber  { background: #fffbeb; color: var(--portal-warning); }
.portal-stat-icon.red    { background: #fef2f2; color: var(--portal-danger); }
[data-bs-theme="dark"] .portal-stat-icon.green { background: #14532d; color: #86efac; }
[data-bs-theme="dark"] .portal-stat-icon.amber { background: #451a03; color: #fde68a; }
[data-bs-theme="dark"] .portal-stat-icon.red   { background: #450a0a; color: #fca5a5; }

.portal-stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--portal-text);
    line-height: 1;
}
.portal-stat-label {
    font-size: 0.8125rem;
    color: var(--portal-muted);
    margin-top: 2px;
}
.portal-stat-delta {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}
.portal-stat-delta.up   { color: var(--portal-success); }
.portal-stat-delta.down { color: var(--portal-danger); }

/* ── Progress bar row (module completion etc.) ────────────── */
.portal-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.portal-progress-row .label {
    flex: 1;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.portal-progress-row .progress {
    flex: 2;
    height: 6px;
    border-radius: 999px;
    background: var(--portal-border);
}
.portal-progress-row .progress-bar {
    border-radius: 999px;
    background: var(--portal-accent);
}
.portal-progress-row .pct {
    width: 36px;
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--portal-muted);
}

/* ── Attendance status badges ─────────────────────────────── */
.badge-present  { background: #dcfce7; color: #15803d; }
.badge-absent   { background: #fee2e2; color: #b91c1c; }
.badge-late     { background: #fef9c3; color: #a16207; }
.badge-excused  { background: #e0f2fe; color: #0369a1; }
[data-bs-theme="dark"] .badge-present  { background: #14532d; color: #86efac; }
[data-bs-theme="dark"] .badge-absent   { background: #450a0a; color: #fca5a5; }
[data-bs-theme="dark"] .badge-late     { background: #422006; color: #fde68a; }
[data-bs-theme="dark"] .badge-excused  { background: #0c4a6e; color: #7dd3fc; }

/* ── Role badge ───────────────────────────────────────────── */
.portal-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--portal-accent-soft);
    color: var(--portal-accent);
}

/* ── Table overrides ──────────────────────────────────────── */
.table {
    color: var(--portal-text);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: var(--portal-bg);
}
.table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--portal-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--portal-border);
    padding: 10px 12px;
}
.table td {
    padding: 12px;
    vertical-align: middle;
    font-size: 0.875rem;
    border-color: var(--portal-border);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--portal-accent);
    border-color: var(--portal-accent);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--portal-accent-dark);
    border-color: var(--portal-accent-dark);
}

/* ── CSV upload dropzone ──────────────────────────────────── */
.portal-dropzone {
    border: 2px dashed var(--portal-border);
    border-radius: var(--portal-radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.portal-dropzone:hover,
.portal-dropzone.drag-over {
    border-color: var(--portal-accent);
    background: var(--portal-accent-soft);
}
.portal-dropzone-icon {
    font-size: 2.5rem;
    color: var(--portal-muted);
    margin-bottom: 12px;
}
.portal-dropzone-hint {
    font-size: 0.875rem;
    color: var(--portal-muted);
    margin-top: 8px;
}

/* ── Enrollment wizard step indicator ─────────────────────── */
.portal-wizard-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 32px;
}
.portal-wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
}
.portal-wizard-step:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--portal-border);
    margin: 0 8px;
}
.portal-wizard-step.done::after  { background: var(--portal-accent); }
.portal-wizard-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid var(--portal-border);
    background: var(--portal-surface);
    color: var(--portal-muted);
    flex-shrink: 0;
    z-index: 1;
}
.portal-wizard-step.active .portal-wizard-num {
    border-color: var(--portal-accent);
    background: var(--portal-accent);
    color: #fff;
}
.portal-wizard-step.done .portal-wizard-num {
    border-color: var(--portal-accent);
    background: var(--portal-accent-soft);
    color: var(--portal-accent);
}
.portal-wizard-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--portal-muted);
    white-space: nowrap;
}
.portal-wizard-step.active .portal-wizard-label { color: var(--portal-text); }

/* ── Validation preview table (CSV import) ────────────────── */
.portal-preview-row-error td { background: #fef2f2 !important; }
[data-bs-theme="dark"] .portal-preview-row-error td { background: #450a0a !important; }
.portal-preview-error-cell {
    font-size: 0.75rem;
    color: var(--portal-danger);
    margin-top: 2px;
}

/* ── Utility: subtle section label ───────────────────────── */
.portal-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--portal-muted);
    margin-bottom: 12px;
}

/* ── Responsive tweaks ────────────────────────────────────── */
@media (max-width: 768px) {
    .page-header { flex-direction: column; }
    .page-header-actions { width: 100%; justify-content: flex-start; }
    .portal-wizard-label { display: none; }
    .portal-stat-card { padding: 16px; }
}
