
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #1a1f36;
    --sidebar-text: #a8b2d8;
    --sidebar-active: #6c63ff;
    --accent: #6c63ff;
    --accent-light: #ede9ff;
    --topbar-h: 60px;
    --card-radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f4f6fb;
    color: #333;
    margin: 0;
}


.wrapper {
    display: flex;
    min-height: 100vh;
}


#sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    transition: transform .3s;
    z-index: 100;
}

#sidebar.collapsed { transform: translateX(-100%); }

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

.logo-icon {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    flex-shrink: 0;
}

.sidebar-header h4 { color: #fff; font-weight: 700; }

.sidebar-nav {
    list-style: none;
    padding: 16px 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0 24px 24px 0;
    margin-right: 12px;
    transition: all .2s;
    font-size: 15px;
}

.sidebar-nav li a i { width: 18px; text-align: center; }

.sidebar-nav li a:hover,
.sidebar-nav li.active a {
    background: rgba(108,99,255,.2);
    color: #fff;
}

.sidebar-nav li.active a {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}

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

.user-avatar {
    width: 36px; height: 36px;
    background: rgba(108,99,255,.3);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px;
}


#content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s;
    min-height: 100vh;
}

#content.expanded { margin-left: 0; }


.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e8eaf6;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0; z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.topbar-title {
    font-weight: 700;
    font-size: 18px;
    text-transform: capitalize;
    color: #1a1f36;
}

.search-wrap { position: relative; }
.search-wrap .search-icon {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    color: #aaa; font-size: 13px;
}


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


.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
    flex-shrink: 0;
}

.stat-icon.purple { background: #6c63ff; }
.stat-icon.blue   { background: #3b82f6; }
.stat-icon.green  { background: #10b981; }
.stat-icon.red    { background: #ef4444; }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #1a1f36;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}


.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    color: #1a1f36;
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}


.table th {
    background: #f8f9ff;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #555;
    border-bottom: 2px solid #e8eaf6;
}

.table td { vertical-align: middle; font-size: 14px; }

.badge-role {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-Admin     { background: #ede9ff; color: #6c63ff; }
.badge-Librarian { background: #e0f7fa; color: #00838f; }
.badge-Student   { background: #e8f5e9; color: #2e7d32; }
.badge-Employee  { background: #e0f7fa; color: #00838f; }

.badge-status-Active   { background: #e8f5e9; color: #2e7d32; }
.badge-status-Inactive { background: #fce4ec; color: #c62828; }

.badge-Borrowed { background: #e3f2fd; color: #1565c0; }
.badge-Returned { background: #e8f5e9; color: #2e7d32; }
.badge-Overdue  { background: #fce4ec; color: #c62828; }


.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
}
.btn-accent:hover { background: #5a52d5; color: #fff; }

.btn-action {
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 6px;
}


.form-panel {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.form-panel h5 {
    font-weight: 700;
    color: #1a1f36;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-light);
}

.form-label { font-weight: 600; font-size: 13px; color: #444; }

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}


.activity-row td:first-child { font-weight: 600; }


.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1f36 0%, #2d2f6b 100%);
    display: flex; align-items: center; justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
    width: 60px; height: 60px;
    background: var(--accent);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: #fff;
    margin: 0 auto 16px;
}


.ajax-spinner {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.5);
    z-index: 9999;
    align-items: center; justify-content: center;
}

.ajax-spinner.show { display: flex; }


@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.mobile-open { transform: translateX(0); }
    #content { margin-left: 0; }
}


/* ── Overdue row subtle highlight ── */
.table-danger-subtle td { background: rgba(239,68,68,.05) !important; }

/* ── Progress bar custom ── */
.progress { background: #f1f1f9; border-radius: 4px; }

/* ── Most borrowed medal ── */
#mostBorrowedBody .fw-bold { font-size: 16px; }

/* ── Deleted panel ── */
#deletedUsersCard, #deletedEbooksCard, #deletedBorrowsCard { border-left: 3px solid #ef4444; }
