/* PRESTO PLAYER STATS - CSS COMPLETO FINAL */

/* ESTILOS BASE DEL WRAPPER */
.presto-stats-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
}

.presto-stats-wrapper * {
    box-sizing: border-box;
}

/* CONTROLES */
.presto-stats-controls {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 15px;
}

.controls-row.secondary {
    margin-bottom: 0;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #334155;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-icon {
    font-size: 16px;
}

.control-select,
.control-input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
    min-width: 200px;
    color: #1f2937;
}

.control-select:focus,
.control-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-load-stats {
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
}

.btn-load-stats:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    color: #ffffff !important;
}

/* BOTONES DE FECHAS RÁPIDAS */
.quick-dates {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-date-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    color: #1f2937 !important;
    font-weight: 500;
}

.quick-date-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #1f2937 !important;
}

/* CONTROLES DE EXPORTACIÓN */
.export-controls {
    display: flex;
    gap: 8px;
}

.export-btn {
    padding: 6px 12px;
    background: #f59e0b;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.export-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* BOTONES DE GRÁFICOS */
.chart-type-btn {
    padding: 8px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    color: #1f2937 !important;
    font-weight: 500;
}

.chart-type-btn:hover {
    background: #f1f5f9;
    color: #1f2937 !important;
}

.chart-type-btn.active {
    background: #3b82f6;
    color: #ffffff !important;
    border-color: #3b82f6;
}

/* BOTONES DE ORDENACIÓN */
.sort-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    color: #1f2937 !important;
    font-weight: 500;
}

.sort-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #1f2937 !important;
}

.sort-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8 !important;
}

/* TARJETAS DE RESUMEN */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.total-views {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card.unique-views {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-card.avg-time {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-card.completion {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #374151;
}

.stat-icon {
    font-size: 32px;
    opacity: 0.9;
}

.stat-content h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.stat-detail {
    display: block;
    font-size: 10px;
    opacity: 0.8;
    margin-top: 4px;
}

/* LOADING */
.presto-stats-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* GRÁFICOS */
.stats-charts {
    margin-bottom: 30px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1f2937;
}

.chart-controls {
    display: flex;
    gap: 8px;
}

.chart-container {
    height: 400px;
    position: relative;
}

/* DETALLES DE VIDEOS */
.stats-details {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.details-header {
    background: #f8fafc;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.details-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1f2937;
}

.details-controls {
    display: flex;
    gap: 8px;
}

.video-details-list {
    padding: 20px;
}

.video-detail-item {
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.video-detail-item:last-child {
    border-bottom: none;
}

.video-detail-item h4 {
    margin: 0 0 12px 0;
    color: #1f2937;
    font-size: 16px;
}

.video-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.video-stat {
    text-align: center;
}

.video-stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.video-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

/* ANÁLISIS AVANZADO MEJORADO */
.advanced-analytics {
    margin-top: 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.advanced-analytics-header {
    background: linear-gradient(135deg, #1e40af 0%, #3730a3 100%);
    color: white;
    padding: 24px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.advanced-analytics-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><linearGradient id="shine" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:rgba(255,255,255,0.1);stop-opacity:1" /><stop offset="100%" style="stop-color:rgba(255,255,255,0);stop-opacity:0" /></linearGradient></defs><rect width="100" height="20" fill="url(%23shine)"/></svg>') repeat;
    opacity: 0.1;
}

.advanced-analytics-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.advanced-analytics-header p {
    margin: 8px 0 0 0;
    opacity: 0.9;
    font-size: 16px;
    position: relative;
    z-index: 1;
}

/* GRID DE ANÁLISIS */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 32px;
}

/* SECCIONES INDIVIDUALES */
.analytics-section {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.analytics-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-color: #3b82f6;
}

.section-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.section-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.section-header h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    font-size: 24px;
    padding: 8px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 8px;
    min-width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.section-description {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

/* MAPA DE CALOR MEJORADO CON ALTURA FIJA */
.heatmap-container {
    padding: 24px;
}

.heatmap-intro {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.heatmap-intro-icon {
    font-size: 24px;
    color: #d97706;
    flex-shrink: 0;
}

.heatmap-intro-text {
    flex: 1;
}

.heatmap-intro-text h4 {
    margin: 0 0 4px 0;
    color: #92400e;
    font-weight: 600;
    font-size: 14px;
}

.heatmap-intro-text p {
    margin: 0;
    color: #92400e;
    font-size: 13px;
}

/* Gráfica de mapa de calor con altura fija */
.heatmap-chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.heatmap-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.heatmap-chart-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}

/* Eliminamos los controles de vista */
.heatmap-chart-controls {
    display: none;
}

.heatmap-chart-wrapper {
    height: 350px; /* Altura fija para evitar crecimiento excesivo */
    position: relative;
    max-height: 350px; /* Asegurar que nunca exceda esta altura */
    overflow: hidden; /* Ocultar cualquier contenido que se desborde */
}

.heatmap-display {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
    display: none; /* Ocultar por defecto ya que no se usa */
}

/* Asegurar que el canvas del mapa de calor tenga altura controlada */
#heatmap-chart {
    max-height: 320px !important; /* Limitar altura máxima del canvas */
}

/* DISTRIBUCIÓN GEOGRÁFICA CON TABLA COMPRIMIDA */
.geography-container {
    padding: 24px;
}

.geography-intro {
    background: #dbeafe;
    border: 1px solid #3b82f6;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.geography-intro-icon {
    font-size: 24px;
    color: #1d4ed8;
    flex-shrink: 0;
}

.geography-intro-text {
    flex: 1;
}

.geography-intro-text h4 {
    margin: 0 0 4px 0;
    color: #1e40af;
    font-weight: 600;
    font-size: 14px;
}

.geography-intro-text p {
    margin: 0;
    color: #1e40af;
    font-size: 13px;
}

.geography-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.geography-chart-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TABLA DE PAÍSES COMPRIMIDA */
.countries-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.countries-table-header {
    background: #f8fafc;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.countries-table-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.countries-table {
    width: 100%;
    border-collapse: collapse;
}

.countries-table th {
    background: #f9fafb;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}

.countries-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #1f2937;
    vertical-align: middle;
}

.countries-table tr:hover {
    background: #f8fafc;
}

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

.country-flag-cell {
    text-align: center;
    font-size: 18px;
    width: 50px;
}

.country-name-cell {
    font-weight: 600;
    min-width: 120px;
}

.country-views-cell {
    font-weight: 700;
    color: #3b82f6;
}

.country-percentage-cell {
    font-weight: 600;
    color: #059669;
}

.country-visitors-cell {
    color: #6b7280;
}

.country-time-cell {
    color: #6b7280;
    font-family: monospace;
}

.country-progress-cell {
    width: 100px;
    position: relative;
}

.country-progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.country-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ENGAGEMENT METRICS CENTRADAS CON BORDE INFERIOR */
.engagement-section .analytics-section {
    background: linear-gradient(135deg, #fef7ff 0%, #f3e8ff 100%);
}

.engagement-intro {
    background: #ede9fe;
    border: 1px solid #8b5cf6;
    border-radius: 12px;
    padding: 16px;
    margin: 24px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.engagement-intro-icon {
    font-size: 24px;
    color: #7c3aed;
    flex-shrink: 0;
}

.engagement-intro-text {
    flex: 1;
}

.engagement-intro-text h4 {
    margin: 0 0 4px 0;
    color: #6b46c1;
    font-weight: 600;
    font-size: 14px;
}

.engagement-intro-text p {
    margin: 0;
    color: #6b46c1;
    font-size: 13px;
}

.engagement-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
    padding: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.engagement-card {
    background: white;
    padding: 32px 24px;
    text-align: center;
    border: none;
    border-right: 1px solid #f1f5f9;
    border-bottom: 3px solid #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.engagement-card:last-child {
    border-right: none;
}

.engagement-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #a855f7);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.engagement-card:hover {
    background: #fefbff;
    border-bottom-color: transparent;
}

.engagement-card:hover::before {
    transform: scaleX(1);
}

.engagement-card h4 {
    margin: 0 0 12px 0;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.engagement-value {
    display: block;
    font-size: 32px;
    font-weight: 900;
    color: #1f2937;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.engagement-card small {
    color: #6b7280;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 500;
    margin-top: auto;
}

/* ESTADOS SIN DATOS */
.no-data {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.no-data-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-data-text {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.no-data-description {
    font-size: 14px;
    opacity: 0.8;
}

/* RESPONSIVE MEJORADO */
@media (max-width: 1200px) {
    .geography-stats {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .geography-chart-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .presto-stats-wrapper {
        margin: 10px;
        padding: 15px;
    }
    
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        min-width: unset;
    }
    
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .quick-dates {
        justify-content: center;
    }
    
    .advanced-analytics-header {
        padding: 20px 24px;
    }
    
    .analytics-grid {
        padding: 24px 20px;
        gap: 20px;
    }
    
    .engagement-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .engagement-card {
        border-right: none;
        border-bottom: 1px solid #f1f5f9;
    }
    
    .engagement-card:nth-child(odd) {
        border-right: 1px solid #f1f5f9;
    }
    
    .engagement-card:nth-last-child(-n+2) {
        border-bottom: 3px solid #e5e7eb;
    }
    
    .export-controls {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .video-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .heatmap-chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .countries-table {
        font-size: 12px;
    }
    
    .countries-table th,
    .countries-table td {
        padding: 8px 12px;
    }
    
    .country-name-cell {
        min-width: 100px;
    }
    
    .heatmap-chart-wrapper {
        height: 300px;
        max-height: 300px;
    }
    
    #heatmap-chart {
        max-height: 270px !important;
    }
}

@media (max-width: 480px) {
    .stats-summary {
        grid-template-columns: 1fr;
    }
    
    .advanced-analytics {
        margin: 20px 10px;
    }
    
    .analytics-grid {
        padding: 20px 16px;
    }
    
    .engagement-metrics {
        grid-template-columns: 1fr;
    }
    
    .engagement-card {
        border-right: none;
        border-bottom: 1px solid #f1f5f9;
    }
    
    .engagement-card:last-child {
        border-bottom: 3px solid #e5e7eb;
    }
    
    .geography-chart-container {
        height: 250px;
        padding: 16px;
    }
    
    .video-stats {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .heatmap-chart-wrapper {
        height: 250px;
        max-height: 250px;
    }
    
    #heatmap-chart {
        max-height: 220px !important;
    }
    
    .countries-table-container {
        margin: 0 -8px;
    }
    
    /* Tabla responsive - stack vertical en móviles */
    .countries-table,
    .countries-table thead,
    .countries-table tbody,
    .countries-table th,
    .countries-table td,
    .countries-table tr {
        display: block;
    }
    
    .countries-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .countries-table tr {
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 12px;
        background: white;
    }
    
    .countries-table td {
        border: none !important;
        position: relative;
        padding: 6px 0 6px 40%;
        text-align: left;
    }
    
    .countries-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
    }
}

/* ANIMACIONES */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.advanced-analytics {
    animation: slideInUp 0.6s ease;
}

.analytics-section {
    animation: fadeInScale 0.5s ease;
}

.countries-table tr {
    animation: slideInUp 0.3s ease;
}

.countries-table tr:nth-child(even) {
    animation-delay: 0.05s;
}

.countries-table tr:nth-child(odd) {
    animation-delay: 0.1s;
}

/* TEMA OSCURO */
.presto-stats-wrapper[data-theme="dark"] .advanced-analytics {
    background: #374151;
    border-color: #4b5563;
}

.presto-stats-wrapper[data-theme="dark"] .analytics-section {
    background: #1f2937;
}

.presto-stats-wrapper[data-theme="dark"] .section-header {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.presto-stats-wrapper[data-theme="dark"] .engagement-card {
    background: #374151;
    border-color: #4b5563;
}

.presto-stats-wrapper[data-theme="dark"] .engagement-card h4,
.presto-stats-wrapper[data-theme="dark"] .engagement-value {
    color: #f9fafb;
}

.presto-stats-wrapper[data-theme="dark"] .no-data {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
}

/* PRINT STYLES */
@media print {
    .advanced-analytics {
        background: white !important;
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .analytics-section {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .section-header {
        background: #f5f5f5 !important;
        color: #000 !important;
        border-bottom: 2px solid #000;
    }
    
    .export-controls {
        display: none !important;
    }
    
    .engagement-card,
    .countries-table {
        border: 1px solid #ccc !important;
        background: white !important;
    }
}