/* =============================================
   Fee Management System - Modern Design
   Version 2.0 - Professional & Contemporary
   ============================================= */

/* ===== CSS Variables ===== */
:root {
    /* Modern Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Import Inter Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

.container-fluid {
    flex: 1;
    padding: 2rem;
}

/* ===== Navigation Bar ===== */
.navbar {
    background: white !important;
    box-shadow: var(--shadow-md);
    padding: 0 0;
    min-height: 69px;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar .container-fluid {
    padding-top: 0;
    padding-bottom: 0;
}

.navbar-brand {
    padding-top: 0.57rem;
    padding-bottom: 0.57rem;
}

.navbar .nav-link {
    padding-top: 0.69rem !important;
    padding-bottom: 0.69rem !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900) !important;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.navbar-brand i {
    color: var(--primary);
    font-size: 1.1rem;
}

.nav-link {
    color: var(--gray-700) !important;
    font-weight: 500;
    padding: 0.25rem 0.75rem !important;
    border-radius: var(--radius);
    transition: var(--transition-fast);
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--primary) !important;
}

.nav-link i {
    margin-right: 0.375rem;
}

/* ===== Academic Session Selector ===== */
.session-selector-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.session-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
}

.session-label i {
    margin-right: 0.25rem;
    color: var(--primary);
}

.session-selector-btn {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.45rem 1.15rem;
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
    color: var(--gray-700);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.session-selector-btn:hover,
.session-selector-btn:focus {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.session-selector-btn:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.session-selector-btn i {
    margin-right: 0.3rem;
    font-size: 0.8rem;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.625rem 1rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -250px;
    right: -250px;
    animation: float 6s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    bottom: -200px;
    left: -200px;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(20px); }
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.login-header {
    background: var(--gradient-primary);
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-header i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    opacity: 0.9;
    font-weight: 500;
}

.login-body {
    padding: 2.5rem 2rem;
}

.login-body .form-control {
    border-radius: var(--radius-md);
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--gray-200);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.login-body .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-login {
    border-radius: var(--radius-md);
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    font-size: 1rem;
    background: var(--gradient-primary);
    border: none;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== Dashboard Cards ===== */
.dashboard-card {
    border-radius: var(--radius-xl);
    border: none;
    background: white;
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
    overflow: hidden;
    cursor: pointer;
}

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

a .dashboard-card h3,
a .dashboard-card p {
    color: inherit;
}

.dashboard-card .card-body {
    padding: 2rem;
}

.dashboard-card .icon-box {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-lg);
}

.dashboard-card h3 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.dashboard-card p {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.95rem;
    margin: 0;
}

.bg-gradient-primary {
    background: var(--gradient-primary);
}

.bg-gradient-success {
    background: var(--gradient-success);
}

.bg-gradient-danger {
    background: var(--gradient-danger);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.bg-gradient-info {
    background: var(--gradient-info);
}

.bg-gradient-purple {
    background: var(--gradient-purple);
}

/* ===== Cards ===== */
.card-custom {
    border-radius: var(--radius-xl);
    border: none;
    background: white;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-custom .card-header {
    background: white;
    border-bottom: 2px solid var(--gray-100);
    padding: 1.5rem 1.75rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--gray-900);
}

.card-custom .card-header i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.card-custom .card-body {
    padding: 1.75rem;
}

/* ===== Tables ===== */
.table-custom {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: none;
}

.table-custom thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.table-custom thead th {
    border: none;
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-700);
}

.table-custom tbody tr {
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--gray-100);
}

.table-custom tbody tr:last-child {
    border-bottom: none;
}

.table-custom tbody tr:hover {
    background-color: var(--gray-50);
}

.table-custom tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    color: var(--gray-800);
}

.table-custom tfoot {
    background: var(--gray-50);
    border-top: 2px solid var(--gray-200);
}

.table-custom tfoot th {
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* ===== Buttons ===== */
.btn-custom {
    border-radius: var(--radius-md);
    padding: 0.625rem 1.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-custom i {
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    background: #0891b2;
    color: white;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.btn-sm.btn-icon {
    width: 36px;
    height: 36px;
}

/* ===== Forms ===== */
.form-control-custom {
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
    padding: 0.75rem 1rem;
    transition: var(--transition-fast);
    font-size: 0.9375rem;
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.form-label-custom {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.form-select-custom {
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
    padding: 0.75rem 1rem;
    transition: var(--transition-fast);
}

.form-select-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ===== Badges ===== */
.badge-custom {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-paid {
    background: var(--success);
    color: white;
}

.status-partial {
    background: var(--warning);
    color: white;
}

.status-unpaid {
    background: var(--danger);
    color: white;
}

/* ===== Alerts ===== */
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 1rem 1.25rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #cffafe;
    color: #164e63;
}

/* ===== Receipt Styles ===== */
.receipt-container {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    margin: 0 auto;
}

.receipt-header {
    border-bottom: 3px solid var(--primary);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.receipt-header h2 {
    color: var(--primary);
    font-weight: 800;
    margin: 0;
}

.receipt-table table {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.receipt-table .table {
    margin-bottom: 0;
}

.receipt-footer {
    border-top: 2px solid var(--gray-200);
    padding-top: 1.5rem;
    margin-top: 2rem;
}

/* ===== Footer ===== */
footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 6px;
    border: 3px solid var(--gray-100);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ===== Responsive Design ===== */
/* ===== Responsive: Tablet (max-width: 768px) ===== */
@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }

    .dashboard-card .card-body {
        padding: 1.25rem;
    }

    .dashboard-card h3 {
        font-size: 1.75rem;
    }

    .dashboard-card .icon-box {
        width: 55px;
        height: 55px;
        font-size: 1.25rem;
    }

    .card-custom .card-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .card-custom .card-body {
        padding: 1rem;
    }

    .table-custom,
    .table {
        font-size: 0.85rem;
    }

    .receipt-container {
        padding: 1.5rem;
    }

    /* Session selector */
    .session-selector-wrapper {
        margin-bottom: 0.5rem;
    }

    /* Page headings */
    h2.mb-4 {
        font-size: 1.25rem;
    }

    h2.mb-4 .btn {
        font-size: 0.78rem;
        padding: 0.3rem 0.6rem;
    }

    /* Navbar adjustments */
    .navbar {
        min-height: auto;
        padding: 0.25rem 0;
    }

    .navbar .nav-link {
        padding: 0.4rem 0.75rem !important;
    }

    .navbar-brand {
        font-size: 0.9rem;
    }

    /* Bulk action buttons in card headers */
    .card-header .btn-sm {
        font-size: 0.72rem;
        padding: 0.2rem 0.5rem;
    }
}

/* ===== Responsive: Mobile (max-width: 576px) ===== */
@media (max-width: 576px) {
    .container-fluid {
        padding: 0.75rem;
    }

    /* Login */
    .login-container {
        padding: 1rem;
    }

    .login-card {
        margin: 0.5rem;
        max-width: 100%;
        border-radius: var(--radius-lg);
    }

    .login-header {
        padding: 1.5rem 1.25rem;
    }

    .login-header i {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }

    .login-header h2 {
        font-size: 1.25rem;
    }

    .login-header p {
        font-size: 0.85rem;
    }

    .login-header img {
        height: 45px !important;
    }

    .login-body {
        padding: 1.5rem 1.25rem;
    }

    .login-body .form-control {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .login-body .form-label {
        font-size: 0.85rem;
    }

    .btn-login {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .login-container::before {
        width: 250px;
        height: 250px;
        top: -125px;
        right: -125px;
    }

    .login-container::after {
        width: 200px;
        height: 200px;
        bottom: -100px;
        left: -100px;
    }

    /* Buttons */
    .btn-custom {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Navbar */
    .navbar-brand {
        font-size: 0.85rem;
    }

    .navbar-brand img {
        height: 18px !important;
    }

    .navbar .nav-link {
        font-size: 0.85rem;
    }

    /* Page headings - stack title and button */
    h2.mb-4 {
        font-size: 1.1rem;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    h2.mb-4 .float-end {
        float: none !important;
        align-self: stretch;
        text-align: center;
    }

    /* Dashboard cards - 2 per row */
    .dashboard-card .card-body {
        padding: 1rem;
        text-align: center;
    }

    .dashboard-card h3 {
        font-size: 1.5rem;
    }

    .dashboard-card .icon-box {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        margin: 0 auto 0.5rem;
    }

    .dashboard-card p {
        font-size: 0.78rem;
    }

    /* Tables */
    .table-custom,
    .table {
        font-size: 0.78rem;
    }

    .table th,
    .table td {
        padding: 0.4rem 0.35rem;
        white-space: nowrap;
    }

    .table .btn-sm,
    .table .btn-icon {
        padding: 0.15rem 0.35rem;
        font-size: 0.7rem;
    }

    /* Cards */
    .card-custom .card-header {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .card-custom .card-body {
        padding: 0.75rem;
    }

    /* Session selector */
    .session-selector-wrapper {
        margin-bottom: 0.35rem;
    }

    .session-selector-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.65rem;
    }

    /* Footer */
    footer .d-flex {
        flex-direction: column !important;
        text-align: center;
        gap: 0.25rem;
    }

    footer span,
    footer small {
        font-size: 0.75rem;
    }

    /* Forms */
    .form-control-custom,
    .form-control,
    .form-select {
        font-size: 0.85rem;
    }

    .form-label-custom {
        font-size: 0.85rem;
    }

    /* Filter section buttons */
    form .btn {
        width: 100%;
        margin-bottom: 0.35rem;
    }

    form .col-md-3 .btn {
        width: auto;
    }

    /* Pagination */
    .pagination-custom .page-link {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
        min-width: 32px;
    }

    /* Receipt */
    .receipt-container {
        padding: 1rem;
    }

    .receipt-container h4 {
        font-size: 1.1rem;
    }

    /* Alerts */
    .alert {
        font-size: 0.85rem;
        padding: 0.6rem 0.85rem;
    }

    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Badge sizing */
    .badge {
        font-size: 0.65rem;
    }
}

/* ===== Responsive: Extra Small (max-width: 400px) ===== */
@media (max-width: 400px) {
    .container-fluid {
        padding: 0.5rem;
    }

    .navbar-brand {
        font-size: 0.78rem;
    }

    h2.mb-4 {
        font-size: 1rem;
    }

    .dashboard-card h3 {
        font-size: 1.25rem;
    }

    .dashboard-card .icon-box {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .table-custom,
    .table {
        font-size: 0.72rem;
    }

    .table th,
    .table td {
        padding: 0.3rem 0.25rem;
    }

    .session-selector-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .pagination-custom .page-link {
        padding: 0.25rem 0.45rem;
        font-size: 0.72rem;
        min-width: 28px;
    }
}

/* ===== Report Print Styles ===== */
@media print {
    /* Page setup */
    @page {
        size: A4 landscape;
        margin: 10mm 12mm;
    }

    /* Force background colors to print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: #fff !important;
        font-size: 10pt !important;
        color: #000 !important;
        line-height: 1.4;
        min-height: auto !important;
        display: block !important;
    }

    /* ---- Hide non-printable elements ---- */
    .navbar,
    footer,
    .no-print,
    .session-selector-wrapper,
    .alert,
    #darkModeToggle {
        display: none !important;
    }

    /* Hide all buttons */
    .btn,
    button {
        display: none !important;
    }

    /* Hide filter form rows and chart rows */
    .row:has(form[method]) {
        display: none !important;
    }
    .row:has(canvas) {
        display: none !important;
    }

    /* Hide the page h2 (replaced by print header) */
    h2.mb-4 {
        display: none !important;
    }

    /* ---- Print Header (visible only in print) ---- */
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 15px;
        padding-bottom: 12px;
        border-bottom: 3px double #333;
    }

    .print-header .print-school-logo {
        height: 40px;
        margin-bottom: 4px;
    }

    .print-header .print-school-name {
        font-size: 18pt;
        font-weight: 700;
        color: #1a1a2e;
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 1px;
    }

    .print-header .print-school-address {
        font-size: 9pt;
        color: #555;
        margin-bottom: 6px;
    }

    .print-header .print-report-title {
        font-size: 12pt;
        font-weight: 600;
        color: #333;
        margin-top: 6px;
        padding: 3px 20px;
        display: inline-block;
        border: 1.5px solid #666;
        border-radius: 3px;
        background: #f5f5f5;
        letter-spacing: 0.5px;
    }

    .print-header .print-session {
        font-size: 9pt;
        color: #555;
        margin-top: 5px;
    }

    /* ---- Print Footer (every page bottom) ---- */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 7.5pt;
        color: #999;
        border-top: 1px solid #ddd;
        padding-top: 3px;
        background: #fff;
    }

    /* ---- Container ---- */
    .container-fluid {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ---- Cards ---- */
    .card-custom {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: auto;
        margin-bottom: 8px !important;
    }

    /* Only prevent page breaks inside small summary cards */
    .card-custom.bg-light,
    .bg-light {
        background-color: #f8f8f8 !important;
        break-inside: avoid;
    }

    .card-body {
        padding: 8px 12px !important;
    }

    .card-body h6 {
        font-size: 8pt;
        color: #555;
        margin-bottom: 2px;
    }

    .card-body h3 {
        font-size: 13pt;
        margin-bottom: 0;
    }

    /* ---- Card Header (table section) ---- */
    .card-header {
        background-color: #eee !important;
        border-bottom: 1px solid #ccc !important;
        padding: 5px 12px !important;
        font-size: 9pt !important;
        font-weight: 600;
        color: #333 !important;
    }

    /* ---- Tables ---- */
    .table {
        font-size: 9pt !important;
        margin-bottom: 0 !important;
        width: 100% !important;
    }

    .table thead th {
        background-color: #e0e0e0 !important;
        border: 1px solid #aaa !important;
        padding: 5px 8px !important;
        font-weight: 700 !important;
        font-size: 8pt;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        color: #222 !important;
    }

    .table tbody td {
        border: 1px solid #ddd !important;
        padding: 4px 8px !important;
        color: #000 !important;
    }

    .table tbody tr:nth-child(even) td {
        background-color: #f9f9f9 !important;
    }

    .table tfoot th,
    .table tfoot td {
        background-color: #d9d9d9 !important;
        border: 1px solid #aaa !important;
        padding: 5px 8px !important;
        font-weight: 700 !important;
        font-size: 9pt;
        color: #000 !important;
    }

    /* ---- Badges ---- */
    .badge {
        border: 1px solid #888 !important;
        font-size: 7pt !important;
        padding: 2px 6px !important;
        font-weight: 600 !important;
    }

    .badge.bg-success {
        background-color: #d4edda !important;
        color: #155724 !important;
        border-color: #28a745 !important;
    }

    .badge.bg-danger {
        background-color: #f8d7da !important;
        color: #721c24 !important;
        border-color: #dc3545 !important;
    }

    .badge.bg-warning {
        background-color: #fff3cd !important;
        color: #856404 !important;
        border-color: #ffc107 !important;
    }

    .badge.bg-info {
        background-color: #d1ecf1 !important;
        color: #0c5460 !important;
        border-color: #17a2b8 !important;
    }

    .badge.bg-primary {
        background-color: #e0e0ff !important;
        color: #3b3b8f !important;
        border-color: #6366f1 !important;
    }

    .badge.status-paid {
        background-color: #d4edda !important;
        color: #155724 !important;
        border: 1px solid #28a745 !important;
    }

    .badge.status-unpaid {
        background-color: #f8d7da !important;
        color: #721c24 !important;
        border: 1px solid #dc3545 !important;
    }

    .badge.status-partial {
        background-color: #fff3cd !important;
        color: #856404 !important;
        border: 1px solid #ffc107 !important;
    }

    /* ---- Text Colors ---- */
    .text-success {
        color: #0a6b2e !important;
    }

    .text-danger {
        color: #a71d2a !important;
    }

    .text-warning {
        color: #856404 !important;
    }

    .text-muted {
        color: #666 !important;
    }

    /* ---- Links ---- */
    a {
        text-decoration: none !important;
        color: #000 !important;
    }

    /* ---- Receipt container ---- */
    .receipt-container {
        box-shadow: none !important;
        padding: 0 !important;
    }

    /* ---- Spacing ---- */
    .row.mb-4 {
        margin-bottom: 10px !important;
    }

    .mb-4 {
        margin-bottom: 10px !important;
    }

    .mt-4 {
        margin-top: 0 !important;
    }

    /* ---- Responsive columns forced to side-by-side ---- */
    .col-md-3 {
        width: 25% !important;
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    .col-md-4 {
        width: 33.333% !important;
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }
}

/* ===== Utility Classes ===== */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hover-scale {
    transition: var(--transition);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.shadow-custom {
    box-shadow: var(--shadow-lg);
}

/* ===== Pagination ===== */
.pagination-custom {
    gap: 0.25rem;
}

.pagination-custom .page-item .page-link {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray-700);
    font-weight: 600;
    padding: 0.5rem 0.875rem;
    transition: var(--transition-fast);
    min-width: 40px;
    text-align: center;
}

.pagination-custom .page-item .page-link:hover {
    background: var(--gray-100);
    border-color: var(--primary-light);
    color: var(--primary);
}

.pagination-custom .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.pagination-custom .page-item.disabled .page-link {
    background: var(--gray-50);
    color: var(--gray-400);
    border-color: var(--gray-200);
}

/* ===== Page Heading ===== */
h2.mb-4 {
    font-weight: 800;
    color: var(--gray-900);
    font-size: 1.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

h2.mb-4 i {
    color: var(--primary);
}

/* ===== Loading State ===== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay.show {
    display: flex;
}

/* ===== Developer Link Tooltip ===== */
.developer-link {
    position: relative;
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    transition: color 0.2s ease;
}

.developer-link:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

.developer-link::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    margin-bottom: 4px;
}

.developer-link:hover::after {
    opacity: 1;
}

[data-theme="dark"] .developer-link::after {
    background: #f3f4f6;
    color: #0f172a;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    /* Invert neutral gray scale */
    --gray-50: #1e293b;
    --gray-100: #1e293b;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-400: #6b7280;
    --gray-500: #9ca3af;
    --gray-600: #d1d5db;
    --gray-700: #d1d5db;
    --gray-800: #e5e7eb;
    --gray-900: #f3f4f6;

    /* Shadows for dark bg */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] body {
    background: #0f172a;
    color: #f3f4f6;
}

/* Navbar */
[data-theme="dark"] .navbar {
    background: #1e293b !important;
    border-bottom-color: #374151;
}

[data-theme="dark"] .navbar-brand {
    color: #f3f4f6 !important;
}

[data-theme="dark"] .nav-link {
    color: #d1d5db !important;
}

[data-theme="dark"] .nav-link:hover {
    background: #374151;
    color: var(--primary-light) !important;
}

[data-theme="dark"] .navbar-toggler-icon {
    filter: invert(1);
}

/* Dropdowns */
[data-theme="dark"] .dropdown-menu {
    background: #1e293b;
    border: 1px solid #374151;
}

[data-theme="dark"] .dropdown-item {
    color: #d1d5db;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background: #374151;
    color: var(--primary-light);
}

[data-theme="dark"] .dropdown-item.active {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .dropdown-header {
    color: #9ca3af;
}

[data-theme="dark"] .dropdown-divider {
    border-color: #374151;
}

/* Cards */
[data-theme="dark"] .card-custom,
[data-theme="dark"] .dashboard-card {
    background: #1e293b;
}

[data-theme="dark"] .card-custom .card-header {
    background: #1e293b;
    border-bottom-color: #374151;
    color: #f3f4f6;
}

[data-theme="dark"] .card-custom .card-body {
    color: #e5e7eb;
}

[data-theme="dark"] .dashboard-card h3 {
    color: #f3f4f6;
}

[data-theme="dark"] .dashboard-card p {
    color: #9ca3af;
}

/* Tables */
[data-theme="dark"] .table-custom {
    background: #1e293b;
}

[data-theme="dark"] .table-custom thead {
    background: #0f172a;
    border-bottom-color: #374151;
}

[data-theme="dark"] .table-custom thead th {
    color: #d1d5db;
}

[data-theme="dark"] .table-custom tbody tr {
    border-bottom-color: #374151;
}

[data-theme="dark"] .table-custom tbody tr:hover {
    background-color: #2d3748;
}

[data-theme="dark"] .table-custom tbody td {
    color: #e5e7eb;
}

[data-theme="dark"] .table-custom tfoot {
    background: #0f172a;
    border-top-color: #374151;
}

[data-theme="dark"] .table-custom tfoot th {
    color: #f3f4f6;
}

/* Generic table dark mode */
[data-theme="dark"] .table {
    color: #e5e7eb;
    background-color: #1e293b;
    border-color: #374151;
}

[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .table thead th {
    background-color: #0f172a;
    color: #d1d5db;
    border-bottom-color: #374151;
}

[data-theme="dark"] .table tbody td {
    color: #e5e7eb;
}

[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: #2d3748;
    color: #f3f4f6;
}

/* Table bordered */
[data-theme="dark"] .table-bordered {
    border-color: #374151 !important;
}

[data-theme="dark"] .table-bordered > :not(caption) > * > * {
    border-color: #374151 !important;
}

/* Table light (used in thead) */
[data-theme="dark"] .table-light {
    background: #0f172a !important;
    color: #d1d5db !important;
}

[data-theme="dark"] .table-light th,
[data-theme="dark"] .table-light td {
    background: #0f172a !important;
    color: #d1d5db !important;
}

/* Table status row classes */
[data-theme="dark"] .table-success {
    background-color: #064e3b !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .table-success > th,
[data-theme="dark"] .table-success > td {
    background-color: #064e3b !important;
    color: #6ee7b7 !important;
    border-color: #065f46 !important;
}

[data-theme="dark"] .table-info {
    background-color: #164e63 !important;
    color: #67e8f9 !important;
}

[data-theme="dark"] .table-info > th,
[data-theme="dark"] .table-info > td {
    background-color: #164e63 !important;
    color: #67e8f9 !important;
    border-color: #155e75 !important;
}

[data-theme="dark"] .table-warning {
    background-color: #78350f !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .table-warning > th,
[data-theme="dark"] .table-warning > td {
    background-color: #78350f !important;
    color: #fcd34d !important;
    border-color: #92400e !important;
}

[data-theme="dark"] .table-danger {
    background-color: #7f1d1d !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .table-danger > th,
[data-theme="dark"] .table-danger > td {
    background-color: #7f1d1d !important;
    color: #fca5a5 !important;
    border-color: #991b1b !important;
}

/* Table striped */
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #162033;
    color: #e5e7eb;
}

/* Table sm */
[data-theme="dark"] .table-sm {
    color: #e5e7eb;
}

/* Forms */
[data-theme="dark"] .form-control-custom,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #0f172a;
    border-color: #374151;
    color: #f3f4f6;
}

[data-theme="dark"] .form-control-custom:focus,
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: #0f172a;
    border-color: var(--primary);
    color: #f3f4f6;
}

[data-theme="dark"] .form-control::placeholder {
    color: #6b7280;
}

[data-theme="dark"] .form-label-custom {
    color: #d1d5db;
}

[data-theme="dark"] .input-group-text {
    background: #374151;
    border-color: #374151;
    color: #d1d5db;
}

/* Alerts (dark tinted) */
[data-theme="dark"] .alert-success {
    background: #064e3b;
    color: #6ee7b7;
    border: 1px solid #065f46;
}

[data-theme="dark"] .alert-danger {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #991b1b;
}

[data-theme="dark"] .alert-warning {
    background: #78350f;
    color: #fcd34d;
    border: 1px solid #92400e;
}

[data-theme="dark"] .alert-info {
    background: #164e63;
    color: #67e8f9;
    border: 1px solid #155e75;
}

/* Pagination */
[data-theme="dark"] .pagination-custom .page-item .page-link {
    background: #1e293b;
    border-color: #374151;
    color: #d1d5db;
}

[data-theme="dark"] .pagination-custom .page-item .page-link:hover {
    background: #374151;
    color: var(--primary-light);
}

[data-theme="dark"] .pagination-custom .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

[data-theme="dark"] .pagination-custom .page-item.disabled .page-link {
    background: #0f172a;
    color: #4b5563;
    border-color: #374151;
}

/* Page headings */
[data-theme="dark"] h2.mb-4 {
    color: #f3f4f6;
}

/* Receipt */
[data-theme="dark"] .receipt-container {
    background: #1e293b;
    color: #e5e7eb;
}

[data-theme="dark"] .receipt-footer {
    border-top-color: #374151;
}

/* Login page (keep light - separate context) */

/* Footer */
[data-theme="dark"] footer {
    background: #1e293b;
    border-top-color: #374151;
    color: #9ca3af;
}

[data-theme="dark"] footer .text-center {
    background-color: rgba(0, 0, 0, 0.2) !important;
    color: #9ca3af;
}

/* Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1e293b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-color: #1e293b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Bootstrap overrides */
[data-theme="dark"] .bg-light {
    background: #1e293b !important;
}

[data-theme="dark"] .text-muted {
    color: #9ca3af !important;
}

[data-theme="dark"] .card {
    background: #1e293b;
    border-color: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .card-header {
    background: #1e293b;
    border-bottom-color: #374151;
    color: #f3f4f6;
}

[data-theme="dark"] .modal-content {
    background: #1e293b;
    border-color: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #374151;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #374151;
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

[data-theme="dark"] .form-check-input {
    background-color: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Dark mode toggle button */
#darkModeToggle {
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 0.5rem;
}

#darkModeToggle:hover {
    color: var(--primary-light) !important;
}

/* Smooth theme transition */
body,
.navbar,
.card-custom,
.dashboard-card,
.dropdown-menu,
footer,
.form-control,
.form-control-custom,
.table-custom,
.table {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===== Student Profile Modal ===== */
.student-profile-link {
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.student-profile-link:hover {
    color: var(--primary-dark);
    text-decoration: underline !important;
}

/* ===== Student Profile Modal ===== */
#studentProfileModal {
    z-index: 1060;
}

#studentProfileModal .modal-content {
    border-radius: var(--radius-md);
    background-color: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#studentProfileModal .modal-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--gray-200);
}

#studentProfileModal .modal-body {
    background-color: #ffffff;
}

#studentProfileModal .modal-footer {
    background-color: #ffffff;
    border-top: 1px solid var(--gray-200);
}

#studentProfileModal .card {
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

#studentProfileModal .card-header {
    font-size: 0.9rem;
    font-weight: 700;
}

#studentProfileModal .card-body small.text-muted {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Fee Mode Toggle ===== */
.fee-mode-switch {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.fee-mode-switch .form-check-input {
    width: 3em;
    height: 1.5em;
    cursor: pointer;
    margin-right: 0.75rem;
    margin-top: 0;
    flex-shrink: 0;
}

.fee-mode-switch .form-check-label {
    margin-bottom: 0;
    padding-top: 0;
    display: inline-block;
}

.fee-mode-switch .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Make the label and toggle appear on same line */
.form-label-custom + .fee-mode-switch {
    display: inline-flex;
    margin-left: 1rem;
    margin-top: 0 !important;
    vertical-align: middle;
}

.col-md-12 .form-label-custom {
    display: inline-block;
    margin-bottom: 0;
    vertical-align: middle;
}

/* ===== Monthly Fee Structure Table ===== */
.monthly-fee-form .form-control-sm {
    min-width: 80px;
}

.monthly-fee-form .table th,
.monthly-fee-form .table td {
    vertical-align: middle;
    white-space: nowrap;
}

/* ===== Dark Mode: Student Profile & Fee Mode ===== */
[data-theme="dark"] .student-profile-link {
    color: var(--primary-light);
}

[data-theme="dark"] .student-profile-link:hover {
    color: #c7d2fe;
}

[data-theme="dark"] #studentProfileModal .modal-content {
    background-color: #1e293b;
    color: #f3f4f6;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] #studentProfileModal .modal-header {
    background-color: #1e293b;
    border-bottom-color: #374151;
    color: #f3f4f6;
}

[data-theme="dark"] #studentProfileModal .modal-body {
    background-color: #1e293b;
    color: #e5e7eb;
}

[data-theme="dark"] #studentProfileModal .modal-footer {
    background-color: #1e293b;
    border-top-color: #374151;
}

[data-theme="dark"] #studentProfileModal .card {
    background-color: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] #studentProfileModal .card-header {
    background-color: #4b5563;
    color: #f3f4f6;
}

[data-theme="dark"] #studentProfileModal .card-body {
    color: #e5e7eb;
}

[data-theme="dark"] #studentProfileModal .card-body small.text-muted {
    color: #9ca3af !important;
}

[data-theme="dark"] #studentProfileModal .table-light th {
    background-color: #4b5563;
    color: #f3f4f6;
}

[data-theme="dark"] #studentProfileModal .table {
    color: #e5e7eb;
}

[data-theme="dark"] #studentProfileModal .table > :not(caption) > * > * {
    background-color: transparent;
    color: #e5e7eb;
    border-bottom-color: #4b5563;
}

[data-theme="dark"] #studentProfileModal .border-primary {
    border-color: var(--primary) !important;
}

[data-theme="dark"] #studentProfileModal .border-success {
    border-color: var(--success) !important;
}

[data-theme="dark"] #studentProfileModal .border-danger {
    border-color: var(--danger) !important;
}
