/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    /* Brand Colors */
    --primary: #003366;       /* Navy Blue */
    --primary-dark: #002244;
    --secondary: #007bff;     /* Bright Blue */
    --accent: #ffc107;        /* Amber */
    
    /* Status Colors */
    --success: #28a745;       /* Green */
    --danger: #dc3545;        /* Red */
    --info: #17a2b8;          /* Teal */
    
    /* Layout Colors */
    --bg-body: #f4f6f9;       /* Light Grey */
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #6c757d;
    --border: #dee2e6;
    
    /* Dimensions */
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    
    /* Effects */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 6px;
    --transition: 0.3s ease;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: #333333;
    --primary: #1a237e; 
    --primary-dark: #000051;
}

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

body {
    /* Added 'Noto Sans Gujarati' for Gujarati support */
    font-family: 'Poppins', 'Noto Sans Gujarati', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }

/* =========================================
   2. LAYOUT (HEADER & SIDEBAR)
   ========================================= */
/* Header */
.main-header {
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
}

.header-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Sidebar */
.main-sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: var(--header-height);
    transition: var(--transition);
    z-index: 900;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

/* Sidebar Menu */
.sidebar-menu { padding: 20px 0; }

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    border-left: 4px solid transparent;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-menu li a:hover, 
.sidebar-menu li a.active {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar-menu li a i {
    width: 30px;
    font-size: 16px;
    text-align: center;
    margin-right: 10px;
}

/* Sidebar Collapse Logic */
body.sidebar-collapse .main-sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapse .sidebar-text { display: none; }
body.sidebar-collapse .main-wrapper { margin-left: var(--sidebar-collapsed); }
body.sidebar-collapse .sidebar-menu li a { justify-content: center; padding: 15px 0; }
body.sidebar-collapse .sidebar-menu li a i { margin-right: 0; font-size: 20px; }


/* ... [Keep all your previous CSS Sections 1-7 exactly as they were] ... */

/* =========================================
   8. MODALS & POPUPS (Added for add_fee.php)
   ========================================= */
#feeModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    overflow-y: auto; /* Allows scrolling on small screens */
    padding: 20px 0;
    align-items: flex-start; /* Aligns to top to allow scroll */
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    margin: 30px auto; /* Margin ensures it doesn't stick to edges */
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-body);
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-body {
    padding: 20px;
}

.close-btn {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.close-btn:hover { color: var(--danger); }

/* Read-Only Input Style */
.locked-input {
    background-color: #e9ecef !important;
    pointer-events: none; /* Disables clicking */
    font-weight: 600;
    color: #495057;
    border-color: #ced4da;
}

/* Main Content Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 30px;
    transition: var(--transition);
    min-height: calc(100vh - var(--header-height) - 60px); /* Minus header & footer */
}

/* =========================================
   3. FORMS, INPUTS & BUTTONS (FIXED)
   ========================================= */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 13px; }

/* The Fix for Overlapping Icons */
.input-with-icon { position: relative; width: 100%; }

.input-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    z-index: 5;
    pointer-events: none; /* Clicks pass through to input */
    width: 20px;
    text-align: center;
}

.form-control {
    width: 100%;
    height: 45px;
    padding: 10px 15px;
    font-size: 14px;
    color: var(--text-main);
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

/* Ensure text starts AFTER the icon */
.input-with-icon .form-control {
    padding-left: 50px !important; 
}

/* HIDE ICON ON FOCUS (To prevent overlap when typing) */
.input-with-icon:focus-within i {
    display: none;
}
.input-with-icon:focus-within .form-control {
    padding-left: 15px !important;
}

.form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Select Dropdown Arrow Fix */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='gray' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1.5;
}

.btn-block { width: 100%; display: block; }
.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-dark); }
.btn-secondary { background-color: #6c757d; color: #fff; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-success { background-color: var(--success); color: #fff; }
.btn-success:hover { background-color: #218838; }
.btn-danger { background-color: var(--danger); color: #fff; }

.icon-btn { 
    background: none; border: none; font-size: 18px; 
    color: var(--text-main); cursor: pointer; padding: 8px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(0,0,0,0.05); }

/* =========================================
   4. LOGIN PAGE
   ========================================= */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2f3 0%, #8e9eab 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-top: 5px solid var(--primary);
    text-align: center;
}

.login-header { margin-bottom: 30px; }
.login-header img { width: 100px; margin-bottom: 10px; }
.login-header h3 { color: var(--primary); font-weight: 700; margin-bottom: 5px; }
.login-header p { color: var(--text-muted); font-size: 13px; }

/* =========================================
   5. DASHBOARD STATS & CARDS
   ========================================= */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
}

.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}
.card-header h3 { font-size: 18px; color: var(--text-main); margin: 0; font-weight: 600; }

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--secondary);
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-info h3 { font-size: 26px; font-weight: 700; margin: 0 0 5px 0; }
.stat-info p { font-size: 13px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; margin: 0; }
.stat-icon { font-size: 40px; opacity: 0.2; }

/* Badge */
.badge-year {
    background: var(--primary); color: #fff; 
    padding: 5px 12px; border-radius: 20px; 
    font-size: 12px; font-weight: 600;
}

/* =========================================
   6. TABLES
   ========================================= */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background-color: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tr:hover { background-color: rgba(0,0,0,0.02); }

/* Action Icons */
.action-btn { 
    margin-right: 8px; padding: 6px; border-radius: 4px; display: inline-block; 
}
.action-edit { color: var(--secondary); background: rgba(0,123,255,0.1); }
.action-delete { color: var(--danger); background: rgba(220,53,69,0.1); }

/* =========================================
   7. FOOTER & UTILITIES
   ========================================= */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: auto;
    font-size: 13px;
}

.alert {
    padding: 15px; margin-bottom: 20px; border-radius: var(--radius);
    font-size: 14px;
}