/* ============================================
   ?? LISTA INGRESOS DISTRITO - DISEÑO MODERNO
   ============================================ */
:root {
    --li-primary: #7c3aed;
    --li-primary-dark: #6d28d9;
    --li-primary-light: #a78bfa;
    --li-secondary: #10b981;
    --li-secondary-dark: #059669;
    --li-accent: #f59e0b;
    --li-accent-dark: #d97706;
    --li-white: #ffffff;
    --li-gray: #64748b;
    --li-gray-light: #94a3b8;
    --li-gray-lighter: #cbd5e1;
    --li-bg: #f8fafc;
    --li-border: #e2e8f0;
    --li-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --li-shadow-md: 0 6px 16px rgba(0, 0, 0, 0.12);
    --li-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* ============================================
   ?? CONTENEDOR PRINCIPAL
   ============================================ */
.listaingresos-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    background: var(--li-bg);
}

/* ============================================
   ?? ENCABEZADO
   ============================================ */
.listaingresos-header {
    background: linear-gradient(135deg, var(--li-primary) 0%, var(--li-primary-dark) 100%);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--li-shadow-lg);
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s ease-out;
}

.listaingresos-header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.listaingresos-header-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.listaingresos-header-text {
    flex: 1;
}

.listaingresos-title {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
}

.listaingresos-subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ============================================
   ?? TARJETA DEL FORMULARIO
   ============================================ */
.listaingresos-form-card {
    background: var(--li-white);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--li-shadow);
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

/* ============================================
   ?? SECCIONES
   ============================================ */
.listaingresos-section {
    margin-bottom: 0;
}

.listaingresos-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--li-primary);
    margin: 0 0 1.75rem 0;
}

.listaingresos-section-title svg {
    flex-shrink: 0;
}

/* ============================================
   ?? GRID DE FILTROS
   ============================================ */
.listaingresos-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.listaingresos-form-group {
    display: flex;
    flex-direction: column;
}

.listaingresos-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--li-gray);
    margin-bottom: 0.625rem;
}

.listaingresos-label-icon {
    width: 18px;
    height: 18px;
    color: var(--li-primary);
    flex-shrink: 0;
}

/* ============================================
   ?? INPUTS Y SELECTS
   ============================================ */
.listaingresos-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--li-border);
    border-radius: 12px;
    background: var(--li-white);
    color: #1e293b;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237c3aed' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.listaingresos-select:focus {
    border-color: var(--li-primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

/* ============================================
   ?? BOTONES DE ACCIÓN
   ============================================ */
.listaingresos-form-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.listaingresos-btn-search {
    padding: 1.125rem 3rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--li-primary), var(--li-primary-dark));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

.listaingresos-btn-search:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.listaingresos-btn-search:active {
    transform: translateY(-1px);
}

/* ============================================
   ?? TARJETA DE RESULTADOS
   ============================================ */
.listaingresos-results-card {
    background: var(--li-white);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--li-shadow);
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

/* ============================================
   ?? ENCABEZADO DEL PERÍODO
   ============================================ */
.listaingresos-period-header {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(167, 139, 250, 0.1));
    border: 2px solid var(--li-border);
    border-radius: 16px;
    padding: 1.75rem;
    margin-bottom: 2rem;
    text-align: center;
}

.listaingresos-period-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--li-primary);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.listaingresos-period-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--li-primary);
    margin: 0;
}

.listaingresos-period-separator {
    color: var(--li-accent);
    margin: 0 0.5rem;
}

/* ============================================
   ?? FILTROS DE TIPO DE INGRESO
   ============================================ */
.listaingresos-filters {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--li-border);
}

.listaingresos-filters-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--li-gray);
    margin: 0 0 1rem 0;
}

.listaingresos-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.listaingresos-filter-option {
    position: relative;
    cursor: pointer;
    flex: 1;
    min-width: 150px;
}

.listaingresos-filter-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.listaingresos-filter-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
    border: 2px solid var(--li-border);
    border-radius: 12px;
    background: var(--li-white);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--li-gray);
    transition: all 0.3s ease;
}

.listaingresos-filter-label svg {
    width: 16px;
    height: 16px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.listaingresos-filter-option:hover .listaingresos-filter-label {
    border-color: var(--li-primary-light);
    background: rgba(124, 58, 237, 0.05);
}

.listaingresos-filter-option.active .listaingresos-filter-label {
    border-color: var(--li-primary);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(167, 139, 250, 0.1));
    color: var(--li-primary);
}

.listaingresos-filter-option.active .listaingresos-filter-label svg {
    opacity: 1;
    color: var(--li-primary);
}

/* ============================================
   ?? TABLA DE RESULTADOS
   ============================================ */
.listaingresos-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 2px solid var(--li-border);
}

.listaingresos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    table-layout: auto; /* Permite que las columnas se ajusten al contenido */
}

.listaingresos-table thead {
    background: linear-gradient(135deg, var(--li-primary), var(--li-primary-dark));
    color: white;
}

.listaingresos-table thead th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.listaingresos-th-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.listaingresos-th-content svg {
    width: 16px;
    height: 16px;
    opacity: 0.9;
    flex-shrink: 0; /* Evita que el icono se encoja */
}

.listaingresos-table tbody tr {
    border-bottom: 1px solid var(--li-border);
    transition: all 0.3s ease;
}

.listaingresos-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.03);
}

.listaingresos-table tbody tr:last-child {
    border-bottom: none;
}

.listaingresos-table tbody td {
    padding: 1.25rem 1rem;
    color: #1e293b;
    vertical-align: top; /* Alinea el contenido arriba de la celda */
    max-width: 300px; /* Ancho máximo para evitar celdas muy anchas */
    word-wrap: break-word; /* Rompe palabras largas */
    word-break: break-word; /* Soporte adicional para romper palabras */
    white-space: normal; /* Permite múltiples líneas */
    overflow-wrap: break-word; /* Asegura que el texto se ajuste */
}

/* Anchos específicos para columnas que tienden a ser más cortas */
.listaingresos-table tbody td:nth-child(1), /* Fecha */
.listaingresos-table tbody td:nth-child(2), /* Importe */
.listaingresos-table tbody td:nth-child(7) { /* Comprobante */
    white-space: nowrap; /* Estas columnas no necesitan múltiples líneas */
    max-width: none;
}

/* Columnas que pueden tener texto largo */
.listaingresos-table tbody td:nth-child(3), /* Tipo de Ingreso */
.listaingresos-table tbody td:nth-child(4), /* SubTipo */
.listaingresos-table tbody td:nth-child(5), /* Concepto */
.listaingresos-table tbody td:nth-child(6) { /* Periodo */
    min-width: 120px; /* Ancho mínimo */
    max-width: 300px; /* Ancho máximo */
}

/* La columna de Concepto puede ser la más larga, dale más espacio */
.listaingresos-table tbody td:nth-child(5) {
    max-width: 400px;
}

/* ============================================
   ?? BOTONES DE LA TABLA
   ============================================ */
.listaingresos-btn-view {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--li-secondary), var(--li-secondary-dark));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    white-space: nowrap;
}

.listaingresos-btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, var(--li-secondary-dark), var(--li-secondary));
}

.listaingresos-btn-view:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.listaingresos-btn-view svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ============================================
   ?? BADGES Y CÉLULAS ESPECIALES
   ============================================ */
.listaingresos-cell-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.listaingresos-cell-date {
    background: rgba(124, 58, 237, 0.1);
    color: var(--li-primary);
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.listaingresos-cell-amount {
    font-weight: 700;
    color: var(--li-secondary);
    font-size: 1rem;
}

/* ============================================
   ?? ESTADOS DE CARGA Y VACÍO
   ============================================ */
.listaingresos-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1.5rem;
}

.listaingresos-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--li-border);
    border-top-color: var(--li-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.listaingresos-loading p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--li-gray);
    margin: 0;
}

.listaingresos-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1.5rem;
}

.listaingresos-empty svg {
    color: var(--li-gray-light);
}

.listaingresos-empty p {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--li-gray);
    margin: 0;
    text-align: center;
}

/* ============================================
   ? ANIMACIONES
   ============================================ */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ?? RESPONSIVE - TABLETS (768px)
   ============================================ */
@media (max-width: 992px) {
    .listaingresos-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .listaingresos-container {
        padding: 1.5rem 1rem;
    }

    .listaingresos-header {
        padding: 2rem 1.5rem;
        border-radius: 16px;
        margin-bottom: 1.5rem;
    }

    .listaingresos-header-content {
        gap: 1rem;
    }

    .listaingresos-header-icon {
        width: 60px;
        height: 60px;
    }

    .listaingresos-header-icon svg {
        width: 30px;
        height: 30px;
    }

    .listaingresos-title {
        font-size: 1.5rem;
    }

    .listaingresos-subtitle {
        font-size: 1rem;
    }

    .listaingresos-form-card,
    .listaingresos-results-card {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }

    .listaingresos-section-title {
        font-size: 1.25rem;
    }

    .listaingresos-filter-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .listaingresos-filter-buttons {
        flex-direction: column;
    }

    .listaingresos-filter-option {
        min-width: 100%;
    }

    .listaingresos-period-text {
        font-size: 1.25rem;
    }

    .listaingresos-btn-search {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   ?? RESPONSIVE - MÓVILES (480px)
   ============================================ */
@media (max-width: 480px) {
    .listaingresos-container {
        padding: 1rem 0.75rem;
    }

    .listaingresos-header {
        padding: 1.5rem 1rem;
        margin-bottom: 1rem;
    }

    .listaingresos-header-content {
        flex-direction: column;
        text-align: center;
    }

    .listaingresos-title {
        font-size: 1.375rem;
    }

    .listaingresos-subtitle {
        font-size: 0.9375rem;
    }

    .listaingresos-form-card,
    .listaingresos-results-card {
        padding: 1.5rem 1rem;
    }

    .listaingresos-section-title {
        font-size: 1.125rem;
        gap: 0.5rem;
    }

    .listaingresos-section-title svg {
        width: 18px;
        height: 18px;
    }

    .listaingresos-label {
        font-size: 0.875rem;
    }

    .listaingresos-select {
        padding: 0.75rem 0.875rem;
        font-size: 0.9375rem;
    }

    .listaingresos-btn-search {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }

    .listaingresos-period-header {
        padding: 1.25rem 1rem;
    }

    .listaingresos-period-text {
        font-size: 1.125rem;
    }

    .listaingresos-filters-title {
        font-size: 1rem;
    }

    .listaingresos-table thead th {
        padding: 1rem 0.75rem;
        font-size: 0.75rem;
    }

    .listaingresos-table tbody td {
        padding: 1rem 0.75rem;
        font-size: 0.875rem;
    }

    .listaingresos-btn-view {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
}

/* ============================================
   ? ACCESIBILIDAD
   ============================================ */
.listaingresos-select:focus,
.listaingresos-btn-search:focus,
.listaingresos-btn-view:focus,
.listaingresos-filter-option input:focus + .listaingresos-filter-label {
    outline: 3px solid var(--li-primary);
    outline-offset: 2px;
}

/* Reducir animaciones para usuarios que lo prefieran */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   ?? MODO OSCURO (opcional para futuro)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Aquí se pueden agregar estilos para modo oscuro si se desea */
}
