/* ========== Dashboard-Specific Variables ========== */
:root {
    --accent-color: #ffd93d;
}

/* ========== Dashboard-Specific Overrides ========== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
}

/* ========== Container ========== */
.container {
    max-width: 1400px;
    margin: 20px auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

/* ========== Toolbar ========== */
.toolbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.toolbar-spacer {
    /* Empty spacer for left column */
}

.toolbar .toolbar-confirm-btn {
    justify-self: center;
}

.toolbar .tabs {
    justify-self: end;
}

.title-section {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.school-year {
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

/* ========== Tabs ========== */
.tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    padding: 10px 24px;
    border: 2px solid var(--primary-blue);
    background: white;
    color: var(--primary-blue);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #e3f2fd;
}

.tab-btn.fall {
    border-color: #f0ad4e;
    color: #b37a1a;
}

.tab-btn.fall:hover {
    background: #fff8eb;
}

.tab-btn.fall.active {
    background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%);
    color: white;
    border-color: transparent;
}

.tab-btn.spring {
    border-color: #5cb85c;
    color: #3d8b3d;
}

.tab-btn.spring:hover {
    background: #edfbed;
}

.tab-btn.spring.active {
    background: linear-gradient(135deg, #5cb85c 0%, #449d44 100%);
    color: white;
    border-color: transparent;
}

/* ========== Section Headers ========== */
.section-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 20px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-blue);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.section-header:hover {
    opacity: 0.8;
}

.collapse-icon {
    font-size: 12px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.collapsible-section.collapsed .section-content {
    display: none;
}

.section-header.discounted {
    border-bottom-color: #6b46c1;
    color: #6b46c1;
}

.section-header.installments {
    border-bottom-color: #f0ad4e;
    color: #b37a1a;
}

.section-header.graph-header {
    border-bottom-color: #667eea;
    color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 12px;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.graph-section {
    margin-bottom: 2rem;
}

/* ========== Revenue Graph ========== */
.revenue-graph {
    display: flex;
    gap: 0;
    padding: 2rem 1rem 1rem 1rem;
    background: white;
    border-radius: 0 0 8px 8px;
    align-items: flex-end;
    min-height: 280px;
}

.graph-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.graph-bar-container:hover {
    background-color: rgba(102, 126, 234, 0.03);
}

.graph-bar-container.highlighted {
    background-color: rgba(102, 126, 234, 0.08);
}

.graph-bar-container.empty {
    visibility: hidden;
}

.graph-bar-wrapper {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 10%;
}

.graph-bar.projected {
    width: 100%;
    background: transparent;
    border: 3px solid #667eea;
    border-radius: 6px 6px 0 0;
    position: relative;
    min-height: 8px;
    display: flex;
    align-items: flex-end;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.graph-bar-container:hover .graph-bar.projected {
    border-color: #5a67d8;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.graph-bar.paid {
    width: 100%;
    background: linear-gradient(180deg, #48bb78 0%, #38a169 100%);
    border-radius: 3px 3px 0 0;
    transition: height 0.3s ease;
    box-shadow: 0 -2px 4px rgba(56, 161, 105, 0.2);
}

.graph-labels {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    text-align: center;
    min-height: 36px;
}

.graph-amount {
    white-space: nowrap;
}

.graph-amount.projected-amount {
    color: #667eea;
    font-weight: 600;
}

.graph-amount.paid-amount {
    color: #38a169;
    font-weight: 700;
}

.graph-student-spacer {
    width: 260px;
    min-width: 200px;
    flex-shrink: 0;
}



/* ========== Table Container ========== */
.table-container {
    overflow-x: auto;
    margin-bottom: 15px;
    padding: 2px;
}

/* ========== Family Table ========== */
.family-table {
    width: 100%;
    min-width: 900px;
    /* Ensure horizontal scroll at narrow widths */
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.family-table th {
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    overflow: hidden;
    text-overflow: ellipsis;
}

.family-table.discounted th {
    background: rgba(128, 90, 213, 0.08);
    border-color: #d4c4f0;
    color: #6b46c1;
}

.family-table.installments th {
    background: rgba(240, 173, 78, 0.08);
    border-color: #e8d0b0;
    color: #b37a1a;
}

/* Rounded corners for family groups */
.family-first td:first-child {
    border-top-left-radius: 12px;
}

.family-first td:last-child {
    border-top-right-radius: 12px;
}

.family-last td:first-child {
    border-bottom-left-radius: 12px;
}

.family-last td:last-child {
    border-bottom-right-radius: 12px;
}

.family-first td {
    border-top: 1px solid #dddddd;
}

.family-box td:first-child,
.total-row td:first-child {
    border-left: 1px solid #dddddd;
}

.family-box td:last-child,
.total-row td:last-child {
    border-right: 1px solid #dddddd;
}

.total-row.family-first td {
    border-top-color: #dddddd;
}

.total-row td:first-child {
    border-left-color: #dddddd;
}

.total-row td:last-child {
    border-right-color: #dddddd;
}

.family-table th.student-col {
    text-align: left;
    width: 260px;
    min-width: 200px;
}

.family-table th.month-col {
    min-width: 100px;
}

.family-table th.month-col .month-header {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding-right: 38px;
}

.family-table th.month-col .month-name {
    font-size: 13px;
    margin-left: 38px;
}

.family-table th.month-col .month-name.confirmed {
    font-weight: 700;
}

.family-table th.month-col .month-name.all-paid {
    color: #27ae60;
    font-weight: 600;
}

.family-table th.month-col.highlighted {
    background: #e3f2fd;
    box-shadow: inset 2px 0 0 var(--primary-blue), inset -2px 0 0 var(--primary-blue), inset 0 2px 0 var(--primary-blue);
}

/* Family Box Row */
.family-box td {
    background: #f5f5f5;
}

.family-box.highlighted td {
    background-color: #fffde7 !important;
}

.family-table td {
    padding: 6px;
    border-bottom: 1px solid #dddddd;
    vertical-align: middle;
}

.family-table td.month-col {
    text-align: center;
}

.total-row td {
    background: #efefef;
}

.family-table td.month-col.highlighted {
    background: rgba(26, 95, 122, 0.08);
    box-shadow: inset 2px 0 0 var(--primary-blue), inset -2px 0 0 var(--primary-blue);
}

.total-row td.month-col.highlighted {
    background-color: #e2e4ec;
}

.family-separator {
    height: 4px;
    background: white;
}

.family-separator td {
    padding: 0;
    border: none;
    background: white;
}

.family-separator td.highlighted {
    box-shadow: inset 2px 0 0 var(--primary-blue), inset -2px 0 0 var(--primary-blue);
    background: rgba(26, 95, 122, 0.08);
}

.family-table tbody tr:last-child td.month-col.highlighted,
.total-row td.month-col.highlighted {
    box-shadow: inset 2px 0 0 var(--primary-blue), inset -2px 0 0 var(--primary-blue);
}

.family-table tbody tr:last-of-type td.month-col.highlighted {
    box-shadow: inset 2px 0 0 var(--primary-blue), inset -2px 0 0 var(--primary-blue), inset 0 -2px 0 var(--primary-blue);
}

/* ========== Student Info ========== */
.student-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    cursor: pointer;
}

.student-name {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.student-tags {
    display: flex;
    gap: 4px;
}

.tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.family-box.highlighted td,
.total-row.highlighted td {
    background-color: #fffde7 !important;
}

.total-row.highlighted td.month-col.highlighted {
    background-color: #fcfae2 !important;
}

.tag.program-primary {
    background: #d4edda;
    color: #155724;
}

.tag.program-elementary {
    background: #fff3cd;
    color: #856404;
}

.tag.schedule-morning {
    background: #d1ecf1;
    color: #0c5460;
}

.tag.schedule-extendedday {
    background: #e0dafd;
    color: #5a3d82;
}

.tag.schedule-afterschool {
    background: #f8d7da;
    color: #721c24;
}

/* ========== Tuition Cell ========== */
.tuition-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding-right: 38px;
    background: transparent;
}

.tuition-amount {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
    margin-left: 38px;
}

.tuition-amount:hover {
    background: #e3f2fd;
}

.tuition-amount.confirmed,
.total-amount.confirmed {
    font-weight: 700;
}

.tuition-amount.paid,
.total-amount.paid {
    color: #27ae60;
    font-weight: 600;
}

.total-amount {
    margin-left: 38px;
}

.total-row .total-label {
    text-align: right;
    padding-right: 15px;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    cursor: pointer;
}

.payment-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 36px;
    height: 20px;
    border-radius: 4px;
}

.tuition-cell .payment-btn,
.month-header .payment-btn {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.payment-btn.pay {
    color: #27ae60;
    font-weight: bold;
}

.payment-btn.pay:hover {
    background: #e8f5e9;
}

.payment-btn.revert {
    color: #f39c12;
}

.payment-btn.revert:hover {
    background: #fcf3cf;
    color: #d35400;
}

/* ========== Confirm Button ========== */
.confirm-btn {
    display: block;
    width: 100%;
    max-width: 350px;
    margin: 20px auto 0;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0d4a5e 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(26, 95, 122, 0.3);
}

.confirm-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.header-confirm-btn {
    margin: 0;
    padding: 10px 20px;
    font-size: 14px;
    max-width: none;
    width: auto;
}

.toolbar-confirm-btn {
    margin: 0;
    width: 350px;
    max-width: 100%;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: #999;
    font-size: 13px;
}

/* ========== Loading Spinner ========== */
.spinner {
    width: 30px;
    height: 30px;
    margin: 30px auto;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    text-align: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.modal-message {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.4;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0d4a5e 100%);
    color: white;
}

.modal-btn.secondary {
    background: #f0f0f0;
    color: #333;
}

.modal-btn:hover {
    transform: translateY(-1px);
}

/* ========== Notification ========== */
.notification {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    z-index: 2000;
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

.notification.success {
    background: #2ecc71;
}

.notification.error {
    background: #e74c3c;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .container {
        padding: 15px 10px;
        margin: 10px;
    }

    .header h1 {
        font-size: 18px;
    }

    .family-table {
        font-size: 11px;
    }

    .tag {
        font-size: 9px;
        padding: 1px 4px;
    }

    .tuition-input {
        width: 55px;
        font-size: 11px;
    }
}