/* E-SMP Main Stylesheet */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Spacing Utilities */
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.shadow-sm { box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.2s ease;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

/* Button utilities */
.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

/* Button color variants */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px !important;
    min-width: 250px;
    max-width: 250px;
    background: #0f2a56; /* deeper navy for refined look */
    color: white;
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 20px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    height: 80px; /* doubled as requested */
    width: auto;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}

.brand-text h3 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.brand-subtitle {
    font-size: 12px;
    color: #c8d6ff;
    margin: 0;
}

.sidebar-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: #d6e0ff;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #173a75;
    color: #ffffff;
}

.sidebar-menu a:focus {
    outline: 2px solid rgba(255,255,255,0.25);
    background: #173a75;
    color: #ffffff;
}

.main-content {
    flex: 1;
    background: #f8f9fa;
    padding: 20px;
}

/* Settings Tabs */
.tab {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tab:hover {
    background-color: #dee2e6;
    color: #212529;
    text-decoration: none;
}

.tab.active {
    background-color: #0d4ea6; /* Match the deep blue from finance tabs or screenshot */
    color: #ffffff;
    border-color: #0d4ea6;
}

/* Finance module tabs */
.finance-tabs {
    list-style: none; /* remove bullets */
    padding-left: 0;
    margin: 0;
    display: flex;
    border-bottom: 1px solid #e3e6f0;
}
.finance-tabs .nav-item {
    list-style: none; /* ensure no bullets on li */
    margin: 0;
}
.finance-tabs .nav-link {
    display: block;
    padding: 12px 16px;
    border: none;
    border-radius: 0;
    background: #f5f7fb;
    color: #1e2a4a;
    font-weight: 600;
    text-decoration: none;
}
.finance-tabs .nav-link:hover {
    background: #e9eef5;
    color: #12203a;
}
.finance-tabs .nav-link.active {
    background: #0d4ea6; /* deep blue active tab */
    color: #ffffff;
}

/* Clickable title switch (replaces tabs) */
.finance-switch {
    display: flex;
    gap: 12px;
    align-items: center;
}
.finance-switch .switch-link {
    font-size: 20px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 4px;
    background: #f5f7fb;
    color: #1e2a4a;
    text-decoration: none;
}
.finance-switch .switch-link:hover {
    background: #e9eef5;
    color: #12203a;
}
.finance-switch .switch-link.active {
    background: #0d4ea6;
    color: #ffffff;
}

.header {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    color: #2c3e50;
    letter-spacing: 0.2px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.card-header > div {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

/* Modal base styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal .modal-content {
    background-color: #fff;
    margin: auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Larger modal content for dense tables/forms */
.modal .modal-content.modal-large {
    max-width: 95vw;
}

/* Ensure extra-wide Bootstrap modal dialog uses near full viewport width */
.modal .modal-dialog.modal-xl {
    max-width: 95vw;
}

.modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.modal .close {
    cursor: pointer;
    font-size: 20px;
}


/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    color: #6c757d;
    font-size: 14px;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    -webkit-overflow-scrolling: touch;
    cursor: default; /* undo grab cursor */
}
.table-container.is-dragging {
    cursor: auto; /* undo grabbing cursor */
}

/* undo visible focus styling */
.table-container:focus {
    outline: none;
}

.table {
    width: 100%; /* undo max-content/min-width */
    border-collapse: collapse;
    table-layout: auto;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    white-space: normal; /* allow wrapping again */
    word-break: break-word; /* allow words to wrap */
    vertical-align: middle; /* undo top alignment */
}

.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: static; /* undo sticky header */
    top: auto;
    z-index: auto;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-primary {
    background: #667eea;
    border-color: #667eea;
}

.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
}

.btn-success {
    background: #28a745;
    border-color: #28a745;
}

.btn-danger {
    background: #dc3545;
    border-color: #dc3545;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Search and Filter */
.search-filter {
    background: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.search-row {
     gap: 15px;
     align-items: end;
 }

 /* Search group layout for filter bar */
 .search-group {
     display: flex;
     flex-wrap: wrap;
     gap: 12px;
     align-items: center;
 }
 .search-group > input, 
 .search-group > select {
     width: auto;
 }
 .search-group > input {
     flex: 2 1 300px;
 }
 .search-group > select {
     flex: 1 1 180px;
 }
 .search-group .btn {
     justify-self: start;
     width: max-content;
 }
 
 /* Larger, cleaner controls in filter bar */
 .search-filter .form-control {
     height: 44px;
     padding: 10px 12px;
     font-size: 16px;
     border-radius: 8px;
 }
 .search-filter .btn-sm {
     padding: 10px 16px;
     font-size: 15px;
     border-radius: 8px;
     height: 44px;
     display: inline-flex;
     align-items: center;
 }
 .search-filter .btn-sm i {
     margin-right: 6px;
 }
 
 /* Charts */
 .chart-container {
     position: relative;
     height: 400px;
     margin: 20px 0;
 }

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    .search-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .search-group {
        grid-template-columns: 1fr;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.hidden { display: none; }

/* Loading Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
html, body {
    width: 100%;
    overflow-x: auto; /* allow page-level horizontal scroll when content is wide */
}

/* Hide number input spinners globally */
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;
  appearance: textfield;
}
.main-content, .card, .search-filter, .table-container {
    max-width: none; /* remove viewport width constraint so full content is visible */
}
/* Table column alignment helpers */
.table th.col-actions, .table td.col-actions,
.table th.col-doc, .table td.col-doc {
    text-align: center;
}
.table td.col-money {
    text-align: right;
    white-space: nowrap;
}
/* Slightly reduce padding for dense tables */
#studentsTable th, #studentsTable td {
    padding: 8px 10px;
}
.table-container {
    overflow-x: auto;
}
#studentsTable {
    width: 100%; /* fit to container width */
    table-layout: fixed; /* enable fixed layout for consistent column widths */
}
/* Prevent letter-by-letter wrapping in headers and normal word breaks in cells */
.table thead th {
    white-space: nowrap;
}
.table td {
    word-break: normal; /* revert: avoid breaking words at arbitrary points */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive column adjustments for student table */
#studentsTable .col-name {
    max-width: 200px;
}

#studentsTable .col-actions .action-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
}

#studentsTable .col-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #studentsTable th, #studentsTable td {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    #studentsTable .col-actions .btn {
        padding: 3px 6px;
        font-size: 11px;
    }
    
#studentsTable .col-actions .action-buttons {
    gap: 2px;
}
}

/* Global Table Typography and Spacing */
:root {
    /* Default table sizing (normal) */
    --table-font-size: 14px;
    --table-line-height: 1.5;
    --table-header-font-size: 14px;
    --table-cell-padding-y: 10px;
    --table-cell-padding-x: 12px;

    /* Large variant sizing */
    --table-font-size-lg: 16px;
    --table-line-height-lg: 1.6;
    --table-header-font-size-lg: 16px;
    --table-cell-padding-y-lg: 12px;
    --table-cell-padding-x-lg: 16px;
}

/* Large table variant scoped via class */
.table-lg,
table.table-lg {
    font-size: var(--table-font-size-lg);
    line-height: var(--table-line-height-lg);
}
.table-lg thead th {
    font-size: var(--table-header-font-size-lg);
}
.table-lg th,
.table-lg td {
    padding: var(--table-cell-padding-y-lg) var(--table-cell-padding-x-lg);
}

/* Finance view section titles (Assigned Fees, Recent Payments) */
h5.finance-section-title-lg {
    font-size: 15px;
    line-height: 1.4;
    margin: 12px 0; /* space before and after the title */
}

/* Apply consistent sizing to all tables that use Bootstrap .table */
.table th,
.table td {
    font-size: var(--table-font-size);
    line-height: var(--table-line-height);
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
}

.table thead th {
    font-size: var(--table-header-font-size);
    line-height: var(--table-line-height);
}

/* Fallback for plain table elements not using .table class */
table:not(.table) th,
table:not(.table) td {
    font-size: var(--table-font-size);
    line-height: var(--table-line-height);
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
}

/* Slightly denser variant for compact tables */
.table.table-sm th,
.table.table-sm td {
    font-size: 13px;
    line-height: 1.4;
    padding: 8px 10px;
}
