/* Статистика — дизайн как в MyClient24 */

#statistics .stats-controls {
    margin: 25px 0 35px;
    max-width: 100%;
    min-width: 0;
}

#statistics .period-switcher {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 6px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

body.dark-theme #statistics .period-switcher {
    background: linear-gradient(135deg, rgba(20, 25, 40, 0.7) 0%, rgba(15, 20, 35, 0.8) 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#statistics .period-switcher .p-btn {
    flex-shrink: 0;
    padding: 12px 24px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    min-width: 90px;
    text-align: center;
}

body.dark-theme #statistics .period-switcher .p-btn {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#statistics .period-switcher .p-btn.active {
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 20px var(--primary-glow);
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

body.dark-theme #statistics .period-switcher .p-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(168, 85, 247, 0.2) 100%);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#statistics .period-switcher .p-btn:not(.active):hover {
    background: var(--glass-bg-hover);
    color: var(--text-main);
    border-color: var(--glass-border);
    transform: translateY(-1px);
}

#statistics .chart-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
}

body.dark-theme #statistics .chart-container {
    background: linear-gradient(135deg, rgba(20, 25, 40, 0.85) 0%, rgba(15, 20, 35, 0.9) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

body.dark-theme #statistics .chart-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3), rgba(14, 165, 233, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

body.dark-theme #statistics .chart-container:hover::before {
    opacity: 1;
}

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

#statistics .chart-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    font-family: var(--font-head);
    margin: 0;
}

#statistics .chart-period {
    font-family: var(--font-code);
    color: var(--accent);
    font-size: 0.85rem;
    padding: 8px 16px;
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 20px;
    background: rgba(168, 85, 247, 0.1);
}

#statistics .chart-area {
    height: 300px;
    position: relative;
    margin: 20px 0;
}

#statistics .chart-area canvas {
    width: 100% !important;
    height: 100% !important;
}

#statistics .chart-legend {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

#statistics .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
}

body.dark-theme #statistics .legend-item {
    background: rgba(255, 255, 255, 0.05);
}

#statistics .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    #statistics .stats-controls {
        margin: 16px 0 24px;
    }
    #statistics .period-switcher {
        display: flex;
        width: 100%;
        padding: 4px;
        gap: 3px;
    }
    #statistics .period-switcher .p-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 8px 4px;
        font-size: 0.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #statistics .period-switcher .p-btn.active {
        transform: none;
    }
}
