:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --success-dark: #059669;
    --warning-color: #f59e0b;
    --warning-dark: #d97706;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
}

body {
    background-image: url('../images/bg-suite.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden; 
}

body::before {
    display: none;
}

.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-particles span {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 15s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-30px) translateX(-10px); }
    75% { transform: translateY(-10px) translateX(20px); }
}

.navbar {
    position: sticky; 
    top: 0;           
    z-index: 1030;    
    background: rgba(37, 99, 235, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
    display: flex;
    align-items: center;
}

.navbar-brand img {
    height: 40px;
    width: auto;
    margin-right: 10px;
    border-radius: 5px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.nav-link {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-link:hover {
    color: white !important;
    transform: translateY(-1px);
}

.nav-link.active {
    color: white !important;
    border-bottom: 2px solid white;
}

.login-container {
    max-width: 400px;
    margin: 50px auto;
    position: relative;
    z-index: 1;
}

.glass-card {
    padding: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 150px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.login-subtitle {
    color: #4b5563;
    margin-bottom: 30px;
    font-weight: 400;
}

.form-label {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 5px;
}

.form-control, .form-select {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 12px 15px;
    color: var(--dark-color);
    transition: all 0.3s;
    font-weight: 500;
}

.form-control:focus, .form-select:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    color: var(--dark-color);
}

.form-control::placeholder {
    color: #6b7280;
    font-weight: 400;
}

select.form-select:invalid, 
select.form-select option[value=""], 
select.form-select option:first-child {
    color: #6b7280;
    font-weight: 400;
}

.form-control option {
    background: white;
    color: var(--dark-color);
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
    color: white;
}

.btn-success { background: var(--success-color); border: none; border-radius: 8px; padding: 8px 16px; font-weight: 500; color: white; }
.btn-success:hover { background: var(--success-dark); color: white; }

.btn-danger { background: var(--danger-color); border: none; border-radius: 8px; padding: 8px 16px; font-weight: 500; color: white; }
.btn-danger:hover { background: var(--danger-dark); color: white; }

.btn-warning { background: var(--warning-color); border: none; border-radius: 8px; padding: 8px 16px; font-weight: 500; color: white; }
.btn-warning:hover { background: var(--warning-dark); color: white; }

.btn-outline-primary { border: 2px solid var(--primary-color); color: var(--primary-color); background: white; font-weight: 600; }
.btn-outline-primary:hover { background: var(--primary-color); color: white; }

.btn-outline-success { border: 2px solid var(--success-color); color: var(--success-color); background: white; font-weight: 600; }
.btn-outline-success:hover { background: var(--success-color); color: white; }

.btn-outline-danger { border: 2px solid var(--danger-color); color: var(--danger-color); background: white; font-weight: 600; }
.btn-outline-danger:hover { background: var(--danger-color); color: white; }

.btn-outline-secondary { border: 2px solid #6c757d; color: #6c757d; background: white; font-weight: 600; }
.btn-outline-secondary:hover { background: #6c757d; color: white; }

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 24px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-label {
    color: #4b5563;
    font-weight: 500;
}

.card {
    border: none;
    border-radius: 15px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.card-header {
    background: rgba(37, 99, 235, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: white;
    border-radius: 15px 15px 0 0 !important;
    font-weight: 600;
    border: none;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.card-body { color: var(--dark-color); }
.card-title { color: var(--dark-color); font-weight: 600; }

.search-box { position: relative; }
.search-box i {
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #6b7280;
}
.search-box input {
    padding-left: 45px; background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0, 0, 0, 0.1); color: var(--dark-color);
}
.search-box input::placeholder { color: #6b7280; }

.table { color: var(--dark-color); }
.table thead th {
    background: rgba(37, 99, 235, 0.1); color: var(--dark-color); border-bottom: 2px solid rgba(0, 0, 0, 0.1); font-weight: 600;
}
.table td { border-color: rgba(0, 0, 0, 0.05); color: var(--dark-color); }
.table-hover tbody tr:hover { background: rgba(255, 255, 255, 0.5); }

.badge { padding: 8px 12px; border-radius: 20px; font-weight: 500; }

.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning-dark); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-approved { background: rgba(16, 185, 129, 0.15); color: var(--success-dark); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-rejected { background: rgba(239, 68, 68, 0.15); color: var(--danger-dark); border: 1px solid rgba(239, 68, 68, 0.3); }

.filter-section {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.notification-toast { position: fixed; top: 20px; right: 20px; z-index: 9999; min-width: 300px; }
.toast { background: white; border: 1px solid rgba(0, 0, 0, 0.1); color: var(--dark-color); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); }
.toast-header { background: #f8f9fa; color: var(--dark-color); border-bottom: 1px solid rgba(0, 0, 0, 0.05); }

.modal-content { background: white; border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 15px; color: var(--dark-color); }
.modal-header { background: var(--primary-color); border-bottom: 1px solid rgba(255, 255, 255, 0.2); color: white; border-radius: 15px 15px 0 0; }
.modal-footer { border-top: 1px solid rgba(0, 0, 0, 0.05); }

.page-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.page-logo img { height: 50px; width: auto; margin-right: 10px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1)); }
.page-logo span { font-size: 24px; font-weight: 700; color: var(--dark-color); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.slide-in { animation: slideIn 0.3s ease-out; }

.btn-purple { background: #6366f1; border: none; border-radius: 8px; padding: 12px 20px; font-weight: 600; transition: all 0.3s; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); color: white; }
.btn-purple:hover { background: #4f46e5; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4); color: white; }

.leave-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    border: 1px solid #dee2e6;
    padding: 5px;
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
}

.calendar-day {
    min-height: 40px;
    padding: 2px;
    font-size: 0.8rem;
    border: 1px solid #f8f9fa;
    position: relative;
    box-sizing: border-box;
    word-wrap: break-word;
}

/* =========================================================================
   STAT CARD COLOR OVERRIDES
========================================================================= */
#employeeStats .col-md-3:nth-child(1) .stat-icon { background: rgba(245, 158, 11, 0.1) !important; color: var(--warning-color) !important; }
#employeeStats .col-md-3:nth-child(4) .stat-icon { background: rgba(37, 99, 235, 0.1) !important; color: var(--primary-color) !important; }
#managerDashboard .row.mb-4 .col-md-4:nth-child(1) .stat-icon { background: rgba(245, 158, 11, 0.1) !important; color: var(--warning-color) !important; }
#hrDashboard .row.mb-4 .col-md-6:nth-child(1) .stat-icon { background: rgba(245, 158, 11, 0.1) !important; color: var(--warning-color) !important; }

/* =========================================================================
   MANAGER UI COLOR OVERRIDES (SOFT BADGE STYLING)
========================================================================= */
#managerDashboard > h4.text-dark {
    background-color: var(--primary-color) !important; 
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 10px !important;
    display: inline-block !important; 
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

#pendingApprovalsBody .btn-success {
    background-color: rgba(37, 99, 235, 0.15) !important;
    color: var(--primary-dark) !important;
    border: 1px solid rgba(37, 99, 235, 0.3) !important;
    box-shadow: none !important;
}
#pendingApprovalsBody .btn-success:hover {
    background-color: rgba(37, 99, 235, 0.25) !important;
    border-color: rgba(37, 99, 235, 0.4) !important;
    color: var(--primary-dark) !important;
}

#managerDashboard .card-header.bg-dark {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: var(--warning-dark) !important; 
    border-bottom: 1px solid rgba(245, 158, 11, 0.3) !important;
}

#upcomingLeaves .badge.bg-light {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: var(--warning-dark) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    box-shadow: none !important;
}

#upcomingLeaves .badge.bg-danger {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: var(--danger-dark) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    box-shadow: none !important;
}

.interactive-stat-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.interactive-stat-card .stat-content-hover {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 14px; 
    z-index: 10;
}
.interactive-stat-card:hover .stat-content-hover {
    opacity: 1;
}

/* =========================================================================
   HR UI COLOR OVERRIDES
========================================================================= */
#hrDashboard > h4.text-dark {
    background-color: var(--primary-color) !important; 
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 10px !important;
    display: inline-block !important; 
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.hr-pending-header {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: var(--warning-dark) !important; 
    border-bottom: 1px solid rgba(245, 158, 11, 0.3) !important;
}

#hrPendingApprovalsBody .btn {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: var(--warning-dark) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    box-shadow: none !important;
    font-weight: bold;
}
#hrPendingApprovalsBody .btn:hover {
    background-color: rgba(245, 158, 11, 0.25) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: var(--warning-dark) !important;
}

.hr-approved-header {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: var(--success-dark) !important;
    border-bottom: 1px solid rgba(16, 185, 129, 0.3) !important;
}

#hrApprovedLeavesBody .btn-outline-danger {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: var(--danger-dark) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    box-shadow: none !important;
    font-weight: 600 !important;
}
#hrApprovedLeavesBody .btn-outline-danger:hover {
    background-color: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: var(--danger-dark) !important;
}

#hrDashboard .card-header.bg-white {
    background-color: transparent !important; 
    background: rgba(37, 99, 235, 0.9) !important; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#hrDashboard .card-header.bg-white h6.text-dark,
#hrDashboard .card-header.bg-white i.text-primary {
    color: white !important;
}

/* =========================================================================
   REVERTED HISTORY TAB LOGIC
========================================================================= */
#historySection {
    height: calc(100vh - 100px); 
    padding-bottom: 20px;
}

#historySection .card {
    height: 100%;
    margin-bottom: 0; 
    display: flex;
    flex-direction: column;
}

.history-scroll-body {
    flex: 1 1 auto; 
    overflow-y: auto !important;
    padding-right: 15px;
}

/* =========================================================================
   DASHBOARD SCROLL LOGIC & GLOBAL SCROLL FIXES
========================================================================= */
#myLeavesWrapper {
    height: calc(100vh - 120px); 
    padding-bottom: 20px;
}

#myLeavesCard {
    height: 100%;
    margin-bottom: 0; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#myLeavesCard .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.25rem; 
}

.personal-leaves-scroll-container {
    flex: 1 1 auto; 
    overflow-y: auto !important;
    display: block !important; 
    padding: 0 !important; 
    background: white;
}

.personal-leaves-scroll-container table {
    width: 100% !important;
    margin-top: 0 !important;
}

.personal-leaves-thead th,
.table-responsive thead.table-light th {
    position: sticky !important;
    top: 0 !important; 
    z-index: 100 !important; 
    background-color: #f8f9fa !important; 
    box-shadow: 0 2px 4px -2px rgba(0,0,0,0.1); 
    border-top: none !important; 
}

/* UPDATED: Added Modal Body for uniform scrollbar branding */
.history-scroll-body::-webkit-scrollbar, 
.personal-leaves-scroll-container::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.history-scroll-body::-webkit-scrollbar-track, 
.personal-leaves-scroll-container::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}
.history-scroll-body::-webkit-scrollbar-thumb, 
.personal-leaves-scroll-container::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

select.form-select:disabled, input.form-control:disabled {
    background-color: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    border-color: #d1d5db !important;
    opacity: 0.8;
}

/* Lock the Action column width to perfectly wrap the button */
th.action-col-header, td.action-col {
    width: 1% !important;
    white-space: nowrap !important;
}

th.action-col-header {
    text-align: left !important;
}

/* =========================================================================
   RESPONSIVE MEDIA QUERIES (UPDATED FOR NEW UI)
========================================================================= */
@media (max-width: 768px) {
    .login-container { margin: 20px auto; padding: 0 15px; }
    .glass-card { padding: 30px 20px; }
    .stat-card { margin-bottom: 15px; }
    #historySection, #myLeavesWrapper { height: auto; }
    
    /* FIX: Add spacing to stacked Date inputs and Blocked button on mobile */
    #applySection .row.align-items-end > div {
        margin-bottom: 15px;
    }
    #applySection .row.align-items-end > div:last-child {
        margin-bottom: 0;
    }
    
    /* FIX: Add spacing to Admin Blackout Panel when stacked */
    #adminSection .row.mb-4.align-items-stretch .col-md-4 {
        margin-bottom: 20px;
    }
}

@media print {
    body { background: white !important; background-image: none !important; overflow: visible !important; }
    .card { background: white !important; box-shadow: none !important; border: none !important; margin: 0 !important; page-break-inside: avoid; }
    .navbar, .footer, .watermark, .filter-section, .action-col, .btn-group, button { display: none !important; }
    .history-scroll-body, .personal-leaves-scroll-container { max-height: none !important; overflow: visible !important; border: none !important; }
}

/* =========================================================================
   FIX: WHITE MOBILE MENU ICON
========================================================================= */
.navbar-toggler-icon {
    filter: invert(1) brightness(200%) !important;
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5) !important;
}

@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(37, 99, 235, 0.98); 
        padding: 15px;
        border-radius: 10px;
        margin-top: 10px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
}