/* ============================================
   ANALYTICS DASHBOARD STYLES
   ============================================ */

/* Analytics Dashboard */
.analytics-dashboard {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fade-in 0.3s ease-out;
}

.analytics-dashboard.active {
    display: flex;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.analytics-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.analytics-header h2 {
    margin: 0;
    font-size: 24px;
    font-family: 'Fredoka One', cursive;
}

.btn-close-analytics {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close-analytics:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.analytics-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 30px;
    margin-top: 60px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Sections */
.analytics-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #ecf0f1;
}

.analytics-section:last-of-type {
    border-bottom: none;
}

.analytics-section h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 18px;
    font-family: 'Fredoka One', cursive;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #3498db;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 8px;
    font-family: 'Fredoka One', cursive;
}

.stat-label {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
}

/* Info Box */
.info-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.info-label {
    font-weight: 600;
    color: #2c3e50;
}

.info-value {
    color: #3498db;
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #9b59b6);
    transition: width 0.5s ease;
}

/* User List */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.rank {
    font-weight: bold;
    color: #3498db;
    font-size: 16px;
    min-width: 30px;
    text-align: center;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.user-messages {
    font-size: 12px;
    color: #7f8c8d;
}

.percentage {
    color: #9b59b6;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

/* Metrics */
.metrics-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #ecf0f1;
}

.metric-label {
    font-weight: 600;
    color: #2c3e50;
}

.metric-value {
    font-size: 20px;
    font-weight: bold;
    color: #3498db;
    font-family: 'Fredoka One', cursive;
}

/* Hour Chart */
.chart-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
}

.hour-chart {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 6px;
    align-items: flex-end;
    height: 150px;
}

.chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.bar-fill {
    width: 100%;
    background: linear-gradient(180deg, #3498db, #2980b9);
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 5px;
    transition: all 0.3s ease;
}

.bar-fill:hover {
    background: linear-gradient(180deg, #5dade2, #3498db);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.bar-label {
    position: absolute;
    top: -20px;
    font-size: 10px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bar-fill:hover .bar-label {
    opacity: 1;
}

.bar-hour {
    font-size: 10px;
    color: #7f8c8d;
    margin-top: 6px;
    font-weight: 600;
}

/* Actions */
.analytics-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #ecf0f1;
    flex-wrap: wrap;
}

.analytics-actions .btn {
    flex: 1;
    min-width: 140px;
}

/* Scrollbar */
.analytics-content::-webkit-scrollbar {
    width: 8px;
}

.analytics-content::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.analytics-content::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.analytics-content::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .analytics-dashboard {
        align-items: flex-end;
        justify-content: center;
    }

    .analytics-content {
        width: 100%;
        max-height: 90vh;
        border-radius: 12px 12px 0 0;
        padding: 20px;
        margin-top: 0;
    }

    .analytics-header {
        width: 100%;
        border-radius: 12px 12px 0 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        font-size: 24px;
    }

    .stat-value {
        font-size: 20px;
    }

    .metrics-list {
        grid-template-columns: 1fr;
    }

    .hour-chart {
        grid-template-columns: repeat(12, 1fr);
        gap: 4px;
    }

    .bar-hour {
        font-size: 8px;
    }

    .analytics-actions {
        flex-direction: column;
    }

    .analytics-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .analytics-content {
        padding: 16px;
    }

    .analytics-header h2 {
        font-size: 18px;
    }

    .analytics-section {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }

    .analytics-section h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 10px;
    }

    .top-user-item {
        padding: 10px;
        gap: 8px;
    }

    .user-name {
        font-size: 14px;
    }

    .user-messages {
        font-size: 11px;
    }

    .hour-chart {
        grid-template-columns: repeat(8, 1fr);
        gap: 3px;
        height: 120px;
    }

    .metric {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .metric-value {
        font-size: 16px;
    }
}

/* Dark Mode Support */
body.dark-mode .analytics-content {
    background: #34495e;
    color: #ecf0f1;
}

body.dark-mode .analytics-section {
    border-bottom-color: #52687a;
}

body.dark-mode .analytics-section h3 {
    color: #ecf0f1;
}

body.dark-mode .stat-card {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.15) 0%, rgba(155, 89, 182, 0.15) 100%);
    border-color: #52687a;
}

body.dark-mode .stat-card:hover {
    border-color: #3498db;
}

body.dark-mode .info-item {
    background: #2c3e50;
    border-left-color: #3498db;
}

body.dark-mode .info-label {
    color: #ecf0f1;
}

body.dark-mode .top-user-item {
    background: #2c3e50;
    border-left-color: #3498db;
}

body.dark-mode .user-name {
    color: #ecf0f1;
}

body.dark-mode .metric {
    background: #2c3e50;
    border-color: #52687a;
}

body.dark-mode .metric-label {
    color: #ecf0f1;
}

body.dark-mode .chart-container {
    background: #2c3e50;
}

body.dark-mode .bar-fill {
    background: linear-gradient(180deg, #5dade2 0%, #3498db 100%);
}

body.dark-mode .bar-fill:hover {
    background: linear-gradient(180deg, #85c1e2 0%, #5dade2 100%);
}

body.dark-mode .bar-hour {
    color: #95a5a6;
}

body.dark-mode .analytics-actions {
    border-top-color: #52687a;
}

body.dark-mode .analytics-content::-webkit-scrollbar-track {
    background: #2c3e50;
}

body.dark-mode .analytics-content::-webkit-scrollbar-thumb {
    background: #52687a;
}

body.dark-mode .analytics-content::-webkit-scrollbar-thumb:hover {
    background: #7f8c8d;
}
