/* app.css - Enterprise UI for LAP System */

:root {
    --primary-color: #0f3a68; /* Corporate Blue */
    --secondary-color: #e65c00; /* Corporate Orange */
    --accent-color: #F9D423; /* Corporate Gold */
    --bg-color: #f4f7f6;
    --sidebar-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e6ed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --sidebar-width: 260px;
    --header-height: 70px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

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

input, select, textarea, button, input::placeholder, textarea::placeholder {
    font-family: 'Inter', 'Noto Sans Lao', sans-serif;
}

body {
    font-family: 'Inter', 'Noto Sans Lao', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden; /* App layout, no full body scroll */
}

/* === LOGIN SCREEN === */
.login-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("images/LAP System.png") no-repeat center center;
    background-size: cover;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    text-align: center;
}

.login-logo {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 58, 104, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background-color: #0c2f54;
}

/* === APP LAYOUT === */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header img {
    width: 40px;
    height: 40px;
    margin-right: 12px;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item i {
    margin-right: 15px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-item:hover, .nav-item.active {
    background-color: #f8fafc;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.header-left h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.avatar {
    width: 35px;
    height: 35px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Content Body */
.content-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background-color: var(--bg-color);
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 25px;
    margin-bottom: 25px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Status Badges */
.badge {
    display: inline-block;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-pending { background-color: #fef3c7; color: #b45309; }
.badge-approved { background-color: #d1fae5; color: #047857; }
.badge-rejected { background-color: #fee2e2; color: #b91c1c; }

/* Tables */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: #f9fafb;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-success { background-color: var(--success-color); color: white; }
.btn-success:hover { background-color: #059669; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger:hover { background-color: #dc2626; }
.btn-outline { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background-color: #f3f4f6; }

/* Grid for Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 15px;
}
.stat-info h4 {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 5px;
}
.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}
.bg-blue-light { background-color: #eff6ff; color: #3b82f6; }
.bg-green-light { background-color: #f0fdf4; color: #22c55e; }
.bg-yellow-light { background-color: #fefce8; color: #eab308; }

.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }
.screen.active.login-wrapper { display: flex; }
.screen.active.app-wrapper { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-message {
    background: white;
    color: var(--text-main);
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    padding: 15px 20px;
    width: 340px;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 5px solid var(--primary-color);
    animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    cursor: pointer;
    transition: all 0.2s;
}

.toast-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -5px rgba(0,0,0,0.15);
}

.toast-message.toast-success {
    border-left-color: var(--success-color);
}

.toast-message.toast-danger {
    border-left-color: var(--danger-color);
}

.toast-message.toast-warning {
    border-left-color: var(--warning-color);
}

.toast-icon {
    font-size: 1.2rem;
    margin-top: 2px;
    color: #475569;
}

.toast-message.toast-success .toast-icon { color: var(--success-color); }
.toast-message.toast-danger .toast-icon { color: var(--danger-color); }
.toast-message.toast-warning .toast-icon { color: var(--warning-color); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.toast-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 2px;
}

.toast-close:hover {
    color: var(--text-muted);
}

@keyframes slideInToast {
    from {
        opacity: 0;
        transform: translateX(100px) translateY(0);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

@keyframes fadeOutToast {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* === REPORTS DASHBOARD CHARTS === */
.reports-charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.chart-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}

.chart-card-title {
    margin-bottom: 15px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    font-family: 'Noto Sans Lao', 'Inter', sans-serif;
}

.chart-canvas-container {
    width: 100%;
    height: 220px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* === MOBILE RESPONSIVE UI === */

.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background-color: #f1f5f9;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        width: 260px;
        height: 100vh;
        background-color: var(--sidebar-bg);
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 100;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    }
    
    .sidebar.sidebar-open {
        left: 0;
    }
    
    .main-content {
        width: 100%;
        max-width: 100%;
    }
    
    .top-header {
        padding: 0 15px;
    }
    
    .content-body {
        padding: 15px;
    }
    
    /* Stats Grid stacking */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Reports Charts Grid stacking */
    .reports-charts-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* Forms fields alignment on mobile */
    #form-leave div[style*="display: flex"],
    #form-edit div[style*="display: flex"],
    #form-edit-staff div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    #form-leave div[style*="display: flex"] > div,
    #form-edit div[style*="display: flex"] > div,
    #form-edit-staff div[style*="display: flex"] > div {
        width: 100% !important;
        flex: none !important;
    }
    
    /* Tables sizing */
    th, td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    /* Flex layouts under staff & cars management tabs */
    #tab-staff > div[style*="display: flex"],
    #tab-cars > div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 20px !important;
    }
    
    #tab-staff > div[style*="display: flex"] > div,
    #tab-cars > div[style*="display: flex"] > div {
        width: 100% !important;
        flex: none !important;
    }
    
    /* Custom Modals size adjust on mobile */
    #edit-modal .card,
    #edit-staff-modal .card,
    #confirm-modal .card,
    #success-modal .card {
        width: calc(100% - 30px) !important;
        max-width: 100% !important;
        margin: 15px !important;
    }
}

/* === REPORTS SUB-TABS === */
.reports-tabs-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.reports-tab-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reports-tab-btn:hover {
    color: var(--primary-color);
    background-color: rgba(15, 58, 104, 0.05);
}

.reports-tab-btn.active {
    color: white;
    background-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* === USER PROFILE PICTURE STYLES === */
.avatar {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Hover overlay on top-header avatar to signal upload */
.top-header .avatar:hover::after {
    content: "\f030"; /* FontAwesome Camera icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

/* User avatar in tables */
td .avatar {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
    cursor: default; /* No hover camera pointer in tables */
}

/* Staff form avatar preview */
.staff-avatar-preview-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.staff-avatar-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Image Viewer Lightbox Modal */
.image-viewer-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-viewer-modal.active {
    display: flex;
    opacity: 1;
}

.image-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.image-viewer-modal.active .image-viewer-content {
    transform: scale(1);
}

.image-viewer-img {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border: 3px solid rgba(255, 255, 255, 0.25);
    object-fit: contain;
}

.image-viewer-close {
    position: absolute;
    top: -45px;
    right: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.image-viewer-close:hover {
    color: white;
    transform: scale(1.1);
}

.image-viewer-footer {
    display: flex;
    justify-content: center;
    width: 100%;
}

.image-viewer-btn {
    background: var(--primary-color, #2563eb);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Noto Sans Lao', 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transition: all 0.2s ease;
}

.image-viewer-btn:hover {
    background: var(--primary-dark, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-10px);} 60% {transform: translateY(-5px);} }

/* Notifications Dropdown */
.notifications-dropdown { position: absolute; top: 50px; right: 0; width: 350px; background: white; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); z-index: 1100; border: 1px solid #eee; display: flex; flex-direction: column; overflow: hidden; }
.dropdown-header { padding: 15px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
.dropdown-header h3 { margin: 0; font-size: 1rem; color: #333; display: flex; align-items: center; gap: 8px; }
.dropdown-body { max-height: 400px; overflow-y: auto; }
.notification-item { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 5px; cursor: pointer; transition: background 0.2s; }
.notification-item:hover { background: #f8fafc; }
.notification-item.unread { background: #f0fdf4; border-left: 3px solid #22c55e; }
.notification-item.unread:hover { background: #dcfce7; }
.notification-msg { font-size: 0.9rem; color: #333; line-height: 1.4; }
.notification-time { font-size: 0.75rem; color: #888; text-align: right; }
.dropdown-footer { padding: 10px; text-align: center; border-top: 1px solid #eee; background: #f8fafc; }
.dropdown-footer a { color: var(--primary-color); text-decoration: none; font-size: 0.9rem; font-weight: bold; }
.dropdown-footer a:hover { text-decoration: underline; }

/* ================================================================
   MOBILE RESPONSIVE — Professional Premium Mobile Design
   ================================================================ */
@media (max-width: 768px) {

    /* ─── ROOT & BASE ─── */
    :root {
        --header-height: 60px;
        --sidebar-width: 280px;
    }
    body { font-size: 14px; overflow-x: hidden; }

    /* ─── APP LAYOUT ─── */
    .app-wrapper { position: relative; overflow-x: hidden; width: 100vw; }
    .main-content { width: 100%; min-width: 100vw; }

    /* ─── SIDEBAR & BACKDROP ─── */
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        height: auto; width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        z-index: 9999;
        box-shadow: 5px 0 25px rgba(0,0,0,0.15);
        display: flex; flex-direction: column;
        background: #fff;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: none; position: fixed; inset: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
        z-index: 9998;
        opacity: 0; transition: opacity 0.3s ease;
    }
    .sidebar-backdrop.active { display: block; opacity: 1; }

    /* ─── HEADER ─── */
    .top-header {
        padding: 0 16px;
        height: var(--header-height);
        position: sticky; top: 0; z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 2px 10px rgba(0,0,0,0.02);
        display: flex; justify-content: space-between; align-items: center;
    }

    .header-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
    .header-left h1 {
        font-size: 1rem; font-weight: 700; color: var(--primary-color);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0;
    }

    .sidebar-toggle-btn {
        display: flex !important; align-items: center; justify-content: center;
        width: 38px; height: 38px;
        background: #f1f5f9; color: var(--primary-color);
        border: none; border-radius: 10px;
        font-size: 1.1rem; cursor: pointer; transition: all 0.2s;
    }
    .sidebar-toggle-btn:active { background: #e2e8f0; transform: scale(0.95); }

    .header-right { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
    .user-info { display: none; }
    .avatar { width: 36px; height: 36px; font-size: 0.9rem; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border: 2px solid #fff; }
    .notification-bell { font-size: 1.25rem; color: #64748b; padding: 5px; }

    /* ─── CONTENT BODY ─── */
    .content-body { padding: 16px 12px 100px; }

    /* ─── CARDS GENERAL ─── */
    .card {
        padding: 20px 16px; margin-bottom: 16px;
        border-radius: 16px; border: none;
        box-shadow: 0 4px 15px rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.05);
    }
    .card-title { font-size: 1.1rem; margin-bottom: 18px; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; }

    /* ─── DASHBOARD STATS ─── */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .stat-card {
        padding: 16px 12px !important;
        flex-direction: column !important;
        align-items: center !important; text-align: center !important;
        border-radius: 16px !important; gap: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.02);
        border: 1px solid #f8fafc;
        height: 100%; /* Make them equal height */
    }

    .stat-icon {
        width: 44px !important; height: 44px !important;
        border-radius: 12px !important; font-size: 1.1rem !important;
        margin: 0 auto 6px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }

    .stat-info { width: 100%; }
    .stat-info h4 { font-size: 0.75rem !important; color: #64748b !important; margin-bottom: 4px !important; line-height: 1.3 !important; }
    .stat-info .value { font-size: 1.75rem !important; font-weight: 800 !important; }

    /* Make 3rd card (Pending) span full width for perfect symmetry */
    .stat-card:nth-child(3) {
        grid-column: 1 / -1;
        flex-direction: row !important;
        text-align: left !important;
        padding: 16px 20px !important;
    }
    .stat-card:nth-child(3) .stat-icon { margin: 0 16px 0 0 !important; }
    .stat-card:nth-child(3) .stat-info { display: flex; align-items: center; justify-content: space-between; }
    .stat-card:nth-child(3) .stat-info h4 { margin: 0 !important; font-size: 0.9rem !important; }
    .stat-card:nth-child(3) .stat-info .value { font-size: 2rem !important; }

    /* ─── LEAVE BALANCES GRID ─── */
    #stat-leave-balances-card { grid-column: 1 / -1 !important; padding: 20px 16px !important; align-items: stretch !important; flex-direction: column !important; }
    #stat-leave-balances-card .stat-info h4 { font-size: 1.05rem !important; color: var(--primary-color) !important; text-align: left; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; margin-bottom: 16px !important; }
    
    #leave-balances-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    #leave-balances-grid > div {
        padding: 14px 10px !important;
        border-radius: 12px !important;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        box-shadow: 0 2px 5px rgba(0,0,0,0.01);
        height: 100%; display: flex; flex-direction: column; justify-content: center;
    }
    #leave-balances-grid > div > div:first-child { font-size: 0.8rem !important; font-weight: 600; margin-bottom: 6px !important; }
    #leave-balances-grid > div > div:nth-child(2) { font-size: 1.6rem !important; font-weight: 800 !important; }
    #leave-balances-grid > div > div:last-child { font-size: 0.7rem !important; color: #64748b; margin-top: 4px !important; }

    /* ─── FORMS & INPUTS ─── */
    .form-group { margin-bottom: 16px; }
    .form-label { font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 8px; }
    .form-control { padding: 12px 14px; font-size: 0.95rem; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; }
    .form-control:focus { background: #fff; box-shadow: 0 0 0 3px rgba(15, 58, 104, 0.1); }

    /* Form flex groups to stack */
    div[style*="display: flex"][style*="gap: 15px"]:not(.header-left), 
    div[style*="display:flex"][style*="gap:15px"]:not(.header-left) {
        flex-direction: column !important; gap: 12px !important;
    }

    /* ─── BUTTONS ─── */
    .btn, .btn-primary { padding: 12px; font-size: 0.95rem; border-radius: 10px; font-weight: 600; }
    
    /* ─── TABLES & LISTS ─── */
    .table-responsive { border-radius: 12px; overflow-x: auto; border: 1px solid #f1f5f9; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
    table { font-size: 0.8rem; }
    th { padding: 12px 10px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; background: #f8fafc; }
    td { padding: 12px 10px; vertical-align: middle; }
    
    /* Hide non-essential columns on mobile to prevent horizontal scroll */
    .hide-mobile { display: none !important; }
    #approvals-table td:nth-child(4), #approvals-table th:nth-child(4) { display: none; }
    #history-table td:nth-child(3), #history-table th:nth-child(3) { display: none; }
    #staff-table td:nth-child(4), #staff-table th:nth-child(4), #staff-table td:nth-child(5), #staff-table th:nth-child(5), #staff-table td:nth-child(6), #staff-table th:nth-child(6) { display: none; }

    /* ─── MODALS ─── */
    .modal-content, #confirm-modal > div, #success-modal > div, #reject-modal > div, #leave-type-modal > div {
        width: calc(100vw - 32px) !important; max-width: 100% !important;
        padding: 24px 20px !important; margin: 16px !important;
        border-radius: 20px !important; box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important;
    }

    /* ─── NOTIFICATIONS DROPDOWN ─── */
    .notifications-dropdown {
        position: fixed !important;
        width: calc(100vw - 24px) !important;
        right: 12px !important; left: 12px !important; top: 60px !important;
        border-radius: 16px !important; box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
    }
    .dropdown-body { max-height: 60vh; }

    /* ─── HALF-DAY RADIO BUTTONS ─── */
    #half-day-period-group > div { flex-direction: column !important; gap: 10px !important; }
    #half-day-period-group label { width: 100%; justify-content: flex-start !important; padding: 12px 16px !important; }

    /* ─── TOAST NOTIFICATIONS ─── */
    #toast-container { bottom: 20px; right: 16px; left: 16px; }
    .toast-message { width: 100%; border-radius: 12px; padding: 16px; }

    /* ─── REPORTS ─── */
    .reports-charts-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
}

/* ── Extra small phones (< 380px) ── */
@media (max-width: 380px) {
    .header-left h1 { font-size: 0.9rem; }
    .stat-card:nth-child(3) .stat-info .value { font-size: 1.6rem !important; }
}



/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #fff;
    color: #333;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.toast.show {
    transform: translateX(0);
    opacity: 1;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #3b82f6; }
.toast i { font-size: 1.2rem; }
.toast.success i { color: #10b981; }
.toast.error i { color: #ef4444; }
.toast.info i { color: #3b82f6; }

/* --- Skeleton Loader --- */
@keyframes skeleton-loading {
    0% { background-color: hsl(200, 20%, 80%); }
    100% { background-color: hsl(200, 20%, 95%); }
}

    100% { background-color: #2d3748; }
}
.skeleton {
    animation: skeleton-loading 1s linear infinite alternate;
    border-radius: 4px;
    width: 100%;
    height: 100%;
    min-height: 20px;
}
.skeleton-text { width: 100%; height: 16px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-text.short { width: 60%; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }


.modal-content { background-color: var(--card-bg); color: var(--text-color); }



/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 2px dashed #e2e8f0;
    margin: 20px 0;
}
.empty-state i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 15px;
}
.empty-state h4 {
    color: #475569;
    font-weight: 600;
    margin-bottom: 5px;
}
.empty-state p {
    color: #94a3b8;
    font-size: 0.95rem;
    max-width: 300px;
}

/* --- Forced Mobile Z-Index Fix --- */
@media (max-width: 768px) {
    aside.sidebar {
        z-index: 99999 !important;
    }
    div.sidebar-backdrop, #sidebar-backdrop {
        z-index: 99990 !important;
    }
}

