/* ========================================================================== */
/* EFECTIVIDAD PAGE - Reporte de Efectividad                                */
/* ========================================================================== */

/* Eliminar padding del main-content para esta página */
.main-content:has(.efectividad-page) {
    padding: 0 !important;
}

.efectividad-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 95px);
    width: 100%;
    padding: 0;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Ajuste del camara-panel para que ocupe todo el espacio */
.efectividad-page .camara-panel {
    margin: 0;
    padding: 0.75rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Ajuste del camara-header */
.efectividad-page .camara-header {
    margin: 0 0 0.5rem 0;
    padding: 0.25rem 0.5rem;
    flex-shrink: 0;
}

/* Override de camara-body para layout en columna */
.efectividad-page .camara-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.75rem;
    flex: 1;
    min-height: 0;
}

/* Sección 1: Filtro */
.filter-section {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    flex-shrink: 0;
}

/* Botones de filtro personalizados */
.filter-section .btn-primary-gradient {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
}

.filter-section .btn-primary-gradient svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Botón "Seleccionar Período" con color azul */
.filter-section .btn-primary-gradient:first-child {
    background: linear-gradient(135deg, #00b4ff, #1ac4ff);
    border: none;
}

.filter-section .btn-primary-gradient:first-child:hover {
    background: linear-gradient(135deg, #0099e6, #00b4ff);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 180, 255, 0.4);
}

/* Sección 2: Summary Cards */
.summary-section {
    width: 100%;
    flex-shrink: 0;
}

/* Sección 3: Contenido del Reporte */

/* Date Picker usa las clases de calidad.css - No redefinir aquí */

/* Report Content Container */
.report-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-container p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.3);
    border-radius: 8px;
    color: #ff453a;
    margin: 0 1.5rem;
}

.error-message svg {
    flex-shrink: 0;
    stroke: #ff453a;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 1rem;
}

.empty-state svg {
    stroke: var(--text-secondary);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    margin: 0;
}

.empty-state p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.empty-state .hint {
    font-size: 0.85rem;
    font-style: italic;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    flex-shrink: 0;
}

.summary-card {
    padding: 0.35rem 0.85rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #F07400, #00b4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 0.1rem;
}

/* Details Section */
.details-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-shrink: 0;
    width: 100%;
}

.details-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid;
    border-image: linear-gradient(90deg, #F07400, #00b4ff) 1;
}

/* Table Container */
.table-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    background: var(--bg-primary);
    border-radius: 8px;
}

/* Efectividad Table */
.efectividad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.efectividad-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #F07400, #00b4ff);
}

.efectividad-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: white;
    background: transparent;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    font-size: 0.8rem;
}

.efectividad-table tbody tr {
    transition: background-color 0.2s ease;
}

.efectividad-table tbody tr:hover {
    background: rgba(240, 116, 0, 0.05);
}

.efectividad-table td {
    padding: 0.65rem 0.75rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 0.8rem;
}

.efectividad-table tbody tr:last-child td {
    border-bottom: none;
}

/* User Name Cell */
.user-name-cell {
    font-weight: 600;
    color: var(--text-primary);
}

/* Wrap Cell - Para columnas que necesitan salto de línea */
.wrap-cell {
    white-space: normal !important;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 120px;
    min-width: 80px;
}

/* Progress Bar in Table */
.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 100px;
}

.progress-bar-fill {
    height: 6px;
    background: linear-gradient(90deg, #F07400, #00b4ff);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
}

/* Efficiency Badge */
.efficiency-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.efficiency-overtime {
    background: rgba(191, 90, 242, 0.15);
    color: #bf5af2;
    border: 1px solid rgba(191, 90, 242, 0.3);
    font-weight: 700;
}

.efficiency-excellent {
    background: rgba(48, 209, 88, 0.15);
    color: #30d158;
    border: 1px solid rgba(48, 209, 88, 0.3);
}

.efficiency-good {
    background: rgba(0, 180, 255, 0.15);
    color: #00b4ff;
    border: 1px solid rgba(0, 180, 255, 0.3);
}

.efficiency-average {
    background: rgba(255, 159, 10, 0.15);
    color: #ff9f0a;
    border: 1px solid rgba(255, 159, 10, 0.3);
}

.efficiency-poor {
    background: rgba(255, 69, 58, 0.15);
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.3);
}

/* Type Badge */
.type-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.type-tabulacion {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.type-pendientes {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.type-calidad {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Value Styling */
.positive-value {
    color: #30d158;
    font-weight: 600;
}

.negative-value {
    color: #ff453a;
    font-weight: 600;
}

/* Efficiency Chart */
.efficiency-chart-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
}

.efficiency-bar-row {
    display: grid;
    grid-template-columns: 150px 1fr 100px;
    align-items: center;
    gap: 1.5rem;
}

.user-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    text-align: right;
    padding-right: 1rem;
}

.bar-container {
    position: relative;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: visible;
}

.efficiency-bar {
    position: relative;
    height: 100%;
    border-radius: 8px;
    transition: all 1.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bar-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.efficiency-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

/* Bar Color Classes */
.bar-overtime {
    background: linear-gradient(90deg, rgba(191, 90, 242, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
    border: 2px solid rgba(191, 90, 242, 0.4);
    box-shadow: 0 4px 20px rgba(191, 90, 242, 0.2);
}

.bar-excellent {
    background: linear-gradient(90deg, rgba(48, 209, 88, 0.25) 0%, rgba(40, 194, 68, 0.25) 100%);
    border: 2px solid rgba(48, 209, 88, 0.4);
    box-shadow: 0 4px 20px rgba(48, 209, 88, 0.2);
}

.bar-good {
    background: linear-gradient(90deg, rgba(0, 180, 255, 0.25) 0%, rgba(0, 150, 214, 0.25) 100%);
    border: 2px solid rgba(0, 180, 255, 0.4);
    box-shadow: 0 4px 20px rgba(0, 180, 255, 0.2);
}

.bar-average {
    background: linear-gradient(90deg, rgba(255, 159, 10, 0.25) 0%, rgba(230, 138, 0, 0.25) 100%);
    border: 2px solid rgba(255, 159, 10, 0.4);
    box-shadow: 0 4px 20px rgba(255, 159, 10, 0.2);
}

.bar-poor {
    background: linear-gradient(90deg, rgba(255, 69, 58, 0.25) 0%, rgba(230, 57, 48, 0.25) 100%);
    border: 2px solid rgba(255, 69, 58, 0.4);
    box-shadow: 0 4px 20px rgba(255, 69, 58, 0.2);
}

/* Hover Effect */
.efficiency-bar-row:hover .efficiency-bar {
    transform: scaleY(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

/* ========================================================================== */
/* RESPONSIVE                                                                 */
/* ========================================================================== */

@media (max-width: 1024px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .efectividad-page {
        gap: 0.75rem;
        height: calc(100vh - 95px);
        min-height: calc(100vh - 95px);
        max-height: calc(100vh - 95px);
        overflow: hidden;
    }

    .efectividad-page .camara-panel {
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
    }

    .efectividad-page .camara-header {
        flex-shrink: 0;
    }

    .efectividad-page .camara-body {
        flex: 1;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .report-content {
        padding: 0 1rem 1rem;
    }

    .table-wrapper {
        max-height: 200px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .details-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .efectividad-page {
        height: calc(100vh - 95px);
        min-height: calc(100vh - 95px);
        max-height: calc(100vh - 95px);
        overflow: hidden;
    }

    .efectividad-page .camara-panel {
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
    }

    .efectividad-page .camara-header {
        flex-shrink: 0;
    }

    .efectividad-page .camara-body {
        flex: 1;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }

    .filter-section {
        padding: 0.5rem;
    }
}

/* ========================================================================== */
/* MODO CLARO - LIGHT MODE                                                  */
/* ========================================================================== */

/* Date Picker - Modo claro (usa estilos de calidad.css) */

:root.light-mode .efectividad-table tbody tr:hover,
.light-mode .efectividad-table tbody tr:hover {
    background: rgba(240, 116, 0, 0.08);
}

/* Efficiency Chart - Modo claro */
:root.light-mode .user-label,
.light-mode .user-label {
    color: #1a1a1a;
}

:root.light-mode .efficiency-value,
.light-mode .efficiency-value {
    color: #666666;
}

/* Summary Cards - Modo claro */
:root.light-mode .summary-card,
.light-mode .summary-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

/* Efficiency Chart Bars - Modo claro (mayor opacidad que modo oscuro) */
:root.light-mode .bar-overtime,
.light-mode .bar-overtime {
    background: linear-gradient(90deg, rgba(191, 90, 242, 0.4) 0%, rgba(168, 85, 247, 0.4) 100%);
    border: 2px solid rgba(191, 90, 242, 0.5);
}

:root.light-mode .bar-excellent,
.light-mode .bar-excellent {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.4) 0%, rgba(16, 185, 129, 0.4) 100%);
    border: 2px solid rgba(34, 197, 94, 0.5);
}

:root.light-mode .bar-good,
.light-mode .bar-good {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.4) 0%, rgba(37, 99, 235, 0.4) 100%);
    border: 2px solid rgba(59, 130, 246, 0.5);
}

:root.light-mode .bar-average,
.light-mode .bar-average {
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.4) 0%, rgba(249, 115, 22, 0.4) 100%);
    border: 2px solid rgba(251, 146, 60, 0.5);
}

:root.light-mode .bar-poor,
.light-mode .bar-poor {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.4) 0%, rgba(220, 38, 38, 0.4) 100%);
    border: 2px solid rgba(239, 68, 68, 0.5);
}
