/* ============================================
   Multi-School Management System - Main Stylesheet
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #1abc9c;
    --accent-color: #e74c3c;
    --light-bg: #f8f9fc;
    --dark-bg: #1e293b;
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 0.75rem;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    background-color: var(--light-bg);
    color: #1e293b;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--secondary-color);
    transition: var(--transition);
}

a:hover {
    color: #16a085;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* ---------- Sidebar (Fixed) ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar nav {
    margin-top: 1rem;
}

.sidebar a, .sidebar .nav-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #cbd5e1;
    transition: var(--transition);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar a i, .sidebar .nav-header i {
    width: 1.5rem;
    text-align: center;
    font-size: 1rem;
}

.sidebar a:hover, .sidebar .nav-header:hover {
    background: rgba(26, 188, 156, 0.2);
    color: white;
    padding-left: 2rem;
}

.sidebar .nav-item .sub-menu {
    display: none;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar .nav-item.active .sub-menu {
    display: block;
}

.sidebar .sub-menu a {
    padding-left: 3rem;
    font-size: 0.8rem;
    font-weight: 400;
}

.sidebar .nav-header .arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.sidebar .nav-item.active .nav-header .arrow {
    transform: rotate(90deg);
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #1e293b;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

/* ---------- Main Content Area ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s;
}

/* ---------- Top Navigation Bar ---------- */
.top-bar {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ---------- Cards ---------- */
.card {
    background: white;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
}

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

.card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 1.25rem;
}

/* Stat Cards (Dashboard) */
.stat-card {
    border-radius: 1.5rem;
    overflow: hidden;
    position: relative;
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    font-size: 4rem;
    opacity: 0.2;
    color: white;
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* Gradient backgrounds for stat cards (use as needed) */
.bg-gradient-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.bg-gradient-success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; }
.bg-gradient-warning { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; }
.bg-gradient-info { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: white; }
.bg-gradient-dark { background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%); color: white; }
.bg-gradient-danger { background: linear-gradient(135deg, #ff6b6b, #ee5a24); color: white; }

/* ---------- Tables ---------- */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #1e293b;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #e2e8f0;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #e2e8f0;
    background: #f1f5f9;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: #475569;
}

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

.table-bordered {
    border: 1px solid #e2e8f0;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #e2e8f0;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b;
    background-color: white;
    background-clip: padding-box;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    color: #1e293b;
    background-color: white;
    border-color: var(--secondary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(26, 188, 156, 0.25);
}

.form-label {
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b;
    text-align: center;
    white-space: nowrap;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 2rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    color: white;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-primary:hover {
    background-color: #16a085;
    border-color: #16a085;
    transform: translateY(-1px);
}

.btn-secondary {
    color: white;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-success {
    color: white;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-danger {
    color: white;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-warning {
    color: #1e293b;
    background-color: #ffc107;
    border-color: #ffc107;
}

.btn-info {
    color: white;
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.btn-light {
    color: #1e293b;
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

.btn-dark {
    color: white;
    background-color: #1e293b;
    border-color: #1e293b;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 1.5rem;
}

.btn-lg {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
}

.btn-outline-primary {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* ---------- Alerts ---------- */
.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffe69c;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 0;
    font-size: 1.25rem;
    cursor: pointer;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 2rem;
}

.badge-primary { background-color: var(--secondary-color); color: white; }
.badge-secondary { background-color: #6c757d; color: white; }
.badge-success { background-color: #28a745; color: white; }
.badge-danger { background-color: #dc3545; color: white; }
.badge-warning { background-color: #ffc107; color: #1e293b; }
.badge-info { background-color: #17a2b8; color: white; }
.badge-dark { background-color: #1e293b; color: white; }

/* ---------- List Groups ---------- */
.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: var(--border-radius);
}

.list-group-item {
    position: relative;
    display: block;
    padding: 0.75rem 1.25rem;
    background-color: white;
    border: 1px solid #e2e8f0;
}

.list-group-item:first-child {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.list-group-flush .list-group-item {
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 0.5rem;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: var(--secondary-color);
    background-color: white;
    border: 1px solid #e2e8f0;
}

.page-item.active .page-link {
    z-index: 1;
    color: white;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* ---------- Modals ---------- */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

/* ---------- Tabs ---------- */
.nav-tabs {
    border-bottom: 1px solid #e2e8f0;
}

.nav-tabs .nav-link {
    margin-bottom: -1px;
    background: none;
    border: 1px solid transparent;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    padding: 0.5rem 1rem;
    color: #1e293b;
}

.nav-tabs .nav-link.active {
    color: var(--secondary-color);
    background-color: white;
    border-color: #e2e8f0 #e2e8f0 white;
}

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #6c757d; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.rounded { border-radius: var(--border-radius); }
.shadow-sm { box-shadow: var(--box-shadow); }

/* ---------- Mobile Responsiveness ---------- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-toggle {
        display: block;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    .card .stat-value {
        font-size: 1.75rem;
    }
    .table-responsive {
        overflow-x: auto;
    }
}

/* ---------- Print Styles ---------- */
@media print {
    .sidebar, .top-bar, .footer, .btn, .mobile-toggle {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    body {
        background: white;
        font-size: 12pt;
    }
    a {
        text-decoration: none;
        color: black;
    }
}

/* ---------- Custom Scrollbar (Global) ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}