/* =====================================================
   ESTILOS PARA SISTEMA DE TABS - DASHBOARD ADMIN v6.0
   Fecha: 22/12/2025
   ===================================================== */

/* =====================================================
   TABS NAVIGATION
   ===================================================== */

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

.tabs-nav {
    display: flex;
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-button {
    flex: 1;
    min-width: 150px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.tab-button:hover {
    background: var(--color-accent-soft);
    color: var(--color-text);
}

.tab-button.active {
    color: var(--color-primary);
    background: white;
    border-bottom-color: var(--color-primary);
}

.tab-button .tab-icon {
    font-size: 1.2rem;
}

.tab-button .tab-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--color-border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin-left: 0.5rem;
}

.tab-button.active .tab-badge {
    background: #dbeafe;
    color: var(--color-primary-dark);
}

/* =====================================================
   TAB CONTENT
   ===================================================== */

.tabs-content {
    padding: 0;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

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

/* =====================================================
   RESUMEN CONSOLIDADO - TAB 3
   ===================================================== */

.resumen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.resumen-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resumen-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--color-text-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card.critico { border-left-color: #dc2626; }
.stat-card.serio { border-left-color: #ea580c; }
.stat-card.moderado { border-left-color: #f59e0b; }
.stat-card.leve { border-left-color: #eab308; }
.stat-card.aceptable { border-left-color: #16a34a; }
.stat-card.sin-contar { border-left-color: var(--color-text-light); }

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.resumen-table-wrapper {
    padding: 1.5rem;
    overflow-x: auto;
}

.resumen-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.resumen-table thead {
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
}

.resumen-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-light);
    white-space: nowrap;
}

.resumen-table tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s ease;
}

.resumen-table tbody tr:hover {
    background: var(--color-bg);
}

.resumen-table td {
    padding: 0.75rem 1rem;
}

.resumen-table td.numeric {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.resumen-table td.centered {
    text-align: center;
}

/* =====================================================
   BADGES DE ESTADO
   ===================================================== */

.badge-estado {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-critico {
    background: #fee2e2;
    color: #991b1b;
}

.badge-serio {
    background: #fed7aa;
    color: #9a3412;
}

.badge-moderado {
    background: #fef3c7;
    color: #92400e;
}

.badge-leve {
    background: #fef9c3;
    color: #854d0e;
}

.badge-aceptable {
    background: #d1fae5;
    color: #065f46;
}

.badge-sin-contar {
    background: var(--color-border);
    color: var(--color-text-light);
}

/* =====================================================
   COLUMNAS DE DIFERENCIA
   ===================================================== */

.diferencia-positiva {
    color: #16a34a;
    font-weight: 600;
}

.diferencia-negativa {
    color: #dc2626;
    font-weight: 600;
}

.diferencia-cero {
    color: var(--color-text-light);
}

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

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--color-text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* =====================================================
   EMPTY STATES
   ===================================================== */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.empty-state-hint {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* =====================================================
   PAGINACIÓN RESUMEN CONSOLIDADO
   ===================================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    margin-top: 1rem;
    border-radius: 0 0 8px 8px;
}

.pagination button {
    padding: 0.625rem 1.25rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.pagination button:hover:not(:disabled) {
    background: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.pagination button:active:not(:disabled) {
    transform: translateY(0);
}

.pagination button:disabled {
    background: var(--color-border);
    color: var(--color-text-light);
    cursor: not-allowed;
    transform: none;
}

.pagination span {
    color: var(--color-text-light);
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 200px;
    text-align: center;
}

/* Responsive paginación */
@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination button {
        width: 100%;
        max-width: 300px;
    }
    
    .pagination span {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .tabs-nav {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    
    .tab-button {
        min-width: 120px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .tab-button .tab-badge {
        display: none;
    }
    
    .resumen-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .resumen-table {
        font-size: 0.75rem;
    }
    
    .resumen-table th,
    .resumen-table td {
        padding: 0.5rem;
    }
    
    .resumen-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .resumen-stats {
        grid-template-columns: 1fr;
    }
    
    .tab-button .tab-icon {
        font-size: 1rem;
    }
}

/* =====================================================
   BOTÓN DE EXPORTACIÓN
   ===================================================== */

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-export:active {
    transform: translateY(0);
}

.btn-export:disabled {
    background: var(--color-text-light);
    cursor: not-allowed;
    transform: none;
}

/* =====================================================
   TOOLTIP
   ===================================================== */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--color-text);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}
