/* ==============================================================================
   St. John Paul II College — Portal v2
   Modern, Lightweight, Responsive Design System (Pure Vanilla CSS)
   ============================================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-dark: #1e40af;
    --secondary: #475569;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #06b6d4;
    
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #3b82f6;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------------------
   Layout Structure
------------------------------------------------------------------------------ */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.25s ease-in-out;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-brand-text h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #fff;
}

.sidebar-brand-text span {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin: 16px 12px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.15s ease;
    margin-bottom: 3px;
}

.nav-item:hover {
    background-color: var(--bg-sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background-color: var(--bg-sidebar-active);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: #334155;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.user-meta h4 {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
}

.user-meta p {
    font-size: 11px;
    color: #94a3b8;
}

.btn-signout {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 15px;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    text-decoration: none;
}

.btn-signout:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* ------------------------------------------------------------------------------
   Main Workspace & Topbar
------------------------------------------------------------------------------ */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 64px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-main);
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.badge-session {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
}

.badge-term {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background-color: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
}

.page-body {
    padding: 28px;
    flex: 1;
}

/* ------------------------------------------------------------------------------
   Alerts & Notifications
------------------------------------------------------------------------------ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #bfdbfe;
}

.alert-close {
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* ------------------------------------------------------------------------------
   Cards & Grids
------------------------------------------------------------------------------ */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.card-body {
    padding: 20px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.metric-icon.blue { background-color: #dbeafe; color: #1e40af; }
.metric-icon.emerald { background-color: #d1fae5; color: #065f46; }
.metric-icon.indigo { background-color: #e0e7ff; color: #3730a3; }
.metric-icon.amber { background-color: #fef3c7; color: #92400e; }

.metric-data h3 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.metric-data p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ------------------------------------------------------------------------------
   Data Tables
------------------------------------------------------------------------------ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 11.5px;
    letter-spacing: 0.04em;
}

.table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-main);
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* ------------------------------------------------------------------------------
   Buttons & Inputs
------------------------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-main);
    border-color: var(--border);
}
.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}
.btn-success:hover {
    background-color: #059669;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    font-size: 13.5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: #fff;
    color: var(--text-main);
    transition: border-color 0.15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ------------------------------------------------------------------------------
   Interactive Score Sheet & Toggle Switches
------------------------------------------------------------------------------ */
.score-input {
    width: 65px;
    padding: 6px 8px;
    font-size: 13.5px;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    transition: all 0.15s;
}

.score-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    background-color: #f0fdf4;
}

.score-total {
    font-weight: 800;
    font-size: 14px;
    color: var(--text-main);
}

.badge-grade {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
}

.badge-grade.A, .badge-grade.A1 { background-color: #dcfce7; color: #166534; }
.badge-grade.B, .badge-grade.B2, .badge-grade.B3 { background-color: #dbeafe; color: #1e40af; }
.badge-grade.C, .badge-grade.C4, .badge-grade.C5, .badge-grade.C6 { background-color: #fef9c3; color: #854d0e; }
.badge-grade.P, .badge-grade.D7, .badge-grade.E8 { background-color: #fed7aa; color: #9a3412; }
.badge-grade.F, .badge-grade.F9 { background-color: #fee2e2; color: #991b1b; }

/* Switch Toggle Component */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .2s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* ------------------------------------------------------------------------------
   Responsive Breakdown
------------------------------------------------------------------------------ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
}
