/* ============================================================
   School Leave Management System — Global Styles
   Bootstrap 5.3 base + custom government-feel theme
   ============================================================ */

/* --- CSS Variables ---------------------------------------- */
:root {
    --primary:       #1a3c6e;
    --primary-dark:  #122d54;
    --primary-light: #2a5298;
    --secondary:     #f4f6f9;
    --accent:        #e74c3c;
    --success:       #27ae60;
    --warning:       #f39c12;
    --info:          #2980b9;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --font-main:     'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background-color: var(--secondary);
    color: #333;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* --- Login Page ------------------------------------------- */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #3d6bb5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    color: #fff;
}

.login-header img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.4);
    margin-bottom: .75rem;
    object-fit: cover;
}

.login-header h5 {
    font-size: .85rem;
    font-weight: 400;
    opacity: .85;
    margin: 0;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.login-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: .25rem 0 0;
}

.login-body { padding: 2rem; }

.login-body .form-label { font-weight: 600; font-size: .875rem; }

.login-body .form-control {
    border-radius: 8px;
    padding: .6rem 1rem;
    border: 1.5px solid #dee2e6;
    transition: border-color .2s, box-shadow .2s;
}

.login-body .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,60,110,.15);
}

.btn-login {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: .7rem 2rem;
    font-weight: 600;
    width: 100%;
    font-size: 1rem;
    transition: background .2s, transform .1s;
}

.btn-login:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

.login-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: .75rem;
    text-align: center;
    font-size: .78rem;
    color: #6c757d;
}

/* --- Layout: Sidebar + Content ---------------------------- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1040;
    transition: transform .3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
    min-height: var(--topbar-height);
}

.sidebar-brand img {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-text .brand-title {
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
}
.sidebar-brand-text .brand-sub {
    font-size: .68rem;
    color: rgba(255,255,255,.6);
}

.sidebar-menu { flex: 1; padding: .75rem 0; }

.sidebar-section-title {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.4);
    padding: 1rem 1.2rem .35rem;
    font-weight: 600;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.2rem;
    color: rgba(255,255,255,.78);
    font-size: .875rem;
    border-left: 3px solid transparent;
    transition: all .15s;
    cursor: pointer;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-left-color: #fff;
    text-decoration: none;
}

.sidebar-item i { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-item .badge { margin-left: auto; }

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.12);
    padding: .75rem 1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: rgba(255,255,255,.85);
    font-size: .8rem;
}

.sidebar-user .avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; color: #fff;
    flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; overflow: hidden; }
.sidebar-user .user-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: .7rem; opacity: .65; }

/* --- Main Content ----------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 1rem;
}

.topbar-toggle {
    background: none;
    border: none;
    color: #555;
    font-size: 1.1rem;
    cursor: pointer;
    padding: .35rem;
    border-radius: 6px;
    display: none;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: .5rem; }

.notif-btn {
    position: relative;
    background: none;
    border: none;
    color: #555;
    font-size: 1.1rem;
    cursor: pointer;
    padding: .4rem .5rem;
    border-radius: 8px;
    transition: background .15s;
}

.notif-btn:hover { background: #f0f0f0; }

.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--accent);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    width: 17px; height: 17px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

.page-content { padding: 1.5rem; flex: 1; }

/* --- Page Header ------------------------------------------ */
.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header-text h4 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.page-header-text p {
    font-size: .82rem;
    color: #6c757d;
    margin: .2rem 0 0;
}

/* --- Summary Cards ---------------------------------------- */
.summary-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform .2s, box-shadow .2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.summary-card.card-success { border-left-color: var(--success); }
.summary-card.card-warning { border-left-color: var(--warning); }
.summary-card.card-danger  { border-left-color: var(--accent);  }
.summary-card.card-info    { border-left-color: var(--info);    }

.summary-card .card-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.summary-card.card-primary .card-icon { background: rgba(26,60,110,.12); color: var(--primary); }
.summary-card.card-success .card-icon { background: rgba(39,174,96,.12); color: var(--success); }
.summary-card.card-warning .card-icon { background: rgba(243,156,18,.12); color: var(--warning); }
.summary-card.card-danger  .card-icon { background: rgba(231,76,60,.12);  color: var(--accent);  }
.summary-card.card-info    .card-icon { background: rgba(41,128,185,.12); color: var(--info);    }

.summary-card .card-body { flex: 1; }
.summary-card .card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #222;
    line-height: 1;
    margin-bottom: .2rem;
}
.summary-card .card-label { font-size: .8rem; color: #6c757d; font-weight: 500; }

/* --- Content Cards ---------------------------------------- */
.content-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.content-card .card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.content-card .card-header h6 {
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.content-card .card-body { padding: 1.25rem; }

/* --- Status Badges ---------------------------------------- */
.badge { font-size: .72rem; padding: .35em .6em; }

/* --- Forms ------------------------------------------------ */
.form-label { font-weight: 600; font-size: .875rem; color: #444; }
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    padding: .5rem .85rem;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,60,110,.12);
}
.form-text { font-size: .78rem; }

/* CSC Form style */
.csc-form-header {
    text-align: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.csc-form-header h5 {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: .1rem;
}
.csc-form-header p { font-size: .8rem; color: #555; margin: 0; }

.csc-section {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    position: relative;
}
.csc-section-label {
    position: absolute;
    top: -11px; left: 12px;
    background: #fff;
    padding: 0 6px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* --- Leave Balance Pills ----------------------------------- */
.balance-pill {
    background: #f8f9fa;
    border-radius: 10px;
    padding: .75rem 1rem;
    border: 1.5px solid #e9ecef;
    text-align: center;
    transition: border-color .2s;
}
.balance-pill:hover { border-color: var(--primary); }
.balance-pill .balance-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.balance-pill .balance-label { font-size: .73rem; color: #6c757d; font-weight: 600; }
.balance-pill.low .balance-value { color: var(--accent); }
.balance-pill.low { border-color: rgba(231,76,60,.3); background: rgba(231,76,60,.04); }

/* --- Tables ----------------------------------------------- */
.table th {
    background: #f8f9fa;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #555;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}
.table td { font-size: .875rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fbff; }

/* DataTables overrides */
div.dataTables_wrapper div.dataTables_filter input {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    padding: .35rem .75rem;
    margin-left: .5rem;
}
div.dataTables_wrapper div.dataTables_length select {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    padding: .25rem .5rem;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button {
    border-radius: 6px !important;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

/* --- Buttons ---------------------------------------------- */
.btn-primary  { background: var(--primary);  border-color: var(--primary);  }
.btn-primary:hover  { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn { border-radius: 8px; font-size: .875rem; font-weight: 600; }
.btn-sm { font-size: .78rem; }

/* --- Charts container ------------------------------------- */
.chart-wrapper { position: relative; height: 280px; }
.chart-wrapper canvas { width: 100% !important; }

/* --- Notification dropdown -------------------------------- */
.notif-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
    font-size: .875rem;
}
.notif-item {
    padding: .65rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background .15s;
}
.notif-item:hover { background: #f8f9fa; }
.notif-item.unread { background: #f0f5ff; border-left: 3px solid var(--primary); }
.notif-item .notif-time { font-size: .7rem; color: #aaa; }

/* --- Breadcrumb ------------------------------------------- */
.breadcrumb { font-size: .8rem; }
.breadcrumb-item.active { color: #6c757d; }

/* --- Mobile responsive ------------------------------------ */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.2); }
    .main-content { margin-left: 0; }
    .topbar-toggle { display: flex; }
    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1039;
    }
    .sidebar-overlay.active { display: block; }
}

@media (max-width: 575.98px) {
    .page-content { padding: 1rem; }
    .summary-card { padding: 1rem; }
    .summary-card .card-value { font-size: 1.4rem; }
    .chart-wrapper { height: 220px; }
}

/* --- Utility ---------------------------------------------- */
.text-primary-custom { color: var(--primary) !important; }
.bg-primary-custom   { background: var(--primary) !important; }
.fw-600 { font-weight: 600; }
.border-radius-10 { border-radius: 10px; }
.transition-all { transition: all .2s; }

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c9d2; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aab4; }
