/* ========================================
   IKHLAS ACADEMY - School Management System
   Professional CSS Framework
   ======================================== */

:root {
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --accent: #0f3460;
    --highlight: #e94560;
    --success: #00b894;
    --danger: #d63031;
    --warning: #fdcb6e;
    --info: #0984e3;
    --text: #2d3436;
    --text-light: #636e72;
    --bg: #f5f6fa;
    --white: #ffffff;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    background: #ffffff !important;
    border: 1px solid #e9ecef;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-icon {
    color: var(--white);
    font-size: 32px;
    font-weight: 700;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

.login-form input:focus {
    border-color: var(--info);
    box-shadow: 0 0 0 4px rgba(9, 132, 227, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26, 26, 46, 0.3);
}

.login-footer-text {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-light);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: var(--text-light);
}

.blink-link {
    color: var(--highlight);
    text-decoration: none;
    font-weight: 600;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo-icon {
    width: 50px;
    height: 50px;
    background: #ffffff !important;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 20px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.3);
}

.sidebar-header .logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-header h1 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 3px;
}

.sidebar-header p {
    font-size: 11px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255,255,255,0.08);
    color: var(--white);
    border-left-color: var(--highlight);
}

.nav-item.active {
    background: rgba(233, 69, 96, 0.15);
}

.nav-icon {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-text {
    flex: 1;
}

.dropdown-arrow {
    font-size: 10px;
    opacity: 0.6;
    transition: var(--transition);
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    background: rgba(0,0,0,0.2);
    padding: 5px 0;
}

.nav-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-menu .nav-item {
    padding-left: 56px;
    font-size: 13px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
    transition: var(--transition);
}

.top-bar {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
}

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

.user-info span:first-child {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    background: var(--highlight);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.content-area {
    padding: 30px;
    max-width: 1400px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Cards & Dashboard */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

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

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.green { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.stat-icon.red { background: rgba(214, 48, 49, 0.15); color: var(--danger); }
.stat-icon.blue { background: rgba(9, 132, 227, 0.15); color: var(--info); }
.stat-icon.yellow { background: rgba(253, 203, 110, 0.15); color: var(--warning); }

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 3px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-light);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.quick-action-btn {
    background: var(--white);
    border: 2px solid #f0f0f0;
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text);
}

.quick-action-btn:hover {
    border-color: var(--info);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quick-action-btn .qa-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.quick-action-btn .qa-text {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

th, td {
    padding: 14px 18px;
    text-align: left;
    font-size: 14px;
}

th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:nth-child(even) {
    background: #f8f9fa;
}

tr:hover {
    background: #f1f3f5;
}

td {
    border-bottom: 1px solid #f0f0f0;
}

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

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--info);
    box-shadow: 0 0 0 4px rgba(9, 132, 227, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
}

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

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

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

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

.btn-secondary {
    background: #e9ecef;
    color: var(--text);
}

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

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

/* Status badges */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.badge-danger { background: rgba(214, 48, 49, 0.15); color: var(--danger); }
.badge-warning { background: rgba(253, 203, 110, 0.15); color: var(--warning); }
.badge-info { background: rgba(9, 132, 227, 0.15); color: var(--info); }

/* Fee Status Cards */
.fee-months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.fee-month-card {
    background: var(--white);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    cursor: pointer;
    border: 2px solid #f0f0f0;
    transition: var(--transition);
}

.fee-month-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.fee-month-card.paid {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.05);
}

.fee-month-card.unpaid {
    border-color: var(--danger);
    background: rgba(214, 48, 49, 0.05);
}

.fee-month-card .month-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.fee-month-card .month-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.fee-month-card.paid .month-status { color: var(--success); }
.fee-month-card.unpaid .month-status { color: var(--danger); }

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Receipt */
.receipt {
    max-width: 400px;
    margin: 0 auto;
    background: var(--white);
    border: 2px dashed #ddd;
    border-radius: var(--radius);
    padding: 30px;
    font-family: 'Courier New', monospace;
}

.receipt-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px dashed #ddd;
}

.receipt-header h2 {
    font-size: 20px;
    margin-bottom: 5px;
}

.receipt-body {
    margin-bottom: 20px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}

.receipt-total {
    border-top: 2px solid var(--text);
    padding-top: 10px;
    margin-top: 10px;
}

/* Search */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--info);
}

/* Student Cards */
.student-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    transition: var(--transition);
}

.student-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.student-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.student-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 3px;
}

.student-info p {
    font-size: 13px;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .content-area {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .top-bar {
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .fee-months-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mt-20 { margin-top: 20px; }
.gap-10 { gap: 10px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* Activity Feed */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: var(--transition);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: #f8f9fa;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.activity-content p {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 3px;
}

.activity-content time {
    font-size: 12px;
    color: var(--text-light);
}

/* Multi-select */
.multi-select-list {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 10px;
}

.multi-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.multi-select-item:hover {
    background: #f8f9fa;
}

.multi-select-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--info);
}

/* Print styles */
@media print {
    .sidebar, .top-bar, .no-print, .app-footer, .modal-overlay {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .content-area {
        padding: 0 !important;
    }
}

/* Receipt print optimization */
@media print {
    body * {
        visibility: hidden;
    }
    .receipt, .receipt * {
        visibility: visible;
    }
    .receipt {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        border: none !important;
    }
}

/* App Footer */
.app-footer {
    background: var(--primary);
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 12px 20px;
    font-size: 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
}

.app-footer a {
    color: var(--highlight);
    text-decoration: none;
    font-weight: 600;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Adjust main content for footer */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    padding-bottom: 50px;
}

/* ========================================
   Exams & Grading - Additional Styles
   ======================================== */

.component-row,
.grade-row {
    transition: var(--transition);
}

.component-row:hover,
.grade-row:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#componentTotal {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--info);
}

#componentTotal[style*="var(--success)"] {
    border-left-color: var(--success);
}

#componentTotal[style*="var(--danger)"] {
    border-left-color: var(--danger);
    background: rgba(214, 48, 49, 0.05);
}

.mark-input:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 2px rgba(9, 132, 227, 0.15);
}

table input[readonly] {
    background: #f8f9fa;
    color: var(--primary);
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

table th {
    white-space: nowrap;
}

#marksEntryArea th {
    font-size: 11px;
    padding: 10px 8px;
    min-width: 60px;
    text-align: center;
}

#marksEntryArea td {
    padding: 8px;
    text-align: center;
}

.multi-select-list {
    max-height: 200px;
}

.assignment-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e3f2fd;
    padding: 4px 10px;
    border-radius: 20px;
    margin: 2px;
    font-size: 12px;
    font-weight: 500;
}

.assignment-chip button {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: 700;
    padding: 0 4px;
}

/* Compact Student Profile */
.profile-field {
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid var(--info);
}

.profile-field label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.profile-field > div {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    word-break: break-word;
}

@media (max-width: 600px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    .profile-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* White background for school logo */
.school-logo-white,
img.logo-img,
.sidebar-header .logo img,
.login-header .logo img,
.logo img {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

/* ============================================
   COMPREHENSIVE RESPONSIVE DESIGN
   ============================================ */

/* Laptop (1025px – 1366px): sidebar still visible, content must fit */
@media (min-width: 1025px) and (max-width: 1366px) {
    :root {
        --sidebar-width: 220px;
    }
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-left: 220px;
    }
    .content-area {
        padding: 20px 18px;
        max-width: 100%;
    }
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .card { padding: 18px; }
    #marksEntryArea .mark-input,
    #marksEntryArea input[type="text"] {
        width: 38px;
        font-size: 10px;
    }
    #marksEntryArea table th,
    #marksEntryArea table td {
        padding: 3px 3px;
        font-size: 10px;
    }
}

/* Tablet and small desktop (max 1024px) */
@media (max-width: 1024px) {
    .content-area { padding: 20px; }
    .stat-card { padding: 18px; }
    .stat-card h3 { font-size: 20px; }
    .card { padding: 18px; }
    .modal-content { max-width: 95% !important; }
}

/* Tablet (max 900px) */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1100;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.3);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block !important;
    }
    .top-bar {
        padding: 12px 16px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    .form-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }
    .quick-actions {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .profile-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile (max 600px) */
@media (max-width: 600px) {
    body { font-size: 14px; }
    .content-area { padding: 12px; max-width: 100%; }
    .card { padding: 14px; border-radius: 10px; }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .card-title { font-size: 16px; }
    .section-title { font-size: 20px; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }
    .stat-card {
        padding: 14px;
        gap: 12px;
    }
    .stat-card h3 { font-size: 18px; }
    .stat-card p { font-size: 11px; }
    .stat-icon { width: 40px; height: 40px; font-size: 18px; }
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 12px; }
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 14px;
        font-size: 14px;
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    .quick-action-btn {
        padding: 14px 8px;
    }
    .quick-action-btn .qa-icon { font-size: 22px; }
    .quick-action-btn .qa-text { font-size: 10px; }
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    .btn-sm {
        padding: 5px 10px;
        font-size: 11px;
    }
    .modal-overlay { padding: 10px; }
    .modal-content { max-width: 100% !important; margin: 0; border-radius: 10px; }
    .modal-header { padding: 12px 14px; }
    .modal-header h2 { font-size: 15px; }
    .modal-body { padding: 14px; max-height: 70vh; }
    .modal-footer { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
    .profile-header {
        flex-direction: row !important;
        text-align: left !important;
    }
    .profile-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }
    .profile-field { padding: 6px 8px; }
    .profile-field > div { font-size: 12px; }
    .profile-field label { font-size: 9px; }
    .students-filter-bar {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        font-size: 12px;
    }
    th, td {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
    th { font-size: 11px !important; }
    .activity-item { padding: 10px; gap: 10px; }
    .activity-content p { font-size: 13px; }
    .top-bar { padding: 10px 14px; }
    .user-info span:first-child { font-size: 13px; }
    .user-role { font-size: 10px; padding: 3px 8px; }
    h1 { font-size: 18px; }
    h2 { font-size: 16px; }
    h3 { font-size: 14px; }
    h4 { font-size: 13px; }
    .receipt { font-size: 12px; }
    .receipt-row { font-size: 11px; padding: 3px 0; }
    .multi-select-list { max-height: 180px; }
    .multi-select-item { padding: 8px 10px; font-size: 13px; }
    .fee-months-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .fee-month-card { padding: 12px; }
    .page-btn { padding: 5px 9px !important; font-size: 12px !important; min-width: 30px !important; }
}

/* Very small mobile (max 380px) */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr !important; }
    .quick-actions { grid-template-columns: 1fr 1fr !important; }
    .stat-card h3 { font-size: 16px; }
    .profile-grid { grid-template-columns: 1fr !important; }
    .modal-content { max-height: 95vh !important; }
}

/* Fix for tables to scroll horizontally on small screens */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
    }
    .mark-input {
        min-width: 50px !important;
    }
    #marksEntryArea th, #marksEntryArea td {
        padding: 4px !important;
    }
}

/* Better touch targets on mobile */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-item, .quick-action-btn, .multi-select-item, .modal-close {
        min-height: 44px;
    }
}

/* Print styles for student list */
@media print {
    .sidebar, .top-bar, .app-footer, .students-filter-bar, .studentsPagination, #studentsListStats, .card-header, .menu-toggle {
        display: none !important;
    }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ========================================
   Marks Register - Compact Styles
   ======================================== */

#marksEntryArea .card {
    padding: 10px;
    margin-bottom: 10px;
}

#marksEntryArea .card-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
}

#marksEntryArea .section-title {
    font-size: 16px;
}

#marksEntryArea .form-row {
    gap: 8px;
    margin-bottom: 8px;
}

#marksEntryArea .form-group {
    margin-bottom: 0;
}

#marksEntryArea .form-group label {
    font-size: 10px;
    margin-bottom: 3px;
    text-transform: none;
    letter-spacing: 0;
}

#marksEntryArea .form-group input,
#marksEntryArea .form-group select {
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 5px;
}

#marksEntryArea table th {
    padding: 4px 4px;
    font-size: 10px;
}

#marksEntryArea table td {
    padding: 2px 3px;
}

#marksEntryArea .mark-input {
    width: 44px;
    padding: 2px;
    font-size: 11px;
    border-radius: 4px;
}

#marksEntryArea input[type="text"] {
    width: 44px;
    padding: 2px;
    font-size: 11px;
    border-radius: 4px;
}

#marksEntryArea .badge {
    font-size: 8px;
    padding: 1px 4px;
}

#marksEntryArea button.btn-xs {
    font-size: 8px;
    padding: 1px 3px;
    border-radius: 3px;
}

#marksEntryArea .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
}

#marksEntryArea tr {
    height: auto;
}

#marksEntryArea tbody tr td {
    vertical-align: middle;
}
