﻿/* ============================================
   VARIABLES CSS UNIFICADAS - GASTOS
   ============================================ */
:root {
    /* Colores primarios */
    --gastos-primary: #4b1ca4;
    --gastos-primary-dark: #3a1580;
    --gastos-primary-light: #6b2dd4;
    --gastos-secondary: #d60739;
    --gastos-secondary-dark: #b00530;
    /* Colores de estado */
    --gastos-success: #10b981;
    --gastos-warning: #f59e0b;
    --gastos-info: #3b82f6;
    --gastos-danger: #ef4444;
    /* Colores base */
    --gastos-bg: #f8fafc;
    --gastos-white: #ffffff;
    --gastos-text: #1e293b;
    --gastos-text-muted: #64748b;
    --gastos-border: #e2e8f0;
    --gastos-border-light: #f1f5f9;
    /* Gradientes */
    --gradient-gastos-primary: linear-gradient(135deg, #4b1ca4, #6b2dd4);
    --gradient-gastos-success: linear-gradient(135deg, #10b981, #059669);
    /* Efectos */
    --gastos-radius: 12px;
    --gastos-radius-sm: 8px;
    --gastos-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --gastos-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --gastos-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --gastos-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET Y BASE
   ============================================ */
* {
    box-sizing: border-box;
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */
.gastos-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 80px);
    background-color: var(--gastos-bg);
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   HEADER CON BOTÓN VER GASTOS
   ============================================ */
.gastos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--gastos-primary);
    animation: slideInDown 0.6s ease-out;
}

.gastos-title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--gastos-primary);
    margin: 0;
    position: relative;
    display: inline-block;
}

    .gastos-title::after {
        content: '';
        position: absolute;
        bottom: -8px;
        left: 0;
        width: 60px;
        height: 4px;
        background: var(--gradient-gastos-primary);
        border-radius: 2px;
    }

.btn-ver-gastos {
    background: var(--gradient-gastos-success);
    color: white;
    border: none;
    border-radius: var(--gastos-radius);
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--gastos-transition);
    box-shadow: var(--gastos-shadow-md);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .btn-ver-gastos:hover {
        transform: translateY(-2px);
        box-shadow: var(--gastos-shadow-lg);
        color: white;
    }

    .btn-ver-gastos:active {
        transform: translateY(0);
    }

    .btn-ver-gastos svg {
        transition: transform 0.3s;
    }

    .btn-ver-gastos:hover svg {
        transform: translateX(5px);
    }

/* ============================================
   CARD PRINCIPAL DEL FORMULARIO
   ============================================ */
.gastos-form-card {
    background: var(--gastos-white);
    border-radius: var(--gastos-radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--gastos-shadow-md);
    border: 1px solid var(--gastos-border-light);
    animation: slideInUp 0.6s ease-out;
}

/* ============================================
   GRUPOS DE CAMPOS
   ============================================ */
.form-group-gastos {
    margin-bottom: 1.5rem;
}

.form-label-gastos {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gastos-text);
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

    .form-label-gastos::before {
        content: '';
        display: inline-block;
        width: 3px;
        height: 1rem;
        background: var(--gradient-gastos-primary);
        border-radius: 2px;
        margin-right: 0.5rem;
        vertical-align: middle;
    }

/* ============================================
   INPUTS Y SELECTS
   ============================================ */
.form-control-gastos {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--gastos-border);
    border-radius: var(--gastos-radius-sm);
    background-color: var(--gastos-white);
    color: var(--gastos-text);
    transition: var(--gastos-transition);
}

    .form-control-gastos:focus {
        outline: none;
        border-color: var(--gastos-primary);
        box-shadow: 0 0 0 3px rgba(75, 28, 164, 0.1);
    }

    .form-control-gastos:hover {
        border-color: var(--gastos-primary-light);
    }

    .form-control-gastos::placeholder {
        color: var(--gastos-text-muted);
    }

/* Input de número con estilo especial */
.input-importe-gastos {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gastos-primary);
}

/* ============================================
   INPUT FILE PERSONALIZADO
   ============================================ */
.file-input-wrapper-gastos {
    position: relative;
    display: block;
}

.file-input-gastos {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    border: 2px dashed var(--gastos-border);
    border-radius: var(--gastos-radius-sm);
    background-color: var(--gastos-bg);
    cursor: pointer;
    transition: var(--gastos-transition);
}

    .file-input-gastos:hover {
        border-color: var(--gastos-primary);
        background-color: rgba(75, 28, 164, 0.05);
    }

    .file-input-gastos::file-selector-button {
        margin-right: 1rem;
        padding: 0.5rem 1rem;
        border: none;
        border-radius: var(--gastos-radius-sm);
        background: var(--gradient-gastos-primary);
        color: white;
        font-weight: 600;
        cursor: pointer;
        transition: var(--gastos-transition);
    }

        .file-input-gastos::file-selector-button:hover {
            transform: scale(1.05);
        }

/* ============================================
   BOTÓN PRINCIPAL DE GUARDAR
   ============================================ */
.btn-guardar-gasto {
    width: 100%;
    background: var(--gradient-gastos-primary);
    color: white;
    border: none;
    border-radius: var(--gastos-radius);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--gastos-transition);
    box-shadow: var(--gastos-shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

    .btn-guardar-gasto::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .btn-guardar-gasto:hover::before {
        width: 400px;
        height: 400px;
    }

    .btn-guardar-gasto:hover {
        transform: translateY(-3px);
        box-shadow: var(--gastos-shadow-lg);
    }

    .btn-guardar-gasto:active {
        transform: translateY(-1px);
    }

    .btn-guardar-gasto:focus-visible {
        outline: 3px solid var(--gastos-primary);
        outline-offset: 3px;
    }

    .btn-guardar-gasto svg {
        transition: transform 0.3s;
        position: relative;
        z-index: 1;
    }

    .btn-guardar-gasto:hover svg {
        transform: scale(1.2);
    }

    .btn-guardar-gasto span {
        position: relative;
        z-index: 1;
    }

/* ============================================
   ESTADOS DE VALIDACIÓN
   ============================================ */
.form-control-gastos.is-invalid {
    border-color: var(--gastos-danger);
    background-color: rgba(239, 68, 68, 0.05);
}

.form-control-gastos.is-valid {
    border-color: var(--gastos-success);
    background-color: rgba(16, 185, 129, 0.05);
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablets */
@media (max-width: 1024px) {
    .gastos-container {
        padding: 1.5rem 1rem;
    }

    .gastos-form-card {
        padding: 2rem 1.5rem;
    }
}

/* Móviles */
@media (max-width: 768px) {
    .gastos-container {
        padding: 1rem 0.75rem;
    }

    .gastos-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn-ver-gastos {
        width: 100%;
        justify-content: center;
    }

    .gastos-form-card {
        padding: 1.5rem 1rem;
    }

    .form-group-gastos {
        margin-bottom: 1.25rem;
    }

    .btn-guardar-gasto {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .gastos-container {
        padding: 1rem 0.5rem;
    }

    .gastos-title {
        font-size: 1.5rem;
    }

    .form-control-gastos {
        padding: 0.75rem 0.875rem;
        font-size: 0.95rem;
    }

    .btn-ver-gastos {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }

    .btn-guardar-gasto {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .btn-guardar-gasto::before {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .form-control-gastos,
    .btn-guardar-gasto,
    .btn-ver-gastos {
        border: 2px solid currentColor;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-muted-gastos {
    color: var(--gastos-text-muted);
    font-size: 0.875rem;
}

.text-danger-gastos {
    color: var(--gastos-danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.text-success-gastos {
    color: var(--gastos-success);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
