/* ===========================================
   GASTOS - ESTILOS
   =========================================== */

/* Filtros de gastos */
.sgt-gastos-filters {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sgt-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sgt-filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
}

.sgt-filter-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 120px;
    background: white;
    cursor: pointer;
}

.sgt-filter-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Estadísticas */
.sgt-gastos-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.sgt-stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.sgt-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.sgt-stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sgt-stat-card .stat-info {
    flex: 1;
}

.sgt-stat-card .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.sgt-stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Colores por pagador */
.stat-ana .stat-icon {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.stat-leo .stat-icon {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.stat-mediafix .stat-icon {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
}

.stat-total .stat-icon {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

/* Tabla de gastos */
.sgt-gastos-tbody tr {
    transition: background-color 0.2s ease;
}

.sgt-gastos-tbody tr:hover {
    background-color: #f8f9fa;
}

.sgt-gasto-fecha {
    font-weight: 600;
    color: #495057;
}

.sgt-gasto-concepto {
    font-weight: 500;
    color: #2c3e50;
}

.sgt-gasto-pagador {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.sgt-gasto-pagador.pagador-ana {
    background: linear-gradient(135deg, #ffe5e5 0%, #ffcccc 100%);
    color: #c0392b;
    border: 1px solid #e74c3c;
}

.sgt-gasto-pagador.pagador-leo {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
    border: 1px solid #2196f3;
}

.sgt-gasto-pagador.pagador-mediafix {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    color: #7b1fa2;
    border: 1px solid #9c27b0;
}

.sgt-gasto-importe {
    font-weight: 700;
    font-size: 1.1rem;
    color: #e74c3c;
    text-align: right;
}

.sgt-gasto-notas {
    color: #6c757d;
    font-size: 0.9rem;
    font-style: italic;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Botones de acción en la tabla */
.sgt-gasto-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.sgt-btn-edit-gasto,
.sgt-btn-delete-gasto {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.sgt-btn-edit-gasto {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.2);
}

.sgt-btn-edit-gasto:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.sgt-btn-delete-gasto {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.sgt-btn-delete-gasto:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* Modal */
.sgt-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* Botones de pagador */
.sgt-pagador-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.sgt-pagador-btn {
    padding: 0.6rem 0.5rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.sgt-pagador-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sgt-pagador-btn[data-pagador="Ana"] {
    border-color: #e74c3c;
    color: #c0392b;
}

.sgt-pagador-btn[data-pagador="Ana"]:hover {
    background: linear-gradient(135deg, #ffe5e5 0%, #ffcccc 100%);
    border-color: #c0392b;
}

.sgt-pagador-btn[data-pagador="Ana"].active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-color: #c0392b;
}

.sgt-pagador-btn[data-pagador="Leo"] {
    border-color: #3498db;
    color: #1976d2;
}

.sgt-pagador-btn[data-pagador="Leo"]:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #1976d2;
}

.sgt-pagador-btn[data-pagador="Leo"].active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-color: #2980b9;
}

.sgt-pagador-btn[data-pagador="Mediafix"] {
    border-color: #9b59b6;
    color: #7b1fa2;
}

.sgt-pagador-btn[data-pagador="Mediafix"]:hover {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #7b1fa2;
}

.sgt-pagador-btn[data-pagador="Mediafix"].active {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border-color: #8e44ad;
}

/* Responsive */
@media (max-width: 768px) {
    .sgt-gastos-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .sgt-filter-group {
        width: 100%;
    }

    .sgt-filter-select {
        width: 100%;
    }

    .sgt-gastos-stats {
        grid-template-columns: 1fr 1fr;
    }

    .sgt-form-row {
        grid-template-columns: 1fr;
    }

    .sgt-pagador-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.3rem;
        gap: 0.3rem;
    }

    .sgt-pagador-btn i {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .sgt-gastos-stats {
        grid-template-columns: 1fr;
    }

    .sgt-stat-card {
        padding: 1rem;
    }

    .sgt-stat-card .stat-value {
        font-size: 1.3rem;
    }
}

/* Estado vacío */
.sgt-gastos-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #95a5a6;
}

.sgt-gastos-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sgt-gastos-empty p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.sgt-gastos-empty small {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Notificación rápida */
.sgt-quick-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
    z-index: 99999;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Z-index super alto para SweetAlert2 */
.swal2-container {
    z-index: 999999 !important;
}

.swal2-popup {
    z-index: 999999 !important;
}

/* Modal de revisión de gastos debe estar por debajo de SweetAlert */
#sgt-review-gastos-modal {
    z-index: 99999 !important;
}

/* Animaciones AI para predicciones */
@keyframes aiPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.8);
        transform: scale(1.05);
    }
}

@keyframes aiGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(102, 126, 234, 0.6), 0 2px 8px rgba(0,0,0,0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(102, 126, 234, 1), 0 4px 16px rgba(0,0,0,0.4);
    }
}

/* Badge AI de predicción */
.sgt-ai-prediction-badge {
    position: relative;
    overflow: hidden;
}

.sgt-ai-prediction-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Media Mensual Section */
.sgt-filter-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.sgt-gastos-media-mensual {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-width: 280px;
}

.media-mensual-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.media-mensual-header i {
    font-size: 16px;
}

.media-mensual-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.media-mensual-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.media-mensual-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(5px);
}

.media-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

.media-label i {
    font-size: 14px;
    opacity: 0.9;
}

.media-value {
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive para filtros y media mensual */
@media (max-width: 1200px) {
    .sgt-filter-section {
        flex-direction: column;
    }

    .sgt-gastos-media-mensual {
        width: 100%;
    }

    .media-mensual-items {
        flex-direction: row;
        justify-content: space-between;
    }

    .media-mensual-item {
        flex: 1;
    }
}