/* ==========================================
   ANALYTICS DASHBOARD STYLES
   ========================================== */

/* Overlay */
.analytics-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

/* Modal */
.analytics-modal {
    background: white;
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

/* Header */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.analytics-header h2 {
    margin: 0;
    font-size: 1.8rem;
}

.analytics-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.analytics-select {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-export,
.btn-refresh,
.btn-close-analytics {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-export {
    background: #4ECDC4;
    color: white;
}

.btn-export:hover {
    background: #3db8af;
}

.btn-refresh {
    background: #45B7D1;
    color: white;
}

.btn-refresh:hover {
    background: #3a9db8;
}

.btn-close-analytics {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.btn-close-analytics:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Stats Cards Grid */
.analytics-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 10px 0;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts Grid */
.analytics-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
    padding: 30px;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.chart-container h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.2rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.chart-container canvas {
    max-height: 300px;
}

/* Tables */
.analytics-table {
    max-height: 350px;
    overflow-y: auto;
}

.analytics-table table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table thead {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 1;
}

.analytics-table th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
}

.analytics-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.analytics-table tr:hover {
    background: #f8f9fa;
}

.analytics-table strong {
    color: #667eea;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .analytics-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .analytics-header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .analytics-header h2 {
        font-size: 1.4rem;
    }

    .analytics-actions {
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }

    .analytics-stats-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .analytics-charts-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }

    .analytics-table {
        margin-top: 10px;
        font-size: 0.8rem;
        overflow-x: auto;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar personalizada */
.analytics-modal::-webkit-scrollbar,
.analytics-table::-webkit-scrollbar {
    width: 8px;
}

.analytics-modal::-webkit-scrollbar-track,
.analytics-table::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.analytics-modal::-webkit-scrollbar-thumb,
.analytics-table::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.analytics-modal::-webkit-scrollbar-thumb:hover,
.analytics-table::-webkit-scrollbar-thumb:hover {
    background: #555;
}