/* ==========================================
   🎨 1. DYNAMIC THEME VARIABLES
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0369a1;
    --primary-hover: #075985;
    --bg-color: #f4f7fe;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --sidebar-bg: #dae4fd;
    --sidebar-text: #000000;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    --input-bg: #f8fafc;
}

[data-theme="dark"] {
    --bg-color: #0b1120;
    --card-bg: #161e31;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #0ea5e9;
    --primary-hover: #38bdf8;
    --border: #334155;
    --sidebar-bg: #0b1120;
    --sidebar-text: #94a3b8;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    --input-bg: #0f172a;
}

/* ==========================================
   🏗️ 2. GLOBAL BASE & RESET
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', 'Segoe UI', Tahoma, sans-serif;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* Desktop Layout Flexbox */
@media (min-width: 851px) {
    #protectedContent {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        width: 100%;
        min-height: 100vh;
    }
    .sidebar {
        position: sticky !important;
        top: 0;
        height: 100vh;
        flex-shrink: 0;
    }
    .main-content {
        flex: 1;
        margin-left: 0 !important;
        width: 100%;
        min-width: 0;
        padding: 30px 40px;
    }
}

/* ==========================================
   🔒 3. SECURE LOGIN SCREEN
   ========================================== */
body:not(.unlocked) #protectedContent { pointer-events: none; user-select: none; filter: blur(5px); }
body.unlocked #protectedContent { filter: none; pointer-events: auto; user-select: auto; }
body.unlocked #authOverlay { display: none; }

#authOverlay {
    position: fixed; 
    inset: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    background-image: url("https://www.transparenttextures.com/patterns/inspiration-geometry.png");
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 9999;
    overflow: hidden;
}

.login-box {
    background: rgb(255, 255, 255); 
    padding: 30px; 
    width: 90%;             /* NEW: Takes up 90% of mobile screens */
    max-width: 320px;       /* NEW: Stops growing at 320px on desktops */
    margin: 0 auto;         /* NEW: Forces perfect centering */
    border-radius: 15px; 
    text-align: center; 
    color: #000000;
    box-sizing: border-box; /* NEW: Keeps padding inside the width */
}
.login-box h2 { margin-bottom: 15px; font-size: 26px; color: #000000; }
.login-box input { width: 100%; padding: 10px; margin-bottom: 12px; border-radius: 6px; border: 1px solid #ccc; background: #fff; color:#000;}
.login-box button { width: 100%; padding: 10px; background: #ff9800; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; color: white;}
#error { color: #ff4d4d; margin-top: 8px; font-size: 14px; font-weight: bold;}

/* Mobile Loader */
#auth-loader {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(8px);
    display: none; align-items: center; justify-content: center; z-index: 10000;
}
.loader-card {
    width: 140px; height: 150px; background: rgba(255, 255, 255, 0.14); border-radius: 18px;
    box-shadow: 0 0 30px rgba(255, 152, 0, 0.35); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
}
.loader-icon { position: relative; width: 54px; height: 54px; }
.spinner-ring {
    width: 100%; height: 100%; border-radius: 50%; border: 4px solid rgba(255,255,255,0.25);
    border-top-color: #ff9800; animation: spin 0.9s linear infinite;
}
.checkmark { position: absolute; inset: 0; display: none; }
.checkmark::after {
    content: ''; position: absolute; width: 12px; height: 24px; border: solid #4caf50;
    border-width: 0 4px 4px 0; transform: rotate(45deg); left: 18px; top: 10px;
}
.loading-text { font-size: 13px; letter-spacing: 0.5px; color: #fff; animation: pulse 1.4s ease-in-out infinite; }

#auth-loader.success .spinner-ring { display: none; }
#auth-loader.success .checkmark { display: block; animation: pop 0.4s ease forwards; }
#auth-loader.success .loader-card { box-shadow: 0 0 35px rgba(76, 175, 80, 0.6); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 0.4; } 50% { opacity: 1; } 100% { opacity: 0.4; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25%, 75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
.shake { animation: shake 0.4s; }

/* Cloud Fetch Loader */
.cloud-loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color); display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 99999;
    transition: opacity 0.5s ease;
}
.cloud-loader h2 { margin-top: 20px; color: var(--primary); }
.cloud-loader p { color: var(--text-muted); margin-top: 5px; }
.spinner {
    width: 50px; height: 50px; border: 5px solid var(--border);
    border-top: 5px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite;
}
.fade-out { opacity: 0; pointer-events: none; }

/* ==========================================
   🗂️ 4. SIDEBAR NAVIGATION
   ========================================== */
.sidebar {
    width: 260px; background-color: var(--sidebar-bg); padding: 25px 20px;
    display: flex; flex-direction: column; z-index: 1000; border-right: 1px solid var(--border);
}
.sidebar h2 { color: #ffb703; font-size: 22px; font-weight: 700; margin-bottom: 40px; text-align: center; }

nav { display: flex; flex-direction: column; flex: 1; }
.nav-btn {
    background: transparent; border: none; color: var(--sidebar-text); padding: 15px 20px;
    text-align: left; font-size: 15px; font-weight: 500; border-radius: 12px; cursor: pointer;
    margin-bottom: 8px; display: flex; align-items: center; gap: 12px; transition: all 0.2s ease;
}
.nav-btn:hover { color: #000000; background: rgba(255,255,255,0.05); transform: translateX(5px); }
.nav-btn.active { background: var(--primary); color: #ffffff; box-shadow: 0 4px 15px rgba(3, 105, 161, 0.4); }

.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
#theme-toggle { background: rgb(255, 255, 255); color: #000000; border: 1px solid rgba(255,255,255,0.1); width: 100%; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 500; }
#theme-toggle:hover { background: rgba(255,255,255,0.1); }

/* ==========================================
   🏠 5. MAIN CONTENT, DASHBOARD & CARDS
   ========================================== */
.page-section { display: none; animation: fadeIn 0.4s ease; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.dashboard-header { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 15px; margin-bottom: 30px; }
header h1 { font-size: 28px; font-weight: 700; color: var(--text-main); margin-bottom: 5px; }

.quick-actions { display: flex; gap: 10px; }
.card {
    background-color: var(--card-bg); padding: 25px; border-radius: 16px;
    box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 20px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card h3, .card-header h3 { margin-bottom: 20px; font-size: 18px; color: var(--text-main); display: flex; align-items: center; gap: 10px; }

/* Dashboard Splitting & Stats */
.dashboard-split-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card {
    background-color: var(--card-bg); padding: 20px; border-radius: 16px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 18px; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px -5px rgba(3, 105, 161, 0.15); }

.stat-icon { width: 65px; height: 65px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; flex-shrink: 0; }
.stat-details h3 { color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.stat-details h2 { font-size: 26px; color: var(--text-main); font-weight: 700; }

.summary-item { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.summary-item:last-child { border-bottom: none; }

/* ==========================================
   📝 6. FORMS & BUTTONS
   ========================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; color: var(--text-muted); }

input, select {
    width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
    background-color: var(--input-bg); color: var(--text-main); font-size: 15px; transition: all 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(3, 105, 161, 0.1); background-color: var(--card-bg); }

/* Remove Number Input Arrows */
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.fee-type-toggle { display: flex; gap: 25px; padding: 12px 15px; background: var(--input-bg); border-radius: 10px; border: 1px solid var(--border); }
.fee-type-toggle label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--text-main); }
.fee-type-toggle input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* Installment Containers */
.installments-container { display: flex; flex-direction: column; gap: 10px; }
.installment-row { display: flex; gap: 15px; align-items: center; background: var(--input-bg); padding: 15px; border-radius: 8px; border: 1px solid var(--border); }

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-sm { border: none; border-radius: 10px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-primary { padding: 14px 24px; font-size: 15px; background: var(--primary); color: white; box-shadow: 0 4px 15px rgba(3, 105, 161, 0.3); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }
.btn-secondary { padding: 10px 15px; background: var(--border); color: var(--text-main); }
.btn-danger { padding: 10px 15px; background: var(--danger); color: white; }
.btn-sm { padding: 8px 16px; font-size: 13px; background: var(--input-bg); color: var(--text-main); border: 1px solid var(--border); }
.btn-sm:hover { background: var(--border); }

/* ==========================================
   📊 7. TABLES & MODALS
   ========================================== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; }

.premium-table th { background: var(--input-bg); border: none; }
.premium-table th:first-child { border-radius: 8px 0 0 8px; }
.premium-table th:last-child { border-radius: 0 8px 8px 0; }
.premium-table td { vertical-align: middle; }

/* Modals */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); justify-content: center; align-items: center; z-index: 1000; }
.modal.active { display: flex; animation: fadeIn 0.2s ease-out; }
.premium-modal { width: 1100px; max-width: 95%; background: transparent; padding: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.25); position: relative; border: 1px solid rgba(255,255,255,0.1); }
.modal-header { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: white; padding: 30px; position: relative; }
.modal-header h2 { margin: 0; font-size: 24px; display: flex; align-items: center; gap: 12px; }
.modal-header p { margin: 8px 0 0 0; opacity: 0.85; font-size: 14px; }
.close-btn { position: absolute; top: 20px; right: 25px; font-size: 28px; color: white; cursor: pointer; opacity: 0.7; transition: 0.2s; z-index: 10; }
.close-btn:hover { opacity: 1; transform: scale(1.1); }
.modal-body-content { padding: 30px; background: var(--bg-color); max-height: 65vh; overflow-y: auto; display: grid; grid-template-columns: 280px 1fr; gap: 30px; align-items: start; }
.student-profile-grid { display: flex; flex-direction: column; gap: 20px; background: var(--card-bg); padding: 25px; border-radius: 12px; border: 1px solid var(--border); }
.profile-item p.label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; font-weight: bold; }
.profile-item p.value { font-size: 15px; color: var(--text-main); font-weight: 600; }
.modal-history-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.modal-history-table th { background: var(--input-bg); }

/* ==========================================
   📈 8. ANALYTICS COMPONENTS
   ========================================== */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
.analytics-filters { display: flex; flex-wrap: wrap; gap: 8px; background: var(--card-bg); padding: 5px; border-radius: 8px; border: 1px solid var(--border); }
.filter-btn { padding: 8px 16px; border: none; background: transparent; color: var(--text-muted); border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.filter-btn:hover { color: var(--text-main); background: var(--bg-color); }
.filter-btn.active { background: var(--primary); color: white; box-shadow: 0 2px 4px rgba(3, 105, 161, 0.3); }

.progress-wrapper { margin-top: 20px; }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.progress-track { width: 100%; height: 24px; background: var(--input-bg); border-radius: 12px; overflow: hidden; display: flex; }
.progress-fill { height: 100%; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.fill-success { background: linear-gradient(90deg, #2a9d8f, #20c997); }
.fill-primary { background: linear-gradient(90deg, var(--primary), var(--primary-hover)); }

.modes-container { margin-top: 15px; }
.mode-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--border); font-size: 14px;}
.mode-row:last-child { border: none; padding-bottom: 0; }

.bar-chart-container { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.bar-row { display: flex; flex-direction: column; gap: 8px; }
.bar-labels { display: flex; justify-content: space-between; font-size: 14px; }
.bar-track { width: 100%; height: 12px; background: var(--input-bg); border-radius: 6px; overflow: hidden; }


/* ==========================================
   🖨️ 9. PREMIUM COLORFUL RECEIPT PRINTING
   ========================================== */
.premium-receipt { 
    display: none; 
    background: #fff; 
    font-family: 'Poppins', sans-serif; 
    
    /* 🚨 LOCKS RECEIPT TO LIGHT MODE COLORS */
    --primary: #0369a1 !important;
    --primary-hover: #075985 !important;
    --text-main: #1e293b !important;
    --text-muted: #64748b !important;
    --success: #10b981 !important;
    --danger: #ef4444 !important;
    --warning: #f59e0b !important;
    --border: #e2e8f0 !important;
    --input-bg: #f8fafc !important;
    --card-bg: #ffffff !important;
    --bg-color: #f4f7fe !important;
}

@media print {
    @page { size: A4; margin: 0; }
    body { background: #fff; margin: 0; padding: 0; }
    body * { visibility: hidden; }
    .sidebar, .main-content { display: none !important; }
    
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    
    .premium-receipt, .premium-receipt * { visibility: visible; }
    .premium-receipt { display: block; position: absolute; left: 0; top: 0; width: 100%; padding: 10px; box-sizing: border-box; }
    .receipt-inner { position: relative; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }

    .receipt-header { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); padding: 15px; color: white; }
    .header-left { display: flex; align-items: center; gap: 20px; }
    .receipt-logo img { width: 70px; height: 70px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
    .institute-details h1 { font-size: 24px; color: #ffffff; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 1px; }
    .institute-details p { font-size: 12px; color: #e0eaff; margin-bottom: 3px; }
    
    .receipt-title-box { text-align: right; }
    .receipt-title-box h2 { font-size: 26px; color: aqua; margin-bottom: 15px; letter-spacing: 2px; }
    .meta-row { font-size: 14px; margin-bottom: 5px; color: #e0eaff; }
    .meta-row span { display: inline-block; width: 80px; text-align: left; opacity: 0.8;}
    .meta-row strong { color: #ffffff; }

    /* 5-Column Grid */
    .student-details-grid {
        display: grid; grid-template-columns: 1.5fr 1fr 1.5fr 1fr 1fr; gap: 15px;
        background: #f8faff; padding: 20px 25px; margin: 30px; border-radius: 8px; border-left: 5px solid var(--primary); 
    }
    .label { font-size: 11px; text-transform: uppercase; color: #8d99ae; font-weight: bold; margin-bottom: 5px; }
    .student-details-grid h3 { font-size: 18px; color: #2b2d42; margin: 0; }
    .value { font-size: 14px; font-weight: 600; color: #2b2d42; }

    .receipt-table-container { margin: 0 30px; position: relative; z-index: 2;}
    .receipt-table-container h3 { font-size: 16px; margin-bottom: 15px; color: var(--primary); border-bottom: 2px solid #edf2f4; padding-bottom: 10px;}
    .receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
    .receipt-table th { background: var(--primary); color: #fff; padding: 12px; text-align: left; font-size: 13px; font-weight: 600; }
    .receipt-table td { padding: 12px; border-bottom: 1px solid #edf2f4; font-size: 14px; color: #333; }
    .align-right { text-align: right !important; }

    .financial-summary { width: 350px; float: right; margin: 0 30px 40px 0; position: relative; z-index: 2; }
    .summary-row { display: flex; justify-content: space-between; padding: 12px 15px; font-size: 14px; border-bottom: 1px solid #edf2f4; }
    .summary-row.highlight-paid { background: #e6fcf5; color: #0ca678; border-radius: 6px; margin-top: 5px; border: none; font-weight: bold;}
    .summary-row.highlight-balance { background: #fff5f5; border-left: 4px solid #e63946; margin-top: 10px; font-size: 16px; color: #e63946; border-radius: 4px; font-weight: bold;}

    .receipt-footer { clear: both; display: flex; justify-content: space-between; align-items: flex-end; padding: 15px; margin-top: 10px; background: #f8f9fa; border-top: 1px solid #edf2f4; border-radius: 0 0 12px 12px; }
    .footer-note p { font-size: 11px; color: #8d99ae; font-style: italic; margin-bottom: 5px; }
    .signature-box { text-align: center; }
    .signature-line { width: 180px; border-top: 1px solid #2b2d42; margin-bottom: 10px; }
    .signature-box p { font-size: 12px; font-weight: bold; color: var(--primary); }

    .watermark-logo img { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 400px; height: 400px; opacity: 0.05; z-index: 1; pointer-events: none; }
}

/* ==========================================
   📱 10. MOBILE RESPONSIVENESS (UPDATED)
   ========================================== */
.mobile-menu-btn {
    display: none; 
    position: fixed; 
    top: 15px;      /* Moved from bottom to top */
    right: 15px;    /* Snug against the right edge */
    width: 45px; 
    height: 45px; 
    background: var(--primary); 
    color: white;
    border: none; 
    border-radius: 8px; /* Changed to rounded square for top-bar aesthetics */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 10000; 
    cursor: pointer; 
    align-items: center; 
    justify-content: center; 
    font-size: 20px;
}

.mobile-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px); z-index: 999; opacity: 0; transition: opacity 0.3s ease;
}
.mobile-overlay.active { display: block; opacity: 1; }

@media (max-width: 1024px) {
    .dashboard-split-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 850px) {
    .mobile-menu-btn { display: flex; }
    
    .sidebar {
        position: fixed; left: -320px; top: 0; height: 100vh; width: 280px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 5px 0 25px rgba(0,0,0,0.5); z-index: 1000;
    }
    .sidebar.active { left: 0; }

    /* 🚨 Pushed content down to prevent overlap with the top-right button */
    .main-content { 
        padding: 80px 15px 30px 15px; 
        max-width: 100vw; 
        overflow-x: hidden; 
    }

    .dashboard-header { flex-direction: column; align-items: flex-start; }
    .quick-actions { width: 100%; flex-direction: column; margin-top: 15px; }
    .quick-actions button { width: 100%; justify-content: center; }

    .stats-grid, .form-grid, .analytics-grid { grid-template-columns: 1fr; }
    .fee-type-toggle { flex-direction: column; gap: 15px; }
    
    /* 🚨 Fix for Latest Transactions & Collection Status Cards Overflowing */
    .card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden; /* Traps the table inside the card */
        padding: 15px; /* Reduces padding slightly to maximize screen space */
    }

    /* 🚨 Forces the Table to become swipeable horizontally */
    .table-responsive {
        width: 100%; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; /* Enables smooth swiping on iOS */
        border: 1px solid var(--border); 
        border-radius: 8px;
        display: block; 
    }
    table.premium-table { 
        min-width: 550px; /* Forces the table to stay wide enough to read, enabling the swipe */
    }

    /* 🚨 Fix for Chart Resizing */
    .collection-ring-container {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    #miniCollectionChart {
        max-width: 100% !important; /* Prevents the canvas from drawing outside its box */
    }

    /* Modals */
    .premium-modal { width: 95%; margin: 10% auto; padding: 0; display: flex; flex-direction: column; max-height: 90vh;}
    .modal-body-content { grid-template-columns: 1fr; padding: 15px; gap: 15px; }
    .student-profile-grid { flex-direction: row; flex-wrap: wrap; }
}












/* ==========================================
   🔄 REFRESH BUTTON STYLES
   ========================================== */
.btn-refresh {
    background: transparent;
    border: 2px solid #0ea5e9;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover Effect: Lifts up, borders glow primary blue */
.btn-refresh:hover:not(:disabled) {
    background: var(--input-bg);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(3, 105, 161, 0.15);
    transform: translateY(-2px);
}

/* Icon Animation: Rotates smoothly when you hover over the button */
.btn-refresh:not(:disabled) i {
    transition: transform 0.5s ease;
}
.btn-refresh:hover:not(:disabled) i {
    transform: rotate(180deg);
}

/* Disabled (Fetching) State: Greys out safely while spinning */
.btn-refresh:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--input-bg);
    border-color: var(--border);
    transform: none;
    box-shadow: none;
}













/* ==========================================
   🔍 INTERACTIVE TABLE HEADERS (REPORTS)
   ========================================== */
.sortable-filter-th {
    vertical-align: top;
    min-width: 140px;
}

.th-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    padding-bottom: 8px;
    user-select: none;
    transition: color 0.2s ease;
}

.th-header:hover {
    color: var(--primary);
}

.th-header i {
    color: var(--text-muted);
    font-size: 12px;
}

.th-filter {
    width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-main);
    font-weight: normal;
    transition: all 0.2s;
}

.th-filter:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.1);
    outline: none;
}















/* ==========================================
   📸 PHOTO UPLOAD & GALLERY SYSTEM
   ========================================== */
.photo-dropzone {
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    background: var(--input-bg);
    cursor: pointer;
    transition: all 0.3s ease;
}
.photo-dropzone:hover, .photo-dropzone.dragover {
    background: rgba(3, 105, 161, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(3, 105, 161, 0.1);
}
.photo-dropzone p { color: var(--text-muted); font-size: 14px; font-weight: 500; }

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.photo-thumbnail-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid transparent;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: 0.2s;
}
.photo-thumbnail-card.is-primary { border-color: var(--primary); }
.photo-thumbnail-card img {
    width: 100%; height: 100%; object-fit: cover; transition: 0.3s;
}
.photo-thumbnail-card:hover img { transform: scale(1.05); }

/* Overlay Controls */
.photo-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5); opacity: 0;
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
    transition: opacity 0.2s ease;
}
.photo-thumbnail-card:hover .photo-overlay { opacity: 1; }
.btn-photo-action {
    background: rgba(255,255,255,0.9); border: none; border-radius: 4px;
    padding: 6px 10px; font-size: 12px; font-weight: bold; cursor: pointer;
    transition: 0.2s; width: 80%;
}
.btn-photo-action.set-primary:hover { background: var(--primary); color: white; }
.btn-photo-action.remove:hover { background: var(--danger); color: white; }
.primary-badge {
    position: absolute; top: 5px; left: 5px;
    background: var(--primary); color: white;
    font-size: 10px; padding: 3px 6px; border-radius: 4px; font-weight: bold;
}

/* Gallery Viewer */
.student-gallery-card { background: var(--card-bg); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.gallery-main-image-container { position: relative; width: 100%; height: 250px; background: #000; cursor: pointer; }
.gallery-main-image-container img { width: 100%; height: 100%; object-fit: contain; transition: opacity 0.3s; }
.gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,0.5); color: white; border: none;
    width: 35px; height: 35px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.gallery-nav:hover { background: var(--primary); }
.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }
.gallery-counter {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.6); color: white; font-size: 12px; padding: 4px 8px; border-radius: 12px;
}
.gallery-thumbnail-strip { display: flex; gap: 8px; padding: 10px; overflow-x: auto; background: var(--input-bg); }
.strip-thumb {
    width: 50px; height: 50px; border-radius: 6px; cursor: pointer;
    object-fit: cover; opacity: 0.6; border: 2px solid transparent; transition: 0.2s;
}
.strip-thumb:hover { opacity: 1; }
.strip-thumb.active { opacity: 1; border-color: var(--primary); }

/* Fullscreen Lightbox */
#lightbox-image { max-width: 90%; max-height: 90vh; border-radius: 8px; box-shadow: 0 0 50px rgba(0,0,0,0.5); }
.close-lightbox { position: absolute; top: 20px; right: 30px; font-size: 40px; color: white; cursor: pointer; transition: 0.2s; }
.close-lightbox:hover { color: var(--danger); transform: scale(1.1); }

/* Skeleton Loading Animation */
.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--input-bg) 50%, var(--border) 75%); background-size: 200% 100%; animation: loading 1.5s infinite; }
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }








