/* ============================================
   LISTA GASTOS - ESTILOS MODERNOS COMPARTIDOS
   ============================================ */

/* CONTENEDOR PRINCIPAL */
.lista-gastos-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ENCABEZADO MODERNO */
.lista-gastos-header {
    background: linear-gradient(135deg, #4b1ca4 0%, #6d28d9 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(75, 28, 164, 0.2);
    color: white;
}

.lista-gastos-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lista-gastos-header-icon {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lista-gastos-header-icon svg {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.lista-gastos-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lista-gastos-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 5px 0 0 0;
    font-weight: 300;
}

/* TARJETA DE FORMULARIO */
.lista-gastos-form-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(75, 28, 164, 0.1);
}

.lista-gastos-section {
    margin-bottom: 25px;
}

.lista-gastos-section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #4b1ca4;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lista-gastos-section-title svg {
    color: #6d28d9;
}

/* GRID DE FILTROS */
.lista-gastos-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.lista-gastos-form-group {
    display: flex;
    flex-direction: column;
}

.lista-gastos-label {
    font-weight: 600;
    color: #4b1ca4;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lista-gastos-label-icon {
    width: 18px;
    height: 18px;
    color: #6d28d9;
}

.lista-gastos-select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #f9fafb;
    color: #1f2937;
}

.lista-gastos-select:focus {
    outline: none;
    border-color: #4b1ca4;
    box-shadow: 0 0 0 4px rgba(75, 28, 164, 0.1);
    background-color: white;
}

/* BOTÓN DE BÚSQUEDA */
.lista-gastos-form-actions {
    display: flex;
    justify-content: center;
    margin-top: 25px;
}

.lista-gastos-btn-search {
    background: linear-gradient(135deg, #4b1ca4 0%, #6d28d9 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(75, 28, 164, 0.3);
}

.lista-gastos-btn-search:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(75, 28, 164, 0.4);
}

.lista-gastos-btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* TARJETA DE RESULTADOS */
.lista-gastos-results-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(75, 28, 164, 0.1);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ENCABEZADO DE PERÍODO */
.lista-gastos-period-header {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 12px;
    padding: 20px 25px;
    margin-bottom: 25px;
    border-left: 5px solid #4b1ca4;
}

.lista-gastos-period-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #4b1ca4;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.lista-gastos-period-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.lista-gastos-period-separator {
    color: #4b1ca4;
    font-weight: 700;
    margin: 0 10px;
}

/* FILTROS DE TIPO */
.lista-gastos-filters {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.lista-gastos-filters-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
}

.lista-gastos-filter-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.lista-gastos-filter-option {
    position: relative;
    cursor: pointer;
}

.lista-gastos-filter-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.lista-gastos-filter-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #374151;
}

.lista-gastos-filter-option input[type="radio"]:checked ~ .lista-gastos-filter-label {
    background: linear-gradient(135deg, #4b1ca4 0%, #6d28d9 100%);
    border-color: #4b1ca4;
    color: white;
    box-shadow: 0 4px 12px rgba(75, 28, 164, 0.3);
}

.lista-gastos-filter-label svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* TABLA DESKTOP */
.lista-gastos-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.lista-gastos-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: fixed; /* Para controlar mejor el ancho de las columnas */
}

.lista-gastos-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.lista-gastos-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #4b1ca4;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Definir anchos específicos para cada columna */
.lista-gastos-table th:nth-child(1) { width: 12%; } /* Fecha */
.lista-gastos-table th:nth-child(2) { width: 12%; } /* Importe */
.lista-gastos-table th:nth-child(3) { width: 15%; } /* Tipo de Egreso */
.lista-gastos-table th:nth-child(4) { width: 30%; } /* Concepto - más ancho */
.lista-gastos-table th:nth-child(5) { width: 15%; } /* Periodo */
.lista-gastos-table th:nth-child(6) { width: 16%; } /* Comprobante */

.lista-gastos-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.lista-gastos-table tbody tr:hover {
    background-color: #f9fafb;
}

.lista-gastos-table tbody tr:last-child {
    border-bottom: none;
}

.lista-gastos-table td {
    padding: 16px;
    color: #374151;
    font-size: 0.95rem;
    vertical-align: top; /* Alinear al inicio para textos largos */
}

/* Estilos específicos para la columna de concepto */
.lista-gastos-table td:nth-child(4) {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: normal;
    max-width: 300px;
    line-height: 1.5;
}

/* Estilos para otras columnas con texto */
.lista-gastos-table td:nth-child(3) { /* Tipo de Egreso */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.lista-gastos-table td:nth-child(5) { /* Periodo */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.lista-gastos-cell-date {
    background: linear-gradient(135deg, #4b1ca4 0%, #6d28d9 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap; /* La fecha no debe cortarse */
}

.lista-gastos-cell-amount {
    font-weight: 700;
    color: #dc2626;
    font-size: 1.05rem;
    white-space: nowrap; /* El importe no debe cortarse */
}

.lista-gastos-btn-view {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.lista-gastos-btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* CARDS MOBILE */
.lista-gastos-cards-mobile {
    display: none;
}

.lista-gastos-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lista-gastos-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.lista-gastos-card-header {
    background: linear-gradient(135deg, #4b1ca4 0%, #6d28d9 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lista-gastos-card-date {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.lista-gastos-card-amount {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 700;
}

.lista-gastos-card-body {
    padding: 16px;
}

.lista-gastos-card-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Cambio a flex-start para textos largos */
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
    gap: 12px; /* Agregar espacio entre label y value */
}

.lista-gastos-card-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.lista-gastos-card-label {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0; /* El label no se encoge */
    min-width: 100px;
}

.lista-gastos-card-value {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
    text-align: right;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.5;
    flex: 1; /* Toma el espacio disponible */
}

.lista-gastos-card-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

/* ESTADOS DE CARGA */
.lista-gastos-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.lista-gastos-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top-color: #4b1ca4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.lista-gastos-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.lista-gastos-empty svg {
    color: #d1d5db;
    margin-bottom: 20px;
}

.lista-gastos-empty p {
    font-size: 1.1rem;
    margin: 0;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .lista-gastos-container {
        padding: 15px;
    }

    .lista-gastos-header {
        padding: 20px;
        border-radius: 12px;
    }

    .lista-gastos-header-content {
        flex-direction: column;
        text-align: center;
    }

    .lista-gastos-title {
        font-size: 1.5rem;
    }

    .lista-gastos-subtitle {
        font-size: 0.9rem;
    }

    .lista-gastos-form-card {
        padding: 20px;
        border-radius: 12px;
    }

    .lista-gastos-filter-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .lista-gastos-btn-search {
        width: 100%;
        justify-content: center;
        padding: 12px 24px;
    }

    .lista-gastos-results-card {
        padding: 20px;
        border-radius: 12px;
    }

    .lista-gastos-period-header {
        padding: 15px;
    }

    .lista-gastos-period-text {
        font-size: 1rem;
    }

    .lista-gastos-filter-buttons {
        grid-template-columns: 1fr;
    }

    /* Ocultar tabla en móvil */
    .lista-gastos-table-wrapper {
        display: none;
    }

    /* Mostrar cards en móvil */
    .lista-gastos-cards-mobile {
        display: block;
    }
}

/* ANIMACIONES */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lista-gastos-fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* SCROLL SUAVE */
html {
    scroll-behavior: smooth;
}
