/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

:root {
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    margin-top: 2rem;
}

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

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

.card h2 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card h2 span {
    font-size: 1rem;
    color: var(--gray);
    font-weight: normal;
}

.stat {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 10px;
    font-family: var(--font-mono);
}

.stat.positive {
    color: var(--success);
}

.stat.negative {
    color: var(--error);
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-right: 5px;
    transition: var(--transition);
    color: var(--dark);
    font-weight: 500;
}

.tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-content {
    display: none;
    background: white;
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.tab-content.active {
    display: block;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--surface-2);
    color: var(--darker);
    font-weight: 600;
}

tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
    cursor: pointer;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

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

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

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

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.invoice-payments {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--surface-2);
    border-radius: var(--radius);
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.payment-row:last-child {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--gray);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.data-management-toolbar {
    margin-bottom: 20px;
}

.help-text {
    color: var(--gray);
    font-size: 0.9rem;
    margin-top: 10px;
    font-style: italic;
}

small.help-text {
    display: block;
    margin-top: 5px;
    color: var(--gray);
}

.invoice-card.paid {
    background-color: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success);
}

.invoice-card.paid .invoice-header h2 {
    color: var(--success);
}

.paid-badge {
    background-color: var(--success);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

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

.affordable {
    color: var(--success);
    font-weight: bold;
}

.not-affordable {
    color: var(--error);
    font-weight: bold;
}

.not-analyzed {
    color: var(--gray);
    font-style: italic;
}

.date-group {
    flex: 1;
    min-width: 150px;
}

#income-dates-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.status-active {
    color: var(--success);
    font-weight: bold;
}

.status-ended {
    color: var(--gray);
    font-style: italic;
}

td:nth-child(2) {
    font-weight: 500;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (min-width: 900px) {
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .dashboard {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    table {
        font-size: 0.9rem;
        display: block;
        overflow-x: auto;
    }

    th, td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .tab {
        white-space: nowrap;
    }

    #income-dates-group {
        flex-direction: column;
        gap: 10px;
    }

    .date-group {
        min-width: 100%;
    }
}