/* ============================================
   FGC Analytics Dashboard Styles
   ============================================ */

/* Analytics container */
.analytics-dashboard {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

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

.analytics-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    color: white;
}

/* Analytics header */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.analytics-title {
    font-size: clamp(28px, 4vmin, 48px);
    font-weight: 800;
    color: #88BB0B;
    margin: 0;
}

.analytics-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.analytics-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    transform: rotate(90deg);
}

.analytics-date-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analytics-date-selector label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.date-range-select {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-range-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.date-range-select:focus {
    outline: none;
    border-color: #88BB0B;
    box-shadow: 0 0 0 3px rgba(136, 187, 11, 0.2);
}

.date-range-select option {
    background: #1A1A1A;
    color: white;
}

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

.stat-card {
    background: linear-gradient(135deg, rgba(136, 187, 11, 0.2) 0%, rgba(106, 147, 8, 0.1) 100%);
    border: 2px solid rgba(136, 187, 11, 0.3);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(136, 187, 11, 0.6);
    box-shadow: 0 8px 24px rgba(136, 187, 11, 0.2);
}

.stat-value {
    font-size: clamp(32px, 5vmin, 56px);
    font-weight: 800;
    color: #88BB0B;
    margin-bottom: 8px;
    font-family: 'Roboto Mono', monospace;
}

.stat-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Charts grid */
.analytics-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
}

.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
}

.chart-container:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chart styles */
.analytics-chart {
    width: 100%;
    height: auto;
    max-width: 100%;
}

.bar-chart .bar-item {
    transition: all 0.2s ease;
    cursor: pointer;
}

.bar-chart .bar-item:hover {
    opacity: 0.8;
    filter: brightness(1.2);
}

.bar-label {
    fill: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.bar-value {
    fill: white;
    font-weight: 700;
}

.line-chart .line-path {
    filter: drop-shadow(0 2px 4px rgba(136, 187, 11, 0.3));
}

.line-chart .line-dot {
    cursor: pointer;
    transition: all 0.2s ease;
}

.line-chart .line-dot:hover {
    r: 7;
    filter: drop-shadow(0 2px 8px rgba(136, 187, 11, 0.6));
}

.axis-label {
    fill: rgba(255, 255, 255, 0.6);
}

.pie-chart .pie-slice {
    cursor: pointer;
    transition: all 0.2s ease;
    transform-origin: center;
}

.pie-chart .pie-slice:hover {
    opacity: 0.9;
    filter: brightness(1.1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.pie-label {
    pointer-events: none;
}

.pie-percentage {
    pointer-events: none;
    opacity: 0.9;
}

.heat-map .heat-map-cell {
    cursor: pointer;
    transition: all 0.15s ease;
}

.heat-map .heat-map-cell:hover {
    stroke: #88BB0B;
    stroke-width: 2;
    filter: brightness(1.2);
}

.heat-map-label {
    fill: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

.heat-map-hour-label {
    fill: rgba(255, 255, 255, 0.6);
    font-size: 10px;
}

/* Loading and error states */
.analytics-loading,
.analytics-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 20px;
}

.analytics-loading .loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #88BB0B;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.analytics-loading p,
.analytics-error p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.analytics-error .error-icon {
    font-size: 60px;
}

.chart-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Analytics button in header */
.analytics-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #7C2D91 0%, #5A206C 100%);
    border: 2px solid rgba(124, 45, 145, 0.5);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-btn:hover {
    background: linear-gradient(135deg, #8E3AA4 0%, #6B2680 100%);
    border-color: rgba(124, 45, 145, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 45, 145, 0.3);
}

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

.analytics-btn .icon {
    font-size: 18px;
}

/* Responsive design */
@media (max-width: 1024px) {
    .analytics-charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container.full-width {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .analytics-content {
        padding: 60px 15px 20px;
    }

    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .analytics-title {
        font-size: 24px;
    }

    .analytics-stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 20px;
    }

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

    .analytics-close-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .date-range-select {
        font-size: 13px;
        padding: 8px 12px;
    }

    .chart-title {
        font-size: 16px;
    }

    .chart-container {
        padding: 16px;
    }
}

/* Dark mode support (already dark by default) */
body.dark-mode .analytics-dashboard {
    background: rgba(0, 0, 0, 0.98);
}

/* Print styles */
@media print {
    .analytics-dashboard {
        position: relative;
        background: white;
        color: black;
    }

    .analytics-close-btn {
        display: none;
    }

    .stat-card,
    .chart-container {
        page-break-inside: avoid;
    }
}
