/* ============================================================
   EduSphere Cloud — Global CSS
   Design principle: clean, flat, professional SaaS.
   No gradients. Solid colors, clear hierarchy, mobile-first.
   ============================================================ */

:root {
    --blue: #0061FF;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --purple: #7c3aed;
    --teal: #00A3FF;
    --slate: #475569;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, .07), 0 2px 4px rgba(0, 0, 0, .05);
}

/* ── Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: .9rem;
    line-height: 1.6;
}

/* ── Cards ── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card);
    overflow: hidden;
}

.card-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}

.card-body {
    padding: 20px;
}

/* ── Stat Cards ── */
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 4px solid var(--blue);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.blue {
    border-left-color: var(--blue);
}

.stat-card.green {
    border-left-color: var(--green);
}

.stat-card.amber {
    border-left-color: var(--amber);
}

.stat-card.red {
    border-left-color: var(--red);
}

.stat-card.purple {
    border-left-color: var(--purple);
}

.stat-card.teal {
    border-left-color: var(--teal);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-card.blue .stat-icon {
    background: rgba(0, 97, 255, 0.1);
    color: var(--blue);
}

.stat-card.green .stat-icon {
    background: #f0fdf4;
    color: var(--green);
}

.stat-card.amber .stat-icon {
    background: #fffbeb;
    color: var(--amber);
}

.stat-card.red .stat-icon {
    background: #fef2f2;
    color: var(--red);
}

.stat-card.purple .stat-icon {
    background: #f5f3ff;
    color: var(--purple);
}

.stat-card.teal .stat-icon {
    background: rgba(0, 163, 255, 0.1);
    color: var(--teal);
}

.stat-info .stat-label {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: 2px;
}

.stat-info .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-info .stat-sub {
    font-size: .75rem;
    color: var(--muted);
    margin-top: 4px;
}

/* ── Mobile Stat Card Adjustments ── */
@media (max-width: 767px) {
    .stat-card {
        padding: 15px;
        gap: 12px;
        flex-wrap: wrap; /* Allows text to wrap or icon to stack if needed */
        align-items: center;
    }
    
    .stat-info {
        flex: 1;
        min-width: 0; /* Prevents flex children from overflowing parent */
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .stat-info .stat-value {
        font-size: 1.15rem;
        word-break: break-all;
        line-height: 1.2;
        display: block;
        width: 100%; /* Forces value to take full width of info container */
    }
    .stat-info .stat-label {
        font-size: .65rem;
        margin-bottom: 2px;
        display: block;
    }
    
    /* Specific fix for col-12 cards on mobile */
    .col-12 .stat-card {
        padding: 18px;
    }
}

/* Extra small screens fix (for extremely long UGX figures) */
@media (max-width: 380px) {
    .stat-info .stat-value {
        font-size: 1.05rem;
    }
    .stat-card {
        padding: 12px;
        gap: 10px;
    }
    .stat-icon {
        width: 32px;
        height: 32px;
    }
}

/* ── Student Photo Standards ── */
.student-avatar-frame {
    width: 35mm;
    height: 45mm;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid #fff;
    box-shadow: var(--shadow);
    background: #f8fafc;
}

.student-avatar-thumb {
    width: 40px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #f8fafc;
}

/* ── Buttons ── */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: .855rem;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
}

.btn-success {
    background: var(--green);
    border-color: var(--green);
}

.btn-warning {
    background: var(--amber);
    border-color: var(--amber);
    color: #fff;
}

.btn-danger {
    background: var(--red);
    border-color: var(--red);
}

.btn-sm {
    font-size: .78rem;
    padding: .3rem .7rem;
}

/* ── Tables ── */
.table {
    font-size: .865rem;
}

.table thead th {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

.table td {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

/* ── Mobile card-table (used on small screens) ── */
@media (max-width: 767px) {
    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table tbody tr {
        display: block;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 12px;
        padding: 14px 16px;
        box-shadow: var(--shadow);
    }

    .mobile-card-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
        font-size: .84rem;
    }

    .mobile-card-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: var(--muted);
        flex: 0 0 45%;
    }

    .mobile-card-table tbody td:last-child {
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px solid var(--border);
        justify-content: flex-end;
        gap: 8px;
    }

    .mobile-card-table tbody td:last-child::before {
        display: none;
    }
}

/* ── Badges ── */
.badge {
    font-size: .72rem;
    font-weight: 600;
    padding: .3em .65em;
    border-radius: 6px;
}

/* ── Forms ── */
.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .875rem;
    padding: .5rem .85rem;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    outline: none;
}

.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--slate);
    margin-bottom: .35rem;
}

/* ── Alert ── */
.alert {
    border-radius: var(--radius);
    border: none;
    font-size: .875rem;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
}

/* ── Section titles ── */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--blue);
    display: inline-block;
    margin-bottom: 16px;
}

/* ── Page header (inside topbar) ── */
.page-heading {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.page-heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Charts ── */
.chart-card {
    padding: 20px;
}

/* ── Activity feed ── */
.activity-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    flex-shrink: 0;
    background: rgba(0, 97, 255, 0.1);
    color: var(--blue);
}

.activity-text {
    font-size: .82rem;
    color: var(--text);
}

.activity-time {
    font-size: .72rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ── Empty states ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 2.5rem;
    opacity: .35;
    margin-bottom: 12px;
    display: block;
}

/* ── Pagination ── */
.page-link {
    border-radius: 6px !important;
    font-size: .8rem;
}

.page-item.active .page-link {
    background: var(--blue);
    border-color: var(--blue);
}

/* ── Utility ── */
.text-blue {
    color: var(--blue) !important;
}

.text-green {
    color: var(--green) !important;
}

.text-amber {
    color: var(--amber) !important;
}

.text-red {
    color: var(--red) !important;
}

.text-slate {
    color: var(--slate) !important;
}

.text-muted {
    color: var(--muted) !important;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.rounded-10 {
    border-radius: 10px;
}

/* ── Height Utilities ── */
.h-8 {
    height: 2rem !important;
}

.h-10 {
    height: 2.5rem !important;
}

.h-12 {
    height: 3rem !important;
}

.h-16 {
    height: 4rem !important;
}

/* ── Mobile padding fixes ── */
@media (max-width: 575px) {
    .card-body {
        padding: 14px;
    }

    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .px-3 {
        padding-left: .85rem !important;
        padding-right: .85rem !important;
    }

    h1,
    h2 {
        font-size: 1.2rem;
    }
}

/* ── border-left helpers used on old cards kept for back-compat ── */
.border-left-primary {
    border-left: 4px solid var(--blue) !important;
}

.border-left-success {
    border-left: 4px solid var(--green) !important;
}

.border-left-warning {
    border-left: 4px solid var(--amber) !important;
}

.border-left-danger {
    border-left: 4px solid var(--red) !important;
}

.dashboard-card {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}