/* Variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --success: #27ae60;
    --warning: #f39c12;
    --error: #e74c3c;
    --info: #3498db;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border: #dfe6e9;
    --background: #f8f9fa;
    --surface: #ffffff;
}

/* Budgets Section */
.budgets-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 24px;
    margin-bottom: 30px;
}

.budgets-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.budget-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 20px;
    transition: all 0.2s ease;
}

.budget-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.budget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.budget-year {
    display: flex;
    align-items: center;
    gap: 12px;
}

.year-badge {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.year-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.year-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.currency-badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--info);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 2px;
}

.budget-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

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

.btn-icon.delete:hover {
    background: var(--error);
    border-color: var(--error);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

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

.budget-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label-small {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value-small {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

.stat-value-small.warning {
    color: var(--warning);
}

.budget-progress {
    margin-top: 12px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.progress-bar-small {
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill-small {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

.progress-fill-small.warning {
    background: var(--warning);
}

.progress-fill-small.danger {
    background: var(--error);
}

.budget-notes {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.813rem;
    color: var(--text-secondary);
    font-style: italic;
}

.budget-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* No Budgets */
.no-budgets {
    text-align: center;
    padding: 60px 20px;
}

.no-budgets svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.no-budgets h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.no-budgets p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card.total {
    border-left: 4px solid var(--info);
}

.stat-card.spent {
    border-left: 4px solid var(--warning);
}

.stat-card.available {
    border-left: 4px solid var(--success);
}

.stat-card.percentage {
    border-left: 4px solid var(--primary-color);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.813rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Progress Section */
.progress-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 24px;
    margin-bottom: 30px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    height: 24px;
    background: var(--background);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--info) 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.progress-fill.warning {
    background: linear-gradient(90deg, var(--warning) 0%, #e67e22 100%);
}

.progress-fill.danger {
    background: linear-gradient(90deg, var(--error) 0%, #c0392b 100%);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border-radius: 2px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-form {
    padding: 24px;
}

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

/* Budget Form Section */
.budget-form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 24px;
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.budget-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.form-input:disabled,
.form-textarea:disabled {
    background: var(--background);
    color: var(--text-secondary);
    cursor: not-allowed;
}

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

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-cancel {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: var(--background);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-save {
    padding: 12px 24px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save:hover:not(:disabled) {
    background: #229954;
}

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* History Section */
.history-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 24px;
    margin-bottom: 30px;
}

.history-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.last-update {
    padding: 16px;
    background: var(--background);
    border-radius: 2px;
    border: 1px solid var(--border);
}

.update-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.update-meta {
    display: flex;
    gap: 20px;
    font-size: 0.813rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
}

.spinner-small circle {
    stroke: white;
    stroke-dasharray: 50;
    stroke-dashoffset: 25;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .btn-primary {
        width: 100%;
    }

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

    .form-actions,
    .modal-actions {
        flex-direction: column-reverse;
    }

    .btn-cancel,
    .btn-save {
        width: 100%;
        justify-content: center;
    }

    .budget-card-header {
        flex-direction: column;
        gap: 12px;
    }

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

    .modal {
        padding: 10px;
    }

    .modal-content {
        max-width: 100%;
    }
}

