/* savings-manager.css - Estilos para Gestor de Ahorro */

:root {
    --savings-green: #10b981;
    --savings-yellow: #f59e0b;
    --savings-blue: #3b82f6;
    --savings-purple: #8b5cf6;
    --savings-red: #ef4444;
}

/* ========================================
   RESUMEN FINANCIERO - AHORROS
   ======================================== */

.financial-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    padding: 1rem;
    border-radius: 0.75rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    min-height: 80px;
}

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

.summary-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.summary-content h3 {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0 0 0.25rem 0;
    opacity: 0.95;
}

.summary-content p {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.summary-card.savings {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.summary-card.income {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.summary-card.withdrawal {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.summary-card.goals {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* ========================================
   TABS DE NAVEGACIÓN
   ======================================== */

.nav-tabs-container {
    background: white;
    padding: 0;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.nav-tabs {
    border-bottom: none;
    padding: 0.5rem 1rem 0 1rem;
}

.nav-tabs .nav-link {
    border: none;
    color: #6b7280;
    padding: 1rem 1.5rem;
    margin-right: 0.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.nav-tabs .nav-link i {
    margin-right: 0.5rem;
}

/* ========================================
   TABLA DE TRANSACCIONES
   ======================================== */

.transaction-badge {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.transaction-badge.income {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.transaction-badge.withdrawal {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

/* ========================================
   METAS DE AHORRO
   ======================================== */

.progress-bar-container {
    width: 100%;
    height: 2rem;
    background-color: #e5e7eb;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 1rem;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.1) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.1) 75%,
        transparent 75%,
        transparent
    );
    background-size: 2rem 2rem;
    animation: progress-animation 1s linear infinite;
}

@keyframes progress-animation {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 2rem 0;
    }
}

.goal-status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-block;
}

.goal-status-badge.activa {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.goal-status-badge.completada {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.goal-status-badge.cancelada {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

/* ========================================
   RESUMEN MENSUAL
   ======================================== */

.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-detail-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-detail-card h4 {
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.summary-detail-card h4 i {
    margin-right: 0.5rem;
    color: #10b981;
}

.summary-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}

.stat-label {
    font-weight: 500;
    color: #6b7280;
    font-size: 0.95rem;
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1f2937;
}

.stat-value.text-success {
    color: #10b981 !important;
}

.stat-value.text-danger {
    color: #ef4444 !important;
}

.stat-value.text-primary {
    color: #3b82f6 !important;
}

/* ========================================
   BOTONES DE ACCIÓN PERSONALIZADOS
   ======================================== */

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.3);
}

.btn-outline-success {
    border: 2px solid #10b981;
    color: #10b981;
    background: transparent;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-success:hover {
    background: #10b981;
    color: white;
    transform: translateY(-2px);
}

.btn-outline-warning {
    border: 2px solid #f59e0b;
    color: #f59e0b;
    background: transparent;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-warning:hover {
    background: #f59e0b;
    color: white;
    transform: translateY(-2px);
}

/* ========================================
   FORMULARIOS Y MODALES
   ======================================== */

.savings-form {
    text-align: left;
}

.savings-form .form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    display: block;
}

.savings-form .form-control,
.savings-form .form-select {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.savings-form .form-control:focus,
.savings-form .form-select:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    outline: none;
}

.savings-form .form-text {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.savings-form .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
}

.savings-form .form-check-input:checked {
    background-color: #10b981;
    border-color: #10b981;
}

.savings-form .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
}

.savings-form .form-check-input:checked {
    background-color: #10b981;
    border-color: #10b981;
}

.savings-form .form-check-input[type="radio"] {
    border-radius: 50%;
}

.savings-form .form-check-label {
    cursor: pointer;
}

/* ========================================
   ALERTAS Y NOTIFICACIONES
   ======================================== */

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: none;
    color: #1e40af;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: none;
    color: #065f46;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: none;
    color: #92400e;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
}

/* ========================================
   DATATABLES PERSONALIZADO
   ======================================== */

#savings-table tbody tr,
#goals-table tbody tr,
#summary-table tbody tr {
    transition: all 0.3s ease;
}

#savings-table tbody tr:hover,
#goals-table tbody tr:hover,
#summary-table tbody tr:hover {
    background-color: #f0fdf4 !important;
    transform: translateX(5px);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .financial-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .summary-cards-grid {
        grid-template-columns: 1fr;
    }

    .action-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-group button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .financial-summary {
        grid-template-columns: 1fr;
    }

    .summary-card {
        min-height: 70px;
    }

    .summary-content p {
        font-size: 1.25rem;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.manager-panel {
    animation: fadeInUp 0.5s ease;
}

.summary-card {
    animation: fadeInUp 0.5s ease;
}

.summary-card:nth-child(1) { animation-delay: 0.1s; }
.summary-card:nth-child(2) { animation-delay: 0.2s; }
.summary-card:nth-child(3) { animation-delay: 0.3s; }
.summary-card:nth-child(4) { animation-delay: 0.4s; }

/* ========================================
   ESTILOS PARA MONTOS
   ======================================== */

.amount-positive {
    color: #10b981;
    font-weight: 700;
}

.amount-negative {
    color: #ef4444;
    font-weight: 700;
}

.amount-neutral {
    color: #6b7280;
    font-weight: 600;
}

/* ========================================
   BADGES DE FORMA DE PAGO
   ======================================== */

.payment-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.payment-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.payment-efectivo {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.payment-dolar {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.payment-euro {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.payment-peso {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
}

.payment-oro {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.payment-usdt {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.payment-cripto {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
}

.payment-otra {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

/* Estilos para el select de payment_type */
#transaction-payment-type {
    font-size: 1rem;
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: border-color 0.3s ease;
}

#transaction-payment-type:focus {
    border-color: #10b981;
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

#transaction-payment-type option {
    padding: 0.5rem;
    font-size: 1rem;
}

/* ========================================
   TOOLTIPS
   ======================================== */

[data-bs-toggle="tooltip"] {
    cursor: help;
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #e5e7eb;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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