:root {
    /* Official JCI Palette */
    --jci-blue: #0097D7;
    --jci-black: #130F2D; 
    --white: #FFFFFF;
    --jci-navy: #1F4789;
    --jci-teal: #57BCBC;
    --jci-yellow: #EFC40F;

    /* UI Neutrals */
    --bg-slate: #F8FAFC;
    --border-color: #E2E8F0;
    --text-muted: #64748B;
    
    /* Variables */
    --sidebar-w: 260px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 1. RESET & BASE */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif; /* */
}

body {
    background-color: var(--bg-slate);
    color: var(--jci-black);
    min-height: 100vh;
}

/* Auth Page Centering */
body.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #e0f2fe, var(--bg-slate));
}

/* Dashboard Layout Structure (Fixes Screenshot Alignment) */
body.dashboard-body {
    display: flex; /* Sidebar and Main sit side-by-side */
}

/* 2. SIDEBAR NAVIGATION  */
.sidebar {
    width: var(--sidebar-w);
    background: var(--jci-black);
    color: var(--white);
    height: 100vh;
    position: fixed; /* Fixes sidebar to the screen */
    left: 0;
    top: 0;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    background: var(--jci-blue);
    color: var(--white);
}

/* 3. MAIN CONTENT & TOP BAR */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w); /* Pushes content away from fixed sidebar */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: var(--white);
    height: 72px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-padding {
    padding: 40px;
}

/* 4. COMPONENTS (Cards, Stats, Modals) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--jci-blue);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px -2px rgba(0,0,0,0.1);
}

.card {
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}
.status-badge.approved { background: #ecfdf5; color: #059669; }
.status-badge.pending { background: #fffbeb; color: var(--jci-yellow); }

/* Nomination table filter */

.filter-select {
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease;
    font-size: 14px;
    color: var(--text-main);
    background-color: white; /* Ensures it's visible */
}

.filter-select:focus {
    border-color: var(--jci-blue) !important;
}

/* 5. VISIBILITY TOGGLE */
.switch-ui {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}

.switch-ui input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--jci-blue); }
input:checked + .slider:before { transform: translateX(16px); }

/* 6. MODAL SYSTEM */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(19, 15, 45, 0.7);
    display: none; /* Controlled by JS */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--white);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    width: 90%;
}

/* Buttons  */
.btn-primary {
    background: var(--jci-blue);
    color: var(--white);
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--jci-navy);
    transform: translateY(-2px);
}

/* 7. AUDITOR MODE */
.audit-banner {
    background: #fffbeb;
    color: #92400e;
    padding: 12px 40px;
    font-weight: 600;
    border-bottom: 1px solid #fde68a;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 8. LIVE DASHBOARD INDICATOR AND VOTING STATUS BANNERS*/
.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: bold;
    color: var(--jci-teal);
}

.dot {
    height: 8px;
    width: 8px;
    background-color: var(--jci-teal);
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* voting status banners */
.voting-banner {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.voting-banner.locked {
    background: #FEE2E2; /* Light Red */
    color: #991B1B;      /* Dark Red */
    border: 1px solid #FECACA;
}

.voting-banner.active {
    background: #DCFCE7; /* Light Green */
    color: #166534;      /* Dark Green */
    border: 1px solid #BBF7D0;
}
/* --- Automated Stage Badges --- */
.status-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-nominated { background: #f1f5f9; color: var(--jci-teal); }     /* Gray */
.status-shortlisted { background: #e0f2fe; color: var(--jci-navy); }
.status-finalist { background: #fef9c3; color: var(--jci-yellow) }
.status-honouree { background: #dcfce7; color: #166534; }      /* Green */


/* RESULTS & LEADERBOARD */

.result-section .card {
    border-left: 5px solid var(--jci-blue);
    margin-bottom: 20px;
}

/* Highlights the #1 ranked person (The Honouree) */
.result-section tr:first-child {
    border-left: 4px solid var(--jci-teal); 
    background-color: #f0fdf4; /* Very light green success tint */
}

.rank-number {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 900;
}

/* 9. MOBILE & TABLET OPTIMIZATION */

/* Desktop: Hide Mobile Header by default */
.mobile-header { display: none; }

/* Tablet View (1024px and below) */
@media (max-width: 1024px) {
    :root { --sidebar-w: 80px; }
    .sidebar span, .sidebar h3, .sidebar-header h3 { display: none; }
    .sidebar-header img { width: 45px; }
    .nav-item { justify-content: center; padding: 15px; }
    .main-content { margin-left: var(--sidebar-w); }
}

/* Mobile View (768px and below) */
@media (max-width: 768px) {
    /* Show the top bar with hamburger icon */
    .mobile-header { 
        display: flex !important; 
        padding: 15px; 
        background: #fff; 
        border-bottom: 1px solid var(--bg-slate); 
        align-items: center; 
        gap: 15px;
        position: sticky;
        top: 0;
        z-index: 900;
    }

    /* Transform Sidebar into a Slide-out Drawer */
    .sidebar {
        position: fixed;
        left: -100%; /* Start hidden off-screen */
        top: 0;
        bottom: 0;
        width: 260px !important;
        height: 100vh !important;
        z-index: 1100;
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
        margin-left: 0 !important;
    }

    .sidebar.active {
        left: 0; /* Slide in */
    }

    /* Reset Sidebar internals for vertical scroll inside drawer */
    .sidebar-nav {
        flex-direction: column !important;
        overflow-y: auto;
    }
    
    .sidebar span { display: inline-block !important; } /* Bring back text in drawer */

    /* The Main Content */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Overlay when menu is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(2px);
        z-index: 1000;
    }
    .sidebar-overlay.active { display: block; }

    /* Layout stacking */
    .stats-grid, .content-padding div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Table Fix */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 10 LOGIN FEEDBACK & ANIMATIONS */

/* The Spinner Animation */
.loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Shake Effect */
.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}