* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Cards */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    display: flex;
    align-items: center;
    padding: 20px;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 1.5rem;
    color: white;
}

.card-icon.income {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.card-icon.expense {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.card-icon.balance {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.card-content h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.amount {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

/* Chart Section */
.charts-section {
    margin-bottom: 30px;
}

.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.chart-tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f0f0f0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.chart-tab-btn:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
}

.chart-tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chart-tab-btn:hover:not(.active) {
    background: #e0e0e0;
    color: #333;
}

.charts-container {
    position: relative;
    min-height: 400px;
}

.chart-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.chart-content.active {
    display: block;
}

.chart-content canvas {
    max-height: 400px;
}

#chart-expense-descriptions canvas {
    min-height: 400px !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Forms Section */
.forms-section {
    margin-bottom: 30px;
}

.forms-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.form-card h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 3px solid #eee;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #9E9E9E, #757575);
    color: white;
}

/* Payment Model */
.payment-model {
    margin-bottom: 30px;
}

/* Payment Alerts */
.payment-alerts {
    margin-bottom: 20px;
}

.payment-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 10px;
    border-left: 4px solid;
    animation: slideInAlert 0.5s ease-out;
}

.payment-alert.urgent {
    background: #ffebee;
    border-left-color: #f44336;
    color: #c62828;
}

.payment-alert.warning {
    background: #fff3e0;
    border-left-color: #ff9800;
    color: #e65100;
}

.payment-alert.info {
    background: #e3f2fd;
    border-left-color: #2196f3;
    color: #1565c0;
}

.alert-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.alert-icon {
    font-size: 1.2rem;
    margin-right: 12px;
}

.alert-text {
    flex: 1;
}

.alert-title {
    font-weight: bold;
    margin-bottom: 2px;
}

.alert-description {
    font-size: 0.9rem;
    opacity: 0.8;
}

.alert-actions {
    display: flex;
    gap: 10px;
}

.btn-alert {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-mark-paid {
    background: #4caf50;
    color: white;
}

.btn-mark-paid:hover {
    background: #45a049;
}

.btn-postpone {
    background: #2196f3;
    color: white;
}

.btn-postpone:hover {
    background: #1976d2;
}

.btn-dismiss {
    background: #9e9e9e;
    color: white;
}

.btn-dismiss:hover {
    background: #757575;
}

@keyframes slideInAlert {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Alert Counter Badge */
.alert-counter {
    background: #f44336;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.payment-options {
    margin-bottom: 25px;
}

.payment-method h4 {
    margin-bottom: 15px;
    color: #333;
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.recurring-list h4 {
    margin-bottom: 15px;
    color: #333;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.payments-container {
    display: grid;
    gap: 10px;
}

.recurring-payment {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.recurring-payment:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.payment-info {
    flex: 1;
}

.payment-info strong {
    display: block;
    color: #333;
    margin-bottom: 5px;
}

.payment-info small {
    color: #666;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.payment-status {
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.payment-status.overdue {
    background: #ffcdd2;
    color: #c62828;
}

.payment-status.due-today {
    background: #ffe0b2;
    color: #e65100;
}

.payment-status.due-soon {
    background: #fff3e0;
    color: #ff9800;
}

.payment-amount {
    font-weight: bold;
    color: #667eea;
    margin-right: 15px;
    font-size: 1.1rem;
}

.payment-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-action {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-paid {
    background: #4caf50;
    color: white;
}

.btn-paid:hover {
    background: #45a049;
    transform: scale(1.05);
}

.btn-remove {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-remove:hover {
    background: #d32f2f;
}

/* Transactions Table */
.transactions-section {
    margin-bottom: 30px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.table-controls select,
.table-controls input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
}

.table-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
}

td {
    color: #666;
}

.transaction-income {
    color: #4CAF50;
    font-weight: bold;
}

.transaction-expense {
    color: #f44336;
    font-weight: bold;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin: 0 2px;
}

.btn-edit {
    background: #2196F3;
    color: white;
}

.btn-delete {
    background: #f44336;
    color: white;
}

/* Method Badges */
.method-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.method-efectivo {
    background: #4CAF50;
    color: white;
}

.method-tarjeta {
    background: #2196F3;
    color: white;
}

.method-transferencia {
    background: #FF9800;
    color: white;
}

.method-cheque {
    background: #9C27B0;
    color: white;
}

/* Category Tags */
.category-tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e3f2fd;
    color: #1976d2;
}

/* Estilos específicos para las nuevas categorías de egreso */
.category-tag.category-restaurante {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
}

.category-tag.category-alquiler {
    background: linear-gradient(135deg, #8E44AD, #9B59B6);
    color: white;
}

.category-tag.category-quimica {
    background: linear-gradient(135deg, #16A085, #1ABC9C);
    color: white;
}

.category-tag.category-tecnica {
    background: linear-gradient(135deg, #34495E, #2C3E50);
    color: white;
}

.category-tag.category-prestamo {
    background: linear-gradient(135deg, #E74C3C, #C0392B);
    color: white;
}

.category-tag.category-luz {
    background: linear-gradient(135deg, #F39C12, #E67E22);
    color: white;
}

.category-tag.category-agua {
    background: linear-gradient(135deg, #3498DB, #2980B9);
    color: white;
}

.category-tag.category-internet {
    background: linear-gradient(135deg, #9B59B6, #8E44AD);
    color: white;
}

/* Hover effects para las nuevas categorías */
.category-tag.category-restaurante:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.category-tag.category-alquiler:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.4);
}

.category-tag.category-quimica:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(22, 160, 133, 0.4);
}

.category-tag.category-tecnica:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(52, 73, 94, 0.4);
}

.category-tag.category-prestamo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.category-tag.category-luz:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.category-tag.category-agua:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.category-tag.category-internet:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.4);
}

/* Iconos específicos para gráficos */
.expense-icon-restaurante::before { content: "🍴"; }
.expense-icon-alquiler::before { content: "🏘️"; }
.expense-icon-quimica::before { content: "💊"; }
.expense-icon-tecnica::before { content: "🔧"; }
.expense-icon-prestamo::before { content: "💳"; }
.expense-icon-luz::before { content: "💡"; }
.expense-icon-agua::before { content: "💧"; }
.expense-icon-internet::before { content: "📶"; }

/* Monthly Analysis */
.monthly-analysis {
    margin-bottom: 30px;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.analysis-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.analysis-item h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.analysis-values p {
    margin-bottom: 8px;
    color: #666;
}

.analysis-values span {
    font-weight: bold;
    color: #333;
}

.savings-goal {
    margin-top: 10px;
}

.savings-goal input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

#savings-status {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .forms-container {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-controls {
        justify-content: stretch;
    }
    
    .table-controls > * {
        flex: 1;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chart-tabs {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .chart-tab-btn {
        flex: 1;
        min-width: auto;
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: slideIn 0.5s ease-out;
}

/* Utility Classes */
.text-success {
    color: #4CAF50 !important;
}

.text-danger {
    color: #f44336 !important;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mt-20 {
    margin-top: 20px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilos para configuración de pagos quincenales */
.biweekly-options {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.biweekly-options h4 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.biweekly-options .form-group {
    margin-bottom: 15px;
}

.biweekly-options label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: 6px;
}

.biweekly-options label:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.biweekly-options input[type="radio"] {
    margin-right: 10px;
    margin-top: 2px;
    accent-color: #667eea;
}

.biweekly-options label span {
    font-weight: 500;
    color: #495057;
}

.biweekly-options small {
    display: block;
    color: #6c757d;
    font-size: 12px;
    margin-left: 30px;
    margin-top: -3px;
    font-style: italic;
}

/* Animación para mostrar/ocultar configuración quincenal */
.biweekly-options {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mejoras visuales para select de frecuencia */
#recurring-frequency {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#recurring-frequency:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#recurring-frequency option {
    padding: 8px;
}
