:root {
    /* Core Brand */
    --primary-blue: #0A3663;
    --secondary-blue: #1A5494;
    --accent-gold: #D4AF37;
    --accent-gold-light: #F6E7B2;

    /* UI Palette */
    --background-color: #F4F7FB;
    --background-soft: #EEF3F8;
    --card-surface: #FFFFFF;
    --card-surface-2: #FBFDFF;
    --border-color: #E6ECF3;

    /* Text */
    --text-primary: #142033;
    --text-secondary: #6E7D90;
    --text-muted: #94A3B8;
    --text-light: #FFFFFF;

    /* Feedback */
    --danger-red: #E74C3C;
    --success-green: #2ECC71;
    --warning-amber: #F39C12;
    --info-purple: #6C5CE7;

    /* Soft Backgrounds */
    --blue-soft: rgba(10, 54, 99, 0.08);
    --gold-soft: rgba(212, 175, 55, 0.12);
    --green-soft: rgba(46, 204, 113, 0.12);
    --red-soft: rgba(231, 76, 60, 0.10);
    --purple-soft: rgba(108, 92, 231, 0.12);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 6px 16px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 44px rgba(15, 23, 42, 0.12);

    /* Radius */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --border-radius: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(180deg, var(--background-color) 0%, var(--background-soft) 100%);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
}

/* Sidebar */
.sidebar {
    width: 270px;
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-shadow: 6px 0 24px rgba(10, 54, 99, 0.14);
    z-index: 100;
    position: relative;
}

.school-logo {
    text-align: center;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
}

.school-logo img {
    max-width: 64px;
    max-height: 64px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 10px 22px rgba(0,0,0,0.15);
}

.school-logo h2 {
    color: var(--accent-gold);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin-top: 12px;
}

.school-logo p {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 4px;
    line-height: 1.5;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    padding-top: 6px;
}

.nav-item {
    padding: 14px 18px;
    margin: 4px 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.22s ease;
    color: rgba(255, 255, 255, 0.84);
    text-decoration: none;
    font-weight: 600;
    border-radius: 14px;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--accent-gold);
    transform: translateX(3px);
}

.nav-item i {
    font-size: 1.05rem;
    width: 18px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    min-width: 0;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    height: 80px;
    padding: 0 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-xs);
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    z-index: 50;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: #FFFFFF;
    padding: 12px 16px;
    border-radius: 16px;
    width: 420px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    margin-left: 10px;
    width: 100%;
    color: var(--text-primary);
    font-size: 0.94rem;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Notification */
.notification-btn {
    position: relative;
    background: #fff;
    border: 1px solid var(--border-color);
    font-size: 1.05rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.notification-btn:hover {
    background: #F8FBFF;
    color: var(--primary-blue);
}

.badge {
    position: absolute;
    top: -5px;
    right: -6px;
    background-color: var(--danger-red);
    color: white;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px !important;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(231, 76, 60, 0.22);
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
}

.user-info {
    min-width: 0;
}

.user-info div:first-child {
    color: var(--text-primary);
}

.user-info div:last-child {
    color: var(--text-secondary);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--accent-gold), #C89B12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 10px 18px rgba(200, 155, 18, 0.18);
}

/* Page Content */
.page-container {
    padding: 28px;
    flex-grow: 1;
    overflow-y: auto;
}

.page-title {
    font-size: 1.9rem;
    color: var(--text-primary);
    margin-bottom: 24px;
    font-weight: 800;
    letter-spacing: -0.6px;
}

/* Stats */
.stats-grid,
.dashboard-grid,
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card,
.card-mini {
    background-color: var(--card-surface);
    padding: 22px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card::after,
.card-mini::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    right: -28px;
    top: -28px;
    border-radius: 50%;
    background: rgba(10, 54, 99, 0.04);
}

.stat-card:hover,
.card-mini:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon,
.mini-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background-color: var(--blue-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--primary-blue);
    flex-shrink: 0;
}

.stat-card.gold .stat-icon,
.card-mini.gold .mini-icon {
    background-color: var(--gold-soft);
    color: var(--accent-gold);
}

.stat-card.success .stat-icon,
.card-mini.success .mini-icon {
    background-color: var(--green-soft);
    color: var(--success-green);
}

.stat-card.danger .stat-icon,
.card-mini.danger .mini-icon {
    background-color: var(--red-soft);
    color: var(--danger-red);
}

.stat-card.purple .stat-icon,
.card-mini.purple .mini-icon {
    background-color: var(--purple-soft);
    color: var(--info-purple);
}

.stat-info h3,
.card-mini h4,
.stat-label {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 7px;
    font-weight: 600;
}

.stat-info .value,
.card-mini p,
.stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.8px;
}

.mini-note,
.stat-hint {
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Sections */
.data-section {
    background-color: var(--card-surface);
    border-radius: var(--border-radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: -0.3px;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    border: none;
    padding: 11px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 10px 20px rgba(10, 54, 99, 0.16);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(10, 54, 99, 0.20);
}

.btn-outline-soft,
.btn-outline {
    background: white;
    color: var(--primary-blue);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.btn-outline-soft:hover,
.btn-outline:hover {
    background: #F8FBFF;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 16px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

th {
    background-color: #F8FAFC;
    color: #475569;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tbody tr:hover td,
tr:hover td {
    background-color: rgba(10, 54, 99, 0.02);
}

/* Status */
.status {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status.issued {
    background-color: rgba(10, 54, 99, 0.08);
    color: var(--primary-blue);
}

.status.overdue {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--danger-red);
}

.status.pending {
    background-color: var(--accent-gold-light);
    color: #9a6c00;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.92rem;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dbe3ec;
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.94rem;
    background: white;
    color: var(--text-primary);
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(10, 54, 99, 0.08);
}

/* Cards / Utility */
.book-card,
.school-card,
.login-card {
    background: var(--card-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.book-card:hover,
.school-card:hover {
    box-shadow: var(--shadow-md);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2rem;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.58);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal-content,
.modal-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    padding: 26px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 1100px) {
    .header {
        padding: 0 18px;
    }

    .page-container {
        padding: 20px;
    }

    .search-bar {
        width: 300px;
    }
}

@media (max-width: 900px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 10px 0;
    }

    .main-content {
        width: 100%;
    }

    .header {
        height: auto;
        padding: 14px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-bar {
        width: 100%;
    }

    .header-actions {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .page-container {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .stats-grid,
    .dashboard-grid,
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .stat-card,
    .card-mini {
        padding: 18px;
    }

    .page-title {
        font-size: 1.55rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}