/* Datamex College of Saint Adeline - School Portal Stylesheet */

/* ── Brand & Semantic Tokens ────────────────────────────────── */
:root {
    /* Brand colours (never change) */
    --navy-blue:   #001F53;
    --navy-dark:   #002A6B;
    --maroon-red:  #7A0F18;
    --maroon-hover:#8B1520;
    --gold-yellow: #F1C400;
    --leaf-green:  #0F6A2F;
    --white:       #FFFFFF;

    /* Gray scale (light mode) */
    --gray-50:  #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-900: #111827;

    /* Semantic tokens (flip in dark mode) */
    --bg-body:    #F3F4F6;
    --bg-card:    #FFFFFF;
    --bg-surface: #F9FAFB;
    --text-primary:   #111827;
    --text-secondary: #374151;
    --text-muted:     #6B7280;
    --border:       #E5E7EB;
    --border-strong:#D1D5DB;

    /* Elevation */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.22s;
}

/* ── Dark Mode Overrides ────────────────────────────────────── */
[data-theme="dark"] {
    --bg-body:    #0F172A;
    --bg-card:    #1E293B;
    --bg-surface: #263148;
    --text-primary:   #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted:     #94A3B8;
    --border:       #334155;
    --border-strong:#475569;

    --gray-50:  #1E293B;
    --gray-100: #263148;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748B;
    --gray-500: #94A3B8;
    --gray-600: #CBD5E1;
    --gray-700: #E2E8F0;
    --gray-900: #F8FAFC;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.55);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Base ───────────────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-secondary);
    line-height: 1.65;
    transition: background-color var(--duration) var(--ease),
                color var(--duration) var(--ease);
}

/* Smooth transitions for themed elements */
.card, .stat-card, .modal-content, .page-header,
table, .form-control, .login-card, thead, .badge,
.top-header, .sidebar {
    transition: background var(--duration) var(--ease),
                border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                color var(--duration) var(--ease);
}

/* ── Header ────────────────────────────────────────────────── */
.top-header {
    background: var(--maroon-red);
    color: white;
    padding: 0 2rem;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-brand img {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: contain;
}

.header-title h1 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-title p {
    font-size: 0.75rem;
    color: rgba(241, 196, 0, 0.9);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    text-align: right;
}

.user-info p {
    font-size: 0.875rem;
    margin: 0;
}

/* Dark mode toggle */
.dark-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--duration) var(--ease),
                transform var(--duration) var(--ease);
    flex-shrink: 0;
}

.dark-toggle:hover {
    background: rgba(255,255,255,0.28);
    transform: scale(1.05);
}

.dark-toggle svg {
    width: 17px;
    height: 17px;
    stroke: white;
    fill: none;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--duration) var(--ease),
                transform var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                opacity var(--duration) var(--ease);
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}

.btn-primary {
    background: var(--navy-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--navy-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,31,83,0.25);
}

.btn-secondary {
    background: var(--maroon-red);
    color: white;
}

.btn-secondary:hover {
    background: var(--maroon-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--leaf-green);
    color: white;
}

.btn-success:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--navy-blue);
    border: 2px solid var(--navy-blue);
}

.btn-outline:hover {
    background: var(--navy-blue);
    color: white;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-outline {
    color: var(--gray-200);
    border-color: var(--gray-400);
}

[data-theme="dark"] .btn-outline:hover {
    background: var(--gray-200);
    color: var(--navy-blue);

}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    width: 240px;
    height: calc(100vh - 60px);
    background: var(--navy-blue);
    color: white;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
}

/* Sidebar label (portal name at top of sidebar) */
.sidebar-label {
    padding: 1rem 1.25rem 0.625rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0.5rem 0;
    flex: 1;
}

.sidebar-menu li {
    margin: 0.125rem 0.75rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.7rem 0.875rem;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease),
                transform var(--duration) var(--ease);
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(2px);
}

.sidebar-menu a.active {
    background: var(--gold-yellow);
    color: var(--navy-blue);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(241,196,0,0.3);
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-menu a.active .sidebar-icon {
    opacity: 1;
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    margin-left: 240px;
    margin-top: 60px;
    padding: 2rem;
    min-height: calc(100vh - 60px);
    animation: fadeUp 0.3s var(--ease) both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-header {
    background: var(--bg-card);
    border-top: 3px solid var(--maroon-red);
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.page-header h2 {
    color: var(--navy-blue);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

[data-theme="dark"] .page-header h2 {
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.card-accent-gold {
    border-left: 4px solid var(--gold-yellow);
}

.card-accent-maroon {
    border-left: 4px solid var(--maroon-red);
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.875rem;
    margin-bottom: 1rem;
}

.card-header h3 {
    color: var(--navy-blue);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

[data-theme="dark"] .card-header h3 {
    color: var(--text-primary);
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold-yellow);
    transition: transform var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-left-width: 5px;
}

.stat-card.success {
    border-left-color: var(--leaf-green);
}

.stat-card.info {
    border-left-color: var(--navy-blue);
}

.stat-card.warning {
    border-left-color: #F97316;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.stat-value {
    color: var(--navy-blue);
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

[data-theme="dark"] .stat-value {
    color: var(--text-primary);
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

thead {
    background: var(--bg-surface);
    border-bottom: 2px solid var(--gold-yellow);
}

thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    color: var(--navy-blue);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

[data-theme="dark"] thead th {
    color: var(--text-secondary);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--duration) var(--ease);
}

tbody tr:hover {
    background: var(--bg-surface);
}

tbody td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Badge Styles */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #DCFCE7;
    color: var(--leaf-green);
    border: 2px solid var(--leaf-green);
}

.badge-warning {
    background: #FEF3C7;
    color: #D97706;
    border: 2px solid #F59E0B;
}

.badge-danger {
    background: #FEE2E2;
    color: var(--maroon-red);
    border: 2px solid var(--maroon-red);
}

.badge-info {
    background: #DBEAFE;
    color: var(--navy-blue);
    border: 2px solid var(--navy-blue);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--navy-blue);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

[data-theme="dark"] .form-label {
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                background var(--duration) var(--ease);
}

.form-control:focus {
    outline: none;
    border-color: var(--gold-yellow);
    box-shadow: 0 0 0 3px rgba(241, 196, 0, 0.15);
    background: var(--bg-card);
}

.form-control::placeholder {
    color: var(--gray-400);
}

select.form-control {
    cursor: pointer;
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #001545 0%, #002A6B 60%, #001F53 100%);
    padding: 2rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.08);
    animation: fadeUp 0.35s var(--ease) both;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.login-logo h1 {
    color: var(--navy-blue);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    padding: 0.875rem 1.125rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.55;
    animation: fadeUp 0.25s var(--ease) both;
}

.alert-success {
    background: #DCFCE7;
    color: var(--leaf-green);
    border-left: 4px solid var(--leaf-green);
}

.alert-error {
    background: #FEE2E2;
    color: var(--maroon-red);
    border-left: 4px solid var(--maroon-red);
}

.alert-warning {
    background: #FEF3C7;
    color: #D97706;
    border-left: 4px solid #F59E0B;
}

.alert-info {
    background: #DBEAFE;
    color: var(--navy-blue);
    border-left: 4px solid var(--navy-blue);
}

/* ── Modals ─────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.18s var(--ease) both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 2rem;
    max-width: 520px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: scaleIn 0.22s var(--ease) both;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    color: var(--navy-blue);
    font-weight: 700;
}

[data-theme="dark"] .modal-header h3 {
    color: var(--text-primary);
}

.modal-close {
    width: 30px;
    height: 30px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration) var(--ease);
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s var(--ease);
        width: 240px;
        top: 60px;
        height: calc(100vh - 60px);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .top-header {
        padding: 0.75rem 1rem;
    }

    .header-title h1 {
        font-size: 0.95rem;
    }

    .header-title p {
        display: none;
    }
}

/* ── Grid Layouts ───────────────────────────────────────────── */
.grid-2, .grid-3, .grid-4 {
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* ── Additional dark mode text fixes ────────────────────────── */
[data-theme="dark"] .card-header h4,
[data-theme="dark"] .card h4,
[data-theme="dark"] .card h3 {
    color: var(--text-primary);
}

[data-theme="dark"] tbody td {
    color: var(--text-secondary);
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] p.text-muted {
    color: var(--text-muted);
}

/* ── Dark mode card/surface fixes ───────────────────────────── */
[data-theme="dark"] .card-accent-gold {
    border-left-color: var(--gold-yellow);
}

[data-theme="dark"] .card-accent-maroon {
    border-left-color: var(--maroon-red);
}

[data-theme="dark"] .alert-success {
    background: rgba(15, 106, 47, 0.18);
    color: #4ADE80;
    border-left-color: #4ADE80;
}

[data-theme="dark"] .alert-error {
    background: rgba(122, 15, 24, 0.18);
    color: #F87171;
    border-left-color: #F87171;
}

[data-theme="dark"] .alert-warning {
    background: rgba(217, 119, 6, 0.18);
    color: #FCD34D;
    border-left-color: #FCD34D;
}

[data-theme="dark"] .alert-info {
    background: rgba(0, 31, 83, 0.35);
    color: #93C5FD;
    border-left-color: #93C5FD;
}

[data-theme="dark"] .badge-success {
    background: rgba(15,106,47,0.2);
    color: #4ADE80;
    border-color: #4ADE80;
}

[data-theme="dark"] .badge-warning {
    background: rgba(217,119,6,0.2);
    color: #FCD34D;
    border-color: #FCD34D;
}

[data-theme="dark"] .badge-danger {
    background: rgba(122,15,24,0.2);
    color: #F87171;
    border-color: #F87171;
}

[data-theme="dark"] .badge-info {
    background: rgba(0,31,83,0.35);
    color: #93C5FD;
    border-color: #93C5FD;
}

/* ── Badge tweaks ───────────────────────────────────────────── */
.badge {
    padding: 0.2rem 0.65rem;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-block;
}

/* ── Focus-visible ring ─────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--gold-yellow);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Selection ──────────────────────────────────────────────── */
::selection {
    background: rgba(241, 196, 0, 0.3);
}
