* {
    box-sizing: border-box;
    font-family: system-ui, 'Segoe UI', 'Inter', 'Poppins', sans-serif;
}
body {
    background: #f5e6e8;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}
.app-container {
    max-width: 1600px;
    margin: 0 auto;
}
:root {
    --primary-maroon: #6B1D2F;
    --primary-maroon-dark: #4a1420;
    --primary-maroon-light: #8a2a40;
    --primary-maroon-soft: #f0e2e5;
    --accent-gold: #c9a03d;
    --accent-gold-dark: #a07d2e;
}

/* Toast Message */
.toast-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1e6f5c;
    color: white;
    padding: 12px 24px;
    border-radius: 2rem;
    font-weight: 600;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.toast-message.success { background: #1e6f5c; }
.toast-message.error { background: #bc4e2c; }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #4a1420 0%, #6B1D2F 100%);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}
.login-box {
    background: white;
    border-radius: 2rem;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.login-box .logo-container { text-align: center; margin-bottom: 1rem; }
.login-box .logo-img { width: 80px; height: 80px; object-fit: contain; border-radius: 50%; background: var(--primary-maroon-soft); padding: 10px; }
.login-box h2 { color: var(--primary-maroon); text-align: center; margin-bottom: 1.5rem; }
.login-box input { width: 100%; padding: 12px 15px; margin-bottom: 1rem; border-radius: 2rem; border: 1.5px solid #d4e0ec; font-size: 1rem; }
.login-box button { width: 100%; padding: 12px; background: var(--primary-maroon); color: white; border: none; border-radius: 2rem; font-size: 1rem; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: var(--primary-maroon-dark); }
.login-error { color: #bc4e2c; text-align: center; margin-top: 1rem; font-size: 0.85rem; }

/* Back to Home Button on Login Page */
.back-home-btn {
    background: #2c7da0;
    color: white;
    margin-top: 10px;
}
.back-home-btn:hover {
    background: #1a5a7a;
}

/* Main App */
.main-app { display: none; }
.header {
    background: var(--primary-maroon);
    color: white;
    padding: 1rem 2rem;
    border-radius: 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 4px 15px rgba(107,29,47,0.3);
}
.header-left { display: flex; align-items: center; gap: 15px; }
.header-logo { width: 50px; height: 50px; object-fit: contain; border-radius: 50%; background: white; padding: 5px; }
.header h1 { margin: 0; font-size: 1.5rem; color: white; }
.user-info { display: flex; gap: 15px; align-items: center; }
.user-badge { background: var(--primary-maroon-dark); padding: 6px 16px; border-radius: 40px; font-size: 0.8rem; }
.admin-panel-btn, .logout-btn { background: var(--accent-gold); color: var(--primary-maroon-dark); padding: 6px 16px; border-radius: 2rem; font-size: 0.8rem; cursor: pointer; border: none; font-weight: 600; }
.admin-panel-btn:hover, .logout-btn:hover { background: var(--accent-gold-dark); color: white; }

/* Profile Button */
.profile-btn {
    background: #2c7da0;
    color: white;
    padding: 6px 16px;
    border-radius: 2rem;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}
.profile-btn:hover {
    background: #1a5a7a;
    transform: translateY(-1px);
}

/* Layout */
.desktop-layout { display: flex; flex-wrap: wrap; gap: 24px; }
.schedules-panel, .masterlist-panel {
    background: white;
    border-radius: 1.8rem;
    padding: 1.5rem;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}
.schedules-panel { flex: 1.2; min-width: 320px; height: fit-content; }
.masterlist-panel { flex: 2.5; min-width: 580px; }

/* Schedule Grid */
.schedule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.schedule-card {
    background: linear-gradient(135deg, #fff5f5 0%, #fde8ec 100%);
    border-radius: 1.2rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #f0d0d5;
}
.schedule-card:hover { transform: translateY(-3px); border-color: var(--primary-maroon); box-shadow: 0 8px 20px rgba(107,29,47,0.15); }
.schedule-letter { font-size: 1.8rem; font-weight: 800; color: var(--primary-maroon); }
.schedule-time { font-size: 0.75rem; color: #5a4a4f; margin-top: 5px; }

/* Payment Records */
.payment-records-section { margin-top: 25px; padding-top: 20px; border-top: 2px solid #f0d0d5; }
.payment-records-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 15px; }
.date-selector { display: flex; gap: 10px; align-items: center; }
.date-selector input { padding: 8px 12px; border-radius: 1rem; border: 1.5px solid #f0d0d5; }
.daily-total { background: var(--primary-maroon); color: white; padding: 8px 16px; border-radius: 2rem; font-weight: bold; display: inline-block; }
.payment-records-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.payment-records-table th { background: var(--primary-maroon); color: white; padding: 10px; text-align: left; }
.payment-records-table td { padding: 8px 10px; border-bottom: 1px solid #f0d0d5; }

/* Student Card */
.student-card { background: #ffffff; border-radius: 1.2rem; margin-bottom: 1rem; border: 1px solid #f0d0d5; padding: 1rem; transition: 0.2s; }
.student-header { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.student-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: #f0d0d5; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.student-info { flex: 1; }
.student-name { font-size: 1.1rem; font-weight: 700; color: var(--primary-maroon); }
.student-detail { font-size: 0.7rem; color: #6b5a5e; }
.action-buttons { display: flex; gap: 8px; }
button { background: var(--primary-maroon); color: white; border: none; padding: 8px 16px; border-radius: 2rem; cursor: pointer; font-weight: 600; transition: 0.2s; }
button:hover { background: var(--primary-maroon-dark); transform: translateY(-1px); }
.btn-danger { background: #bc4e2c; }
.btn-warning { background: var(--accent-gold); color: var(--primary-maroon-dark); }
.btn-info { background: #2c7da0; }
.btn-sm { padding: 5px 12px; font-size: 0.7rem; }

/* Search & Filter */
.search-filter-bar { display: flex; gap: 12px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.search-box { flex: 2; position: relative; }
.search-box input { width: 100%; padding: 10px 15px 10px 40px; border-radius: 2rem; border: 1.5px solid #f0d0d5; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); }
.filter-box select { padding: 10px 15px; border-radius: 2rem; border: 1.5px solid #f0d0d5; background: white; }
.clear-filter { background: #6c757d; }

/* Modals */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; }
.modal-content { background: white; border-radius: 2rem; max-width: 650px; width: 90%; padding: 1.8rem; max-height: 85vh; overflow-y: auto; }

/* Fee Modal - Improved Design */
.fee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid #f0d0d5;
    flex-wrap: wrap;
    gap: 8px;
    background: white;
    border-radius: 0.75rem;
    margin-bottom: 5px;
}
.fee-item:hover {
    background: #fef8f0;
}
.fee-label {
    font-weight: 600;
    min-width: 140px;
    color: var(--primary-maroon);
    font-size: 0.85rem;
}
.fee-input {
    width: 130px;
    padding: 8px 10px;
    border-radius: 1rem;
    border: 1.5px solid #f0d0d5;
    background: white;
    font-weight: 500;
}
.fee-input:focus {
    outline: none;
    border-color: var(--primary-maroon);
}
.fee-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: var(--primary-maroon);
    cursor: pointer;
}
/* Total Fee Display - Light Maroon Background */
.total-fee {
    background: #fde8ec;
    color: var(--primary-maroon-dark);
    padding: 14px 18px;
    border-radius: 1rem;
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: right;
    font-weight: bold;
    font-size: 1.2rem;
    border: 1px solid #f0d0d5;
    box-shadow: 0 2px 5px rgba(107,29,47,0.1);
}
.total-fee span {
    color: var(--primary-maroon);
    font-size: 1.3rem;
}
/* Process Payment Button */
#processPaymentBtn {
    width: 100%;
    background: var(--primary-maroon);
    color: white;
    padding: 12px 20px;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(107,29,47,0.3);
}
#processPaymentBtn:hover {
    background: var(--primary-maroon-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107,29,47,0.4);
}
#processPaymentBtn:active {
    transform: translateY(0);
}
/* Close Button in Fee Modal */
#closeFeeModalBtn {
    width: 100%;
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
#closeFeeModalBtn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.form-group { margin-bottom: 1rem; }
label { font-weight: 600; color: var(--primary-maroon); display: block; margin-bottom: 5px; font-size: 0.8rem; }
input, select, textarea { width: 100%; padding: 8px 12px; border-radius: 1rem; border: 1.5px solid #f0d0d5; }
.no-data { text-align: center; padding: 2rem; color: #7e9aae; }
.result-count { font-size: 0.75rem; color: var(--primary-maroon); margin-top: 8px; margin-bottom: 12px; }

/* Mobile */
.mobile-layout { display: none; }
.tab-container { background: white; border-radius: 1.5rem; overflow: hidden; margin-bottom: 16px; }
.tab-buttons { display: flex; background: #fde8ec; gap: 2px; }
.tab-btn { flex: 1; background: #f0d0d5; border: none; padding: 12px 8px; font-size: 0.75rem; font-weight: 600; color: var(--primary-maroon); cursor: pointer; }
.tab-btn.active { background: var(--primary-maroon); color: white; }
.tab-content { display: none; padding: 16px; background: white; border-radius: 0 0 1.5rem 1.5rem; }
.tab-content.active { display: block; }

/* Users Table */
.users-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.users-table th, .users-table td { padding: 10px; text-align: left; border-bottom: 1px solid #f0d0d5; }
.users-table th { background: var(--primary-maroon); color: white; }

/* Receipt Modal */
.receipt-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1100;
    justify-content: center;
    align-items: center;
}
.receipt-container {
    background: #e9e9e9;
    padding: 20px;
    border-radius: 8px;
    max-width: 95%;
    max-height: 95%;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.receipt-paper-8x5 {
    background: white;
    width: 816px;
    min-height: 528px;
    margin: 0 auto;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    border-radius: 4px;
    overflow: hidden;
}
.receipt-halves {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 528px;
}
.receipt-half {
    flex: 1;
    width: 408px;
    min-height: 528px;
    padding: 18px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border-right: 1px dashed #d4a373;
    background: white;
}
.receipt-half:last-child { border-right: none; }
.half-label {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary-maroon);
    background: #fde8ec;
    display: inline-block;
    width: 100%;
    padding: 4px 0;
    border-radius: 20px;
    margin-bottom: 12px;
}
.receipt-header { text-align: center; margin-bottom: 14px; border-bottom: 2px solid var(--primary-maroon); padding-bottom: 8px; }
.receipt-header h3 { margin: 0; color: var(--primary-maroon); font-size: 1rem; }
.receipt-header p { margin: 2px 0; font-size: 0.6rem; color: #5a4a4f; }
.receipt-details { font-size: 0.68rem; margin: 12px 0; flex: 1; }
.receipt-row { display: flex; justify-content: space-between; margin-bottom: 6px; border-bottom: 1px dotted #f0d0d5; padding-bottom: 4px; }
.receipt-total { margin-top: 12px; background: var(--primary-maroon); color: white; padding: 8px; font-weight: bold; text-align: right; border-radius: 6px; font-size: 0.8rem; }
.receipt-footer { margin-top: 12px; font-size: 0.55rem; text-align: center; border-top: 1px solid #e0c8b0; padding-top: 8px; color: #6b5a5e; }
.or-number { font-family: monospace; font-weight: bold; background: #fde8ec; display: inline-block; padding: 2px 6px; border-radius: 12px; font-size: 0.65rem; }
.print-receipt-btn, .close-receipt-btn { display: inline-block; margin: 10px 8px; padding: 10px 24px; }
.receipt-actions { text-align: center; margin-top: 20px; }

@media print {
    body * { visibility: hidden; }
    .receipt-modal, .receipt-modal * { visibility: visible; }
    .receipt-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        background: white;
        padding: 0;
        margin: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 9999;
    }
    .receipt-container {
        background: white;
        padding: 0;
        margin: 0;
        max-width: 100%;
        width: 100%;
        box-shadow: none;
        display: block;
    }
    .receipt-paper-8x5 {
        box-shadow: none;
        border: none;
        margin: 0 auto;
        width: 8.5in;
        height: 5.5in;
        min-height: 5.5in;
        max-width: 8.5in;
        max-height: 5.5in;
        page-break-after: avoid;
        page-break-inside: avoid;
        break-inside: avoid;
        overflow: hidden;
    }
    .receipt-halves {
        display: flex;
        flex-direction: row;
        width: 100%;
        height: 100%;
        min-height: 5.5in;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .receipt-half {
        width: 4.25in;
        min-height: 5.5in;
        height: 5.5in;
        border-right: 1px dashed #aaa;
        page-break-inside: avoid;
        break-inside: avoid;
        overflow-y: auto;
        box-sizing: border-box;
        padding: 12px;
    }
    .receipt-half:last-child { border-right: none; }
    @page { size: 8.5in 5.5in; margin: 0in; }
    html, body { margin: 0; padding: 0; width: 8.5in; height: 5.5in; }
    .print-receipt-btn, .close-receipt-btn, .receipt-actions { display: none !important; }
    .receipt-header h3 { font-size: 0.9rem; margin: 0; }
    .receipt-header p { font-size: 0.55rem; margin: 2px 0; }
    .receipt-details { font-size: 0.6rem; }
    .receipt-row { margin-bottom: 3px; }
    .receipt-total { font-size: 0.7rem; padding: 5px; }
    .receipt-footer { font-size: 0.5rem; margin-top: 8px; }
}

@media (max-width: 900px) {
    body { padding: 12px; }
    .desktop-layout { display: none; }
    .mobile-layout { display: block; }
    .header h1 { font-size: 1.1rem; }
}

/* ========== PROFESSIONAL STUDENT RECORDS MODAL ========== */
#recordsModal .modal-content {
    max-width: 1400px !important;
    width: 95% !important;
}

/* Professional Table Styles */
.professional-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    border-radius: 1rem;
    overflow: hidden;
}

.professional-table th {
    background: var(--primary-maroon);
    color: white;
    padding: 14px 12px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

.professional-table th:first-child {
    text-align: center;
}

.professional-table th:nth-child(2),
.professional-table th:nth-child(3),
.professional-table th:nth-child(4) {
    text-align: left;
}

.professional-table th:nth-child(5),
.professional-table th:nth-child(6),
.professional-table th:nth-child(7),
.professional-table th:nth-child(8),
.professional-table th:nth-child(9) {
    text-align: right;
}

.professional-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f0d0d5;
    vertical-align: middle;
}

.professional-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: var(--primary-maroon);
    width: 50px;
}

.professional-table td:nth-child(2),
.professional-table td:nth-child(3),
.professional-table td:nth-child(4) {
    text-align: left;
}

.professional-table td:nth-child(5),
.professional-table td:nth-child(6),
.professional-table td:nth-child(7),
.professional-table td:nth-child(8),
.professional-table td:nth-child(9) {
    text-align: right;
    font-weight: 500;
}

.professional-table td:nth-child(9) {
    font-weight: 700;
    color: var(--primary-maroon);
}

.professional-table tr:hover td {
    background: #fde8ec !important;
}

/* Striped rows */
.professional-table tr:nth-child(even) td {
    background: #fef8f0;
}

.professional-table tr:nth-child(odd) td {
    background: white;
}

/* OR Number Badge */
.professional-table td:nth-child(3) span {
    background: #fde8ec;
    padding: 5px 10px;
    border-radius: 20px;
    font-family: monospace;
    font-weight: bold;
    font-size: 0.7rem;
    display: inline-block;
    color: var(--primary-maroon);
}

/* Student Info Section */
#studentInfoSection > div {
    background: linear-gradient(135deg, var(--primary-maroon-soft) 0%, #fff5f5 100%);
    padding: 18px 22px;
    border-radius: 1rem;
    margin-bottom: 20px;
    border: 1px solid #f0d0d5;
}

/* Total Paid Section */
.total-paid {
    background: linear-gradient(135deg, #fde8ec 0%, #f5e0e5 100%);
    padding: 15px 20px;
    border-radius: 1rem;
    margin-top: 20px;
    text-align: right;
    font-weight: bold;
    color: var(--primary-maroon);
    font-size: 1rem;
    border: 1px solid #f0d0d5;
}

/* Action Buttons in Records Modal */
.print-receipt-btn-small,
.edit-payment-btn,
.delete-payment-btn {
    padding: 6px 12px !important;
    font-size: 0.7rem !important;
    margin: 2px !important;
    border-radius: 1.5rem !important;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.print-receipt-btn-small {
    background: #2c7da0;
    color: white;
}

.print-receipt-btn-small:hover {
    background: #1a5a7a;
    transform: translateY(-1px);
}

.edit-payment-btn {
    background: var(--accent-gold);
    color: var(--primary-maroon-dark);
}

.edit-payment-btn:hover {
    background: var(--accent-gold-dark);
    transform: translateY(-1px);
    color: white;
}

.delete-payment-btn {
    background: #bc4e2c;
    color: white;
}

.delete-payment-btn:hover {
    background: #9a3a1f;
    transform: translateY(-1px);
}

/* Action buttons container */
.records-table td:last-child,
.professional-table td:last-child {
    white-space: nowrap;
    text-align: center;
}

/* Scrollable table container */
.records-table-container {
    overflow-x: auto;
    border-radius: 1rem;
    border: 1px solid #e0c8b0;
}

/* Photo Upload Area */
.photo-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #fde8ec;
    border-radius: 1.2rem;
    border: 2px dashed var(--primary-maroon);
    margin-bottom: 1rem;
}

.preview-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    background: #e9edf2;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.file-label {
    background: var(--primary-maroon);
    color: white;
    padding: 8px 20px;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.file-label:hover { background: var(--primary-maroon-dark); }

.remove-photo {
    background: #bc4e2c;
    padding: 5px 15px;
    border-radius: 1.5rem;
    font-size: 0.7rem;
    cursor: pointer;
}