.stats-container {
    position: relative;
    display: flex;
    flex-direction: column;
    /* gap: 10px; */
    height: 100%;
    overflow-y: hidden;
    scrollbar-gutter: stable;
    box-sizing: border-box;
}

.stats-container:hover {
    overflow-y: auto;
}

.stats-container::-webkit-scrollbar {
    width: 2px;
}

.stats-container::-webkit-scrollbar-track {
    background: rgba(var(--text-color), 0.1);
    border-radius: 3px;
}

.stats-container::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.ring-chart {
    transform: rotate(-90deg);
}

.comparison-text {
    color: rgba(var(--text-color), 0.7);
    font-size: 0.9em;
}

.secondary-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 10px;
}

.stat-card {
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stat-icon-bg);
    border-radius: 8px;
    transition: transform 0.3s ease;
    /* Анимация масштабирования */
}

.stat-card:hover .stat-icon {
    transform: scale(1.2);
    /* Увеличение при наведении */
}

/* Остальные стили остаются без изменений */
.stat-info {
    flex-grow: 1;
}

.stat-title {
    color: var(--secondary-text-color);
    font-size: 0.9em;
    margin-bottom: 2px;
}

.stat-value {
    color: var(--text-color);
    font-size: 1.2em;
    font-weight: 500;
}

.stat-card:hover {
    box-shadow: 0 4px 15px rgba(var(--accent-color-back), 0.3);
}

.main-stat-card {
    position: relative;
    width: 80%;
    /* max-width: 320px; */
    margin: 15px auto;
    margin-bottom: 0px;
    padding: 5px;
    border-radius: 20px;
    /* background: linear-gradient(145deg,
    rgba(var(--primary-color), 0.3),
    rgba(var(--primary-dark), 0.4)); */
    /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); */
    overflow: visible;
    /* border: 1px solid rgba(var(--accent-color), 0.1); */
}

.progress-container {
    position: relative;
    width: 100%;
    height: 170px;
    margin: 0 auto;
}

.ring-chart {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(var(--accent-color), 0.1);
    stroke-width: 8;
    stroke-linecap: round;
}

.ring-progress {
    fill: none;
    stroke: var(--success-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 597;
    stroke-dashoffset: calc(597 - (597 * 80) / 100);
    transition: stroke-dashoffset 1s ease;
}

.ring-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
}

.ring-value {
    color: #fff;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ring-title {
    color: var(--secondary-text-color);
    font-size: 14px;
    letter-spacing: 0.5px;
}

.stats-comparison {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

.comparison-badge {
    display: flex;
    align-items: center;
    background: rgba(var(--success-color), 0.15);
    padding: 2px 10px;
    margin: 10px;
    border-radius: 15px;
    border: 1px solid rgba(var(--success-color), 0.15);
}

.comparison-icon-plus {
    color: var(--success-color);
    font-size: 1.2rem;
}

.comparison-icon-minus {
    color: var(--danger-light);
    font-size: 1.2rem;
}

.comparison-value-plus {
    color: var(--success-light);
    font-weight: 400;
    font-size: 12px;
    justify-content: center;
    align-items: center;
}

.comparison-value-minus {
    color: var(--danger-light);
    font-weight: 600;
    font-size: 12px;
    justify-content: center;
    align-items: center;
}

.comparison-text {
    color: rgba(var(--text-color), 0.8);
    font-size: 0.9rem;
    /* margin-top: 8px; */
}

.metrics-tracker {
    display: flex;
    flex-direction: column;
    padding: 12px;
    margin-left: 20px;
    margin-right: 20px;
    /* background: rgba(var(--primary-color), 0.15); */
    border-radius: 1rem;
    /* backdrop-filter: blur(6px); */
    /* border: 1px solid rgba(var(--accent-color), 0.1); */
}

.metric-title {
    font-size: 12px;
    margin-left: 0.5rem;
    color: var(--secondary-text-color);
}

.metric-item {
    position: relative;
    margin: 2px;
}

.metric-bar-wrap {
    display: flex;
    align-items: center;
}

.metric-bar {
    flex-grow: 1;
    height: 1rem;
    background: rgba(var(--text-color), 0.05);
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metric-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress);
    background: linear-gradient(90deg,
            var(--success-color) 0%,
            var(--success-light) 100%);
    border-radius: 1rem;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(var(--text-color), 0.8);
    font-size: 11px;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.metric-value {
    color: var(--success-light);
    font-weight: 200;
    min-width: 1.5rem;
    text-align: right;
    font-size: 1rem;
    position: relative;
    padding-right: 0.5rem;
}

/* .metric-value::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 60%;
    background: rgba(var(--accent-color), 0.3);
} */

.ball-statistic-1 {
    width: 260px;
    height: 260px;
    background: rgba(var(--accent-color-back), 0.2);
    filter: blur(50px);
    top: 10%;
    left: 10%;
}

.show-statistic {
    position: absolute;
    /* Абсолютное позиционирование */
    top: 15px;
    /* Отступ сверху */
    right: 15px;
    /* Отступ справа */
    z-index: 100;
    /* Поверх всех элементов */
    opacity: 0;
    /* Начальная прозрачность */
    transition: opacity 0.3s ease;
    /* Плавное появление */
}

.stats-container:hover .show-statistic {
    opacity: 1;
    /* Полная видимость */
}

.show-statistic-btn {
    width: 34px;
    /* Увеличиваем размер */
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(var(--accent-color), 0.15);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(var(--accent-color), 0.4);
    color: var(--accent-color);
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.show-statistic-btn:hover {
    background: rgba(var(--accent-color), 0.25);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.statistic-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 0 15px;
}

/* Левый блок (70%) */
.statistic-left-section {
    width: 70%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.statistic-text-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

.statistic-right-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

.statistic-top-block,
.statistic-bottom-block {
    border-radius: 4px;
    /* padding: 20px; */
    transition: all 0.3s ease;
    box-sizing: border-box;
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.statistic-top-block {
    z-index: 2;
}

.statistic-bottom-block {
    transform: translateY(100%);
    z-index: 1;
}

.statistic-bottom-block.expanded {
    transform: translateY(0);
}

.statistic-top-block.collapsed {
    transform: translateY(-100%);
}

.statistic-toggle-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    margin-top: auto;
    align-self: flex-end;
    padding: 10px;
    color: white;
}

/* Правый блок (30%) */
.statistic-right-section {
    width: 30%;
    padding: 0 0 0 20px;
    box-sizing: border-box;
}

.statistic-right-content {
    border-radius: 4px;
    padding: 20px;
    height: 100%;
}

/* Стили для блока потенциала */
.statistic-right-content-header {
    font-size: 36px;
    text-align: center;
    color: var(--text-color);
    /* margin: 15px 0; */
    /* padding: 10px; */
}

.potential-description {
    text-align: justify;
    font-size: 11px;
    color: #7f8c8d;
}

/* Стили для прогнозов */
.forecast-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.forecast-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 16px;
    background: rgba(20, 20, 20, 0.7);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.forecast-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.main-forecast {
    /* background: linear-gradient(to right, #e8f5e9, #c8e6c9); */
    border-left: 4px solid var(--success-color);
}

.forecast-label {
    flex-grow: 1;
    font-size: 15px;
    font-weight: 300;
}

.main-forecast .forecast-label {
    font-weight: 300;
}

.forecast-days {
    font-size: 18px;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
    margin: 0 10px;
    color: rgb(103, 103, 103);
    font-weight: 300;
}

.main-forecast .forecast-days {
    font-size: 26px;
    color: var(--success-color);
    font-weight: 400;
}

/* Стили для иконки информации */
.info-icon {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    background-color: #b0bec5;
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.info-icon:hover {
    background-color: #78909c;
}

.tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: #37474f;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: fixed;
    /* изменено с absolute на fixed */
    z-index: 1000;
    /* увеличен z-index */
    bottom: auto;
    top: 50%;
    /* позиционируем по вертикали */
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 11px;
    font-weight: normal;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    /* чтобы не мешал взаимодействию */
}


.info-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Стили для разделителя */
.forecast-divider {
    height: 1px;
    background-color: #a6a6a6;
    margin: 10px 0;
}

/* Основные стили контейнера */
.statistic-content-habits {
    height: 54vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: transparent;
    color: white;
    position: relative;
}

/* Контейнер для скролла */
.statistic-scroll-container {
    flex-grow: 1;
    min-height: 0;
    overflow: hidden;
    scrollbar-gutter: stable;
    display: flex;
    flex-direction: column;
    padding-right: 2px;
    box-sizing: border-box;
    position: relative;
}

.statistic-scroll-container:hover {
    overflow: auto;
    padding-right: 0;
}

/* Общие стили для строк */
.statistic-header,
.statistic-row {
    display: flex;
    min-height: 50px;
    width: max-content;
    position: relative;
    align-items: center; /* Добавляем выравнивание по центру по вертикали */
}

/* Заголовок таблицы */
.statistic-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Колонка с названием привычки */
.statistic-header-habit,
.statistic-habit-name {
    width: 20vw;
    min-width: 150px;
    max-width: 200px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    position: sticky;
    font-size: 14px;
    font-weight: 500;
    left: 0;
    z-index: 5;
    height: 50px; /* Явное указание высоты */
    min-height: 50px; /* Минимальная высота */
    background: rgba(var(--secondary-color), 0.5);
    backdrop-filter: blur(5px);
    height: 100%; /* Добавляем высоту 100% */
}

.statistic-habit-name {
    width: 20vw;
    min-width: 150px;
    max-width: 200px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    position: sticky;
    font-size: 12px;
    font-weight: 300;
    left: 0;
    z-index: 5;
    height: 50px; /* Явное указание высоты */
    min-height: 50px; /* Минимальная высота */
    background: rgba(var(--secondary-color), 0.5);
    backdrop-filter: blur(5px);
    height: 100%; /* Добавляем высоту 100% */
}

/* Колонка с процентами */
.statistic-habit-percent,
.statistic-header-percent {
    width: 10vw;
    min-width: 80px;
    max-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    position: sticky;
    right: -2px;
    z-index: 5;
    font-size: 14px;
    font-weight: 500;
    height: 100%; 
    background: rgba(var(--secondary-color), 0.5);
    backdrop-filter: blur(5px);
    height: 50px; /* Явное указание высоты */
    min-height: 50px; /* Минимальная высота */
}

.statistic-habit-percent {
    width: 10vw;
    min-width: 80px;
    max-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    position: sticky;
    right: -2px;
    z-index: 5;
    font-size: 12px;
    font-weight: 300;
    height: 100%; 
    background: rgba(var(--secondary-color), 0.5);
    backdrop-filter: blur(5px);
    height: 50px; /* Явное указание высоты */
    min-height: 50px; /* Минимальная высота */
}

.statistic-header-percent {
    text-align: center; /* Добавляем на случай flex-проблем */
    margin: 0; /* Убираем возможные отступы */
}

/* Контейнер дней (скроллируемая область) */
.statistic-header-days-container,
.statistic-habit-days-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 70vw;
    position: relative;
    overflow: hidden;
    height: 100%; /* Добавляем высоту 100% */
}

/* Строка с месяцами */
.statistic-header-months {
    text-transform: capitalize;
    display: flex;
    height: 25px;
    position: relative;
    font-size: 14px;
    font-weight: 500;
    z-index: 2;
    background: rgba(var(--secondary-color), 0.5);
    backdrop-filter: blur(5px);
}

.statistic-header-month {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgb(103, 103, 103);
}

/* Контейнер дней */
.statistic-header-days {
    display: flex;
    width: max-content;
    position: relative;
    z-index: 1;
    align-items: center;
    color: var(--success-color);
    background: rgba(var(--secondary-color), 0.5);
    backdrop-filter: blur(5px);
}

/* Отдельный день */
.statistic-header-day,
.statistic-day {
    width: 28px;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
    font-size: 0.85em;
}

/* Стили для чекбоксов */
.statistic-checkbox {
    width: 23px;
    height: 23px;
    border-radius: 3px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(var(--accent-color-back), 0.1);
    border-right: 1px solid rgba(var(--accent-color-back), 0.1);
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.statistic-checkbox:hover {
    box-shadow: 0 4px 15px rgba(var(--accent-color-back), 0.5);
}

/* Скрытие нативного чекбокса */
.statistic-checkbox input {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

/* Стили для внутреннего квадрата (аналог .habit-checkbox) */
.statistic-checkbox::before {
    content: '';
    width: 21px;
    height: 21px;
    border-radius: 1px;
    background-color: #333;
    transition: background-color 0.2s;
}

/* Стили для отмеченного состояния */
.statistic-checked {
    background: var(--habit-checked-gradient);
}

.statistic-checked::before {
    background-color: var(--checkbox-checked-bg);
}

/* Тело таблицы */
.statistic-body {
    flex-grow: 1;
    position: relative;
}

/* Строки тела таблицы */
.statistic-row {
    position: relative;
    /* border-bottom: 1px solid #333; */
}

/* .statistic-row:hover {
    background: var(--success-light);
} */

/* Маскировка для скроллящегося контента */
.statistic-habit-days-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    min-width: 70vw;
    padding: 4px 0;
    position: relative;
    align-items: center; /* Выравнивание по центру по вертикали */
}

/* Стили для скроллбара */
.statistic-scroll-container::-webkit-scrollbar {
    width: 2px;
}

.statistic-scroll-container::-webkit-scrollbar:horizontal {
    height: 2px;
}

.statistic-scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.statistic-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.potential-graph-container {
    position: relative;
    width: 100%;
    height: 200px;
    margin-top: 10px;
}

.graph-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

#potentialChart {
    width: 100%;
    height: 100%;
}

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    display: none;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.potential-indicators {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 15px;
}

.potential-indicator {
    margin-top: 40px;
    flex: 1;
    /* background: #f8f9fa; */
    border-radius: 10px;
    padding: 12px 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    /* border: 1px solid #eee; */
}

.indicator-label {
    font-size: 20px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 300;
}

.indicator-value {
    font-size: 42px;
    font-weight: 500;
}

.growth-icon {
    font-size: 18px;
    vertical-align: middle;
    margin-left: 5px;
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .potential-indicators {
        flex-direction: column;
    }
    
    .indicator-value {
        font-size: 20px;
    }
}