/* Copyright (c) 2025. Jericho Crosby (Chalwk) */

:root {
    --primary: #3498db;
    --secondary: #2c3e50;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #34495e;
    --gray: #95a5a6;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --info: #17a2b8;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: var(--secondary);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--light);
}

h1 {
    color: var(--secondary);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--gray);
    font-size: 1.1rem;
}

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

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

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.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);
}

.stat {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 10px;
}

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

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

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

.tab {
    padding: 12px 20px;
    cursor: pointer;
    background: white;
    border: 1px solid var(--light);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin-right: 5px;
    transition: var(--transition);
}

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

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

.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(--light);
}

th {
    background-color: var(--light);
    color: var(--secondary);
    font-weight: 600;
}

tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
    cursor: pointer;
}

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

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

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

.btn-primary:hover {
    background-color: #2980b9;
}

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

.btn-success:hover {
    background-color: #27ae60;
}

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

.btn-warning:hover {
    background-color: #e67e22;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-light {
    background-color: var(--light);
    color: var(--dark);
}

.btn-light:hover {
    background-color: #dde4e6;
}

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

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

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

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--light);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

.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(--border-radius);
    box-shadow: var(--box-shadow);
    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(--light);
}

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

.invoice-payments {
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(236, 240, 241, 0.5);
    border-radius: var(--border-radius);
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(149, 165, 166, 0.3);
}

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

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--light);
}

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

.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);
}

/* Paid invoice styling */
.invoice-card.paid {
    background-color: rgba(46, 204, 113, 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(--danger);
    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;
}

@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%;
    }
}