/* --- 1. Variables & Reset (Self-Contained) --- */
:root {
    /* UJ-Style Modern Palette */
    --primary-orange: #FF8C42;       /* Soft Orange */
    --primary-orange-hover: #E87A30; 
    
    --bg-page: #F0F2F5;              /* Light Blue-Grey Background */
    --bg-surface: #FFFFFF;           /* White Surface */
    
    --text-main: #2C3E50;            /* Dark Grey */
    --text-muted: #7F8C8D;           /* Soft Grey */
    --border-color: #E1E8ED;
    
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 10px rgba(0,0,0,0.08);

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    /* Normal block flow, NO centering */
    display: block; 
    height: auto;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- 2. Navigation Bar --- */
.navbar {
    height: 64px;
    background-color: var(--bg-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.nav-left, .nav-right { display: flex; align-items: center; gap: 15px; }

/* Brand */
.brand {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}
.brand span { color: var(--primary-orange); }

/* Toggle Button */
.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.icon-btn:hover { background-color: #f1f3f5; }
.icon-btn svg { fill: var(--text-main); }

/* User Avatar / Public Links */
.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-greeting {
    font-weight: 500;
    display: none; /* Hidden on mobile */
}
@media (min-width: 768px) { .user-greeting { display: block; } }

/* Public Buttons (Login/Join) */
.btn-nav-login {
    font-weight: 600;
    color: var(--text-main);
    padding: 6px 8px; /* Smaller padding for mobile */
    font-size: 0.85rem; /* Smaller font for mobile */
    text-decoration: none;
}

.btn-nav-join {
    background-color: var(--primary-orange);
    color: white;
    font-weight: 600;
    padding: 6px 14px; /* Scaled down for mobile */
    border-radius: 20px;
    font-size: 0.85rem; /* Smaller font for mobile */
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
    white-space: nowrap; /* 👈 THE MAGIC FIX: Prevents text from breaking into two lines */
}

.btn-nav-join:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 140, 66, 0.3);
}

/* TABLET & DESKTOP SCALE-UP */
@media (min-width: 768px) { 
    .user-greeting { 
        display: block; 
    } 
    
    .nav-right {
        gap: 15px; /* More breathing room on bigger screens */
    }

    .btn-nav-login {
        padding: 8px 12px;
        font-size: 1rem;
    }

    .btn-nav-join {
        padding: 8px 20px;
        font-size: 1rem;
    }
}

/* --- 3. Layout Container --- */
.main-container {
    display: flex;
    margin-top: 64px; /* Push down by navbar height */
    min-height: calc(100vh - 64px);
}

/* --- 4. Sidebar --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

/* Sidebar Collapsed State */
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .nav-text { display: none; }

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        height: calc(100vh - 64px);
        width: 260px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transform: translateX(-100%);
        
        /* FIX: Boost Z-Index to sit above sticky table headers (which are usually 10 or 11) */
        z-index: 2000 !important; 
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 64px;
        left: 0;
        width: 100%;
        height: calc(100vh - 64px);
        background: rgba(0,0,0,0.5);
        display: none;
        
        /* FIX: Ensure overlay is just behind the sidebar but above the content */
        z-index: 1999 !important; 
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

.nav-list {
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-item { margin-bottom: 4px; }
.nav-item.bottom { margin-top: auto; }

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-right: 16px;
    fill: var(--text-muted);
    transition: fill 0.2s;
}

/* Hover & Active States */
.nav-link:hover {
    background-color: #FFF4EC; /* Very light orange tint */
    color: var(--primary-orange);
}
.nav-link:hover svg { fill: var(--primary-orange); }

.nav-item.active .nav-link {
    background-color: #FFF4EC;
    color: var(--primary-orange);
    font-weight: 600;
}
.nav-item.active .nav-link svg { fill: var(--primary-orange); }

/* --- 5. Main Content --- */
.content-area {
    flex-grow: 1;
    padding: 40px;
    overflow-x: hidden;
}

.header-section { margin-bottom: 40px; }
.header-section h1 { 
    font-size: 1.8rem; 
    color: var(--text-main); 
    margin-bottom: 8px; 
}
.header-section p { color: var(--text-muted); }

/* --- 6. Card Grid (Dashboard Content) --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background: var(--bg-surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-image {
    height: 180px;
    background-color: #dfe6e9; /* Placeholder grey */
    background-size: cover;
    background-position: center;
}

.card-body { padding: 24px; }

.card-badge {
    display: inline-block;
    background-color: #F0F2F5;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.btn-card-action {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    background-color: white;
    border: 2px solid var(--primary-orange);
    color: var(--primary-orange);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-card-action:hover {
    background-color: var(--primary-orange);
    color: white;
}
/* --- 7. Dashboard Forms (New) --- */
.dashboard-form-wrapper {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    max-width: 800px; /* Limits width for readability */
    border: 1px solid var(--border-color);
}

.dashboard-form-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Inputs, Selects, and Textareas */
.dashboard-form-wrapper input,
.dashboard-form-wrapper select,
.dashboard-form-wrapper textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background-color: #FAFAFA; /* Very light grey */
    transition: all 0.2s;
    color: var(--text-main);
}

.dashboard-form-wrapper input:focus,
.dashboard-form-wrapper select:focus,
.dashboard-form-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary-orange);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(255, 140, 66, 0.15); /* Soft orange glow */
}

/* Form Layout Utilities */
.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Switch to 2 columns on larger screens */
@media (min-width: 768px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* Submit Button */
.btn-submit {
    background-color: var(--primary-orange);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: inline-block;
}

.btn-submit:hover {
    background-color: var(--primary-orange-hover);
    transform: translateY(-2px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}


/* --- 8. Stats Dashboard (New) --- */

/* The Dark Hero Section */

.dashboard-form-wrapper, 
.profile-section { /* Apply same styles to profile section */
    background: var(--bg-surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

/* Headings inside sections */
.dashboard-form-wrapper h3,
.profile-section h3 {
    margin-bottom: 20px;
    color: var(--text-main);
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    font-size: 1.2rem;
}

/* INPUTS & SELECTS - The "Proper Styling" */
.profile-section input,
.profile-section select,
.dashboard-form-wrapper input,
.dashboard-form-wrapper select,
.dashboard-form-wrapper textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background-color: #FAFAFA;
    transition: all 0.2s;
    color: var(--text-main);
    margin-bottom: 5px; /* Spacing */
}

.profile-section input:focus,
.profile-section select:focus,
.dashboard-form-wrapper input:focus,
.dashboard-form-wrapper select:focus {
    outline: none;
    border-color: var(--primary-orange);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(255, 140, 66, 0.1);
}

/* Read-only / Disabled Inputs */
.profile-section input:disabled {
    background-color: #eee;
    color: #888;
    cursor: not-allowed;
    border-color: #ddd;
}

/* Labels */
.profile-section label,
.dashboard-form-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.stats-hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); /* Dark Blue/Black Theme */
    color: white;
    padding: 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 40px;
    position: relative;
    z-index: 2;
}

/* Big Number */
.hero-number {
    font-size: 6rem;
    font-weight: 800;
    line-height: 1;
    color: #FF8C42; /* UJ Orange Pop */
}

.hero-text h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: white;
}

.hero-text p {
    color: #a0a0a0;
    font-size: 1rem;
    max-width: 400px;
}

/* Progress Bar Container */
.progress-container {
    margin-top: 20px;
    background: rgba(255,255,255,0.1);
    height: 10px;
    border-radius: 5px;
    width: 100%;
    max-width: 500px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #FF8C42;
    border-radius: 5px;
    transition: width 1s ease-in-out;
}

.progress-label {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #FF8C42;
    font-weight: 600;
}

/* 3-Column Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-card h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* List Items in Cards */
.stat-list-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f9f9f9;
}
.stat-list-item:last-child { border-bottom: none; }

.stat-val { font-weight: 700; color: var(--text-main); }
.stat-label { color: var(--text-muted); }

/* Rank Badge */
.rank-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    margin-top: 10px;
}


/* --- 9. Profile & Danger Zone --- */
.profile-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.profile-section h3 {
    margin-bottom: 20px;
    color: var(--text-main);
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Danger Zone Specifics */
.danger-zone {
    border: 1px solid #ffcccc;
    background: #fff5f5;
}

.danger-zone h3 {
    color: #c0392b;
    border-bottom-color: #ffcccc;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* Toggle Switch Style */
.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
}
.toggle-label { font-weight: 500; }


/* --- 10. Management Split Layout --- */
.management-layout {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 50% List, 50% Form */
    gap: 30px;
    align-items: start; /* Aligns items to the top */
}

/* The Left Side (List) */
/* --- Updated List Container (With Slider) --- */
.event-list-container {
    background: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    max-height: 85vh;
    
    /* ENABLE SLIDER HERE */
    overflow-y: auto; /* Vertical scroll */
    overflow-x: auto; /* Horizontal scroll (The Slider) */
    position: relative;
    
    /* Ensure table creates scrollable width if needed */
    display: block; 
}

/* Make the Slider Look Nice */
.event-list-container::-webkit-scrollbar {
    width: 8px;  /* Vertical scrollbar width */
    height: 8px; /* Horizontal slider height */
}

.event-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.event-list-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.event-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-orange);
}

/* Force Actions to stay on one line so they don't stack weirdly */
.event-list-container td, 
.event-list-container th {
    white-space: nowrap; 
}

/* --- Table Header Styling --- */
.event-list-container th {
    background-color: #f8f9fa; /* Light grey background */
    color: #6c757d;            /* Muted text color */
    font-weight: 700;          /* Bold */
    font-size: 0.8rem;         /* Slightly smaller font */
    text-transform: uppercase; /* UPPERCASE headers */
    letter-spacing: 0.05em;    /* Spacing for readability */
    padding: 15px;             /* Comfortable padding */
    border-bottom: 2px solid #e9ecef; /* distinct border */
    white-space: nowrap;       /* Prevent text wrapping */
    
    /* Sticky Header Logic */
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Fix for the last column (Actions) */
.event-list-container th:last-child {
    text-align: right;
    padding-right: 20px;
}

/* Update Mobile styles to ensure slider works there too */
@media (max-width: 900px) {
    .event-list-container {
        max-height: 300px;
        overflow-x: auto; /* Ensure slider works on mobile */
    }
}

/* The Right Side (Form) */
.dashboard-form-wrapper.sticky-form {
    position: sticky; /* Stays fixed while you scroll the page */
    top: 20px;
    margin-bottom: 0;
    max-height: 85vh;
    overflow-y: auto; /* Scroll inside form if it's too long */
}



/* The Grid for Roles */
.role-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 columns on desktop */
    gap: 12px;
    margin-top: 8px;
}

/* The Role "Card" */
.role-card {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hover Effect */
.role-card:hover {
    border-color: var(--primary-orange);
    background-color: #FFF4EC;
}

/* Checkbox specific styling inside the card */
.role-card input[type="checkbox"] {
    width: 18px !important; /* Override the 100% width from general inputs */
    height: 18px;
    margin-right: 12px;
    accent-color: var(--primary-orange); /* Makes the tick orange */
    cursor: pointer;
    margin-bottom: 0; /* Remove bottom margin from general input styles */
}

.role-card span {
    font-weight: 500;
    color: var(--text-main);
}

.role-card small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    margin-top: 2px;
}

/* --- MOBILE RESPONSIVENESS FIXES --- */
@media (max-width: 900px) {
    /* Stack the layout vertically */
    .management-layout {
        grid-template-columns: 1fr; 
        gap: 20px;
    }

    /* List becomes a scrollable box at the top */
    .event-list-container {
        max-height: 300px; /* Shorter list so form is visible */
        border-bottom: 2px solid var(--primary-orange);
    }

    /* Remove sticky behavior on mobile so it flows naturally */
    .dashboard-form-wrapper.sticky-form {
        position: static;
        max-height: none;
        overflow: visible;
    }

    /* Roles become single column on very small screens for easier tapping */
    .role-selection-grid {
        grid-template-columns: 1fr; 
    }
}

/* --- 12. Attendance Sheet Responsive --- */

.attendance-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden; /* Keeps the rounded corners clean */
    border: 1px solid var(--border-color);
}

/* The wrapper that allows scrolling */
.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on mobile */
}

.attendance-table {
    width: 100%;
    border-collapse: collapse;
    /* Ensure table is wide enough to look good, forcing scroll on mobile */
    min-width: 600px; 
}

.attendance-table th, 
.attendance-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap; /* Prevent names/dates from wrapping uglily */
}

.attendance-table th {
    background-color: #f8f9fa;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* --- RESPONSIVE MOBILE TABLE (GRID CARD VIEW) --- */
@media (max-width: 768px) {
    /* 1. LOCK THE SEARCH BAR */
    .filters-wrapper {
        width: 100%;
        padding: 0 5px;
        box-sizing: border-box;
    }
    .search-input {
        width: 100%; /* Makes search stretch perfectly across the screen */
        box-sizing: border-box;
    }

    /* 2. KILL THE HORIZONTAL SCROLL */
    .table-scroll-wrapper {
        overflow-x: hidden !important; /* This permanently stops the sliding */
        width: 100%;
        box-sizing: border-box;
    }

    /* 3. RESET THE CONTAINER */
    .attendance-container {
        padding: 10px 5px !important; /* Tiny padding so cards don't touch phone edges */
        background: transparent !important; 
        box-shadow: none !important;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    /* 4. FORCE TABLE TO BEHAVE */
    .attendance-table, .attendance-table tbody {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    .attendance-table thead {
        display: none;
    }

    /* 📦 5. THE CARD CONTAINER (Locked & Stacked) */
    .attendance-table tbody tr {
        display: flex !important;
        flex-direction: column !important; 
        width: 100% !important; /* Locks width */
        box-sizing: border-box !important; /* Prevents padding from breaking the screen width */
        gap: 12px; 
        background: #ffffff;
        border-radius: 12px;
        padding: 16px !important;
        margin-bottom: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08); 
        border: 1px solid #e2e8f0 !important;
    }

    /* 6. RESET CELLS */
    .attendance-table td {
        display: flex !important;
        align-items: center;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 !important; 
        border: none !important;
    }

    /* --- CARD INNER STYLING --- */
    
    /* NAME */
    .attendance-table td:nth-child(1) {
        border-bottom: 1px solid #f1f5f9 !important; 
        padding-bottom: 12px !important;
    }
    .attendance-table td:nth-child(1) div {
        font-size: 1.15rem !important; 
        font-weight: 700;
    }

    /* STATUS & TIME */
    .attendance-table td:nth-child(2),
    .attendance-table td:nth-child(3) {
        justify-content: flex-start;
    }

    /* ACTIONS */
    .attendance-table td:nth-child(4) {
        margin-top: 5px;
        padding-top: 15px !important;
        border-top: 1px solid #f1f5f9 !important; 
        justify-content: center;
        width: 100% !important;
        margin-left: -15rem; /* Negative margin to offset the padding and make buttons edge-to-edge */
    }
    
    /* BIG MOBILE BUTTONS */
    .attendance-table td:nth-child(4) button {
        width: 30%;
        padding: 10px 16px !important; /* Slightly slimmer height */
        font-size: 0.95rem !important;
        border-radius: 8px !important; /* Rounds the corners of the button itself */
        box-sizing: border-box;
        display: flex !important;
        justify-content: center !important; /* Centers the text perfectly */
        align-items: center;
        margin-bottom: 4px; /* Stops it from touching the absolute bottom edge */
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important; /* Adds a subtle floating shadow */

    }

    .attendance-table tbody tr[style*="display: none"],
    .attendance-table tbody tr[style*="display:none"] {
        display: none !important;
    }

    .attendance-table td:nth-child(4) div {
        width: 30% !important; /* Force the wrapper to stretch full width */
        display: flex !important;
        justify-content: space-between !important; 
        align-items: center !important;
        box-sizing: border-box;
        gap: 15px !important; /* Clean spacing between ✓ and button */
    }

    /* Make the Re-Sign In button share the space perfectly */
    .attendance-table td:nth-child(4) div button {
        width: auto !important; /* Stop it from forcing 100% */
        flex-grow: 1 !important; /* Magically stretches to fill only the remaining space */
        margin-bottom: 0 !important; /* Keeps it perfectly aligned with the checkmark */
    }
}
/* Modal Overlay */
.custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 9999;
    display: none; justify-content: center; align-items: center;
    backdrop-filter: blur(2px);
}

/* Modal Box */
.custom-modal-box {
    background: white; width: 90%; max-width: 400px;
    border-radius: 12px; padding: 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center; animation: popIn 0.2s ease-out;
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Modal Inputs & Buttons */
.modal-time-input {
    font-size: 1.5rem; padding: 10px; border: 2px solid #ddd;
    border-radius: 8px; width: 150px; text-align: center;
    margin: 15px 0; color: #333;
}

.modal-btn-group {
    display: flex; gap: 10px; justify-content: center; margin-top: 20px;
}

.btn-modal-primary {
    background: var(--primary-orange); color: white; padding: 10px 20px;
    border: none; border-radius: 6px; cursor: pointer; font-weight: 600; flex: 1;
}

.btn-modal-secondary {
    background: #f1f3f5; color: #555; padding: 10px 20px;
    border: 1px solid #ddd; border-radius: 6px; cursor: pointer; font-weight: 500; flex: 1;
}

/* --- MOBILE MAGIC: Sticky First Column --- */
@media (max-width: 768px) {
    /* Make the Student Name column stick to the left */
    .attendance-table th:first-child,
    .attendance-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background-color: white; /* Cover content sliding under it */
        border-right: 2px solid #f0f0f0; /* Visual separator */
    }

    /* Ensure the sticky header matches the gray background */
    .attendance-table th:first-child {
        background-color: #f8f9fa; 
    }
}

/* --- 13. Password Toggles --- */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 45px !important; /* Make room for the eye icon */
}

.toggle-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%); /* Center vertically */
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.toggle-icon:hover {
    background: #f0f0f0;
    color: var(--primary-orange);
}

/* --- Stats Hero Mobile Polish --- */
@media (max-width: 768px) {
    .stats-hero {
        padding: 30px 20px;
        text-align: center;
    }

    /* Stack everything vertically */
    .hero-content {
        flex-direction: column;
        gap: 10px;
    }

    /* Force the avatar to be centered and smaller */
    .hero-content > div:first-child { 
        margin: 0 auto; /* Center horizontal */
        width: 60px !important; 
        height: 60px !important;
        font-size: 1.5rem !important;
    }

    /* Resize the Big Number */
    .hero-number {
        font-size: 3.5rem; /* Smaller to fit nicely */
        margin: 5px 0;
    }

    .hero-text p {
        font-size: 0.9rem;
        margin-bottom: 20px;
        color: #b0b0b0; /* Lighter grey for better readability */
    }

    /* Progress Bar Spacing */
    .progress-container {
        margin: 0 auto 10px auto; /* Center it */
        width: 100%;
    }

    .progress-label {
        margin-bottom: 10px;
        display: block;
        position: relative;
        z-index: 5; /* Ensure text sits on top */
    }

    /* CRITICAL FIX: Hide the chart bars on mobile */
    .hero-decoration {
        display: none !important;
    }
}

/* --- Minimal Footer --- */
.minimal-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px; /* Space above footer */

}

.footer-links {
    margin-bottom: 12px;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #E35205; /* UJ Orange Hover */
    text-decoration: underline;
}

.separator {
    margin: 0 10px;
    color: #ccc;
    font-size: 0.8rem;
}

.footer-copyright {
    font-size: 0.8rem;
    color: #aaa;
}

/* Mobile Tweak: Stack links on very small screens if needed */
@media (max-width: 400px) {
    .separator { display: none; }
    .footer-links a { display: block; margin: 5px 0; }
}

/* --- Report Dashboard Styles --- */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.report-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

.report-card h3 {
    margin-top: 0;
    color: #555;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.big-stat {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 10px 0;
}

.stat-subtext {
    font-size: 0.85rem;
    color: #888;
}

/* AI Insight Box */
.ai-insight-box {
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border-left: 4px solid #8e44ad;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    position: relative;
}

.ai-insight-box h4 {
    color: #8e44ad;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.comparison-table th {
    background: #f8f9fa;
    color: #666;
    padding: 10px;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.comparison-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

/* Search Bar for Reports */
.report-search-bar {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 1rem;
}

.mobile-only-leaderboard {
    display: none; 
}

@media (max-width: 768px) {
    .mobile-only-leaderboard {
        display: flex; 
        justify-content: center; 
        gap: 8px; /* Tighter gap */
        margin-top: 20px; /* Stops it from touching the motivation quote */
        margin-bottom: 30px; /* Stops it from touching the grid below */
    }
}