/* ===== СТИЛИ ДЛЯ ТЕПЛОВОЙ КАРТЫ ===== */

/* Контейнер тепловой карты */
.heatmap-container {
    width: 100%;
    overflow-x: auto;
    padding: 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* Стили для выбора года */
.year-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.year-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

.year-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.year-button.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    font-weight: 600;
}

.year-label-large {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 0.5rem;
}

.years-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Статистика по годам */
.year-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.year-stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.year-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.year-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Основные стили для тепловой карты */
.heatmap-wrapper {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin-bottom: 2rem;
    align-items: flex-start;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: auto;
}

.heatmap-days-column {
    width: 40px;
    min-width: 40px;
    margin-right: 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.heatmap-days-spacer {
    height: 30px;
    margin-bottom: 5px;
}

.heatmap-day-label {
    height: 14px;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    letter-spacing: 0.2px;
}

.heatmap-day-label.sunday {
    font-weight: 600;
    color: var(--accent-orange);
}

.heatmap-main-area {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 50px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.heatmap-month-labels {
    display: flex;
    height: 30px;
    margin-bottom: 5px;
    align-items: center;
    position: relative;
    width: 100%;
    justify-content: center;
}

.heatmap-month-label {
    padding-left: 4px;
    text-align: left;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.heatmap-month-label::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 4px;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

/* Сетка тепловой карты */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(53, 14px);
    grid-auto-rows: 14px;
    gap: 4px;
    width: fit-content;
    min-width: 954px; /* 53 * 14px + 52 * 4px */
    position: relative;
}

/* Квадратики дней */
.heatmap-day {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

/* Уровни активности */
.heatmap-day.level-0 { 
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.heatmap-day.level-1 { background: rgba(59, 130, 246, 0.2); }
.heatmap-day.level-2 { background: rgba(59, 130, 246, 0.4); }
.heatmap-day.level-3 { background: rgba(59, 130, 246, 0.6); }
.heatmap-day.level-4 { background: rgba(59, 130, 246, 0.8); }
.heatmap-day.level-5 { background: var(--accent-blue); }

/* Особые состояния */
.heatmap-day.future-day {
    opacity: 0.25;
    cursor: not-allowed;
}

.heatmap-day.out-of-year {
    opacity: 0.2;
    cursor: default;
}

.heatmap-day.today {
    outline: 2px solid var(--accent-orange);
    outline-offset: -2px;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    transform: scale(1.05);
    z-index: 2;
}

/* Эффект при наведении */
.heatmap-day:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* Легенда */
.heatmap-legend {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.heatmap-legend-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.legend-activity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.legend-activity-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.legend-levels {
    display: flex;
    gap: 4px;
    align-items: center;
}

.legend-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.legend-level-square {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}

.legend-level-text {
    font-size: 10px;
    color: var(--text-muted);
}

.legend-special {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-square {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-year {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-sm);
}

/* Статистика под тепловой картой */
.heatmap-stats {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.05);
    border-radius: var(--radius-md);
}

.heatmap-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.heatmap-stat-item {
    text-align: center;
}

.heatmap-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.heatmap-stat-value.green {
    color: var(--accent-green);
}

.heatmap-stat-value.orange {
    color: var(--accent-orange);
}

.heatmap-stat-value.purple {
    color: var(--accent-purple);
}

.heatmap-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.heatmap-highlight {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--radius-sm);
}

/* Подсказка (tooltip) */
#heatmap-tooltip {
    position: fixed;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    pointer-events: none;
    max-width: 280px;
    transform: translate(-50%, -100%);
    white-space: nowrap;
    backdrop-filter: blur(10px);
    border-left: 3px solid var(--accent-blue);
    animation: tooltipFadeIn 0.15s ease;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .heatmap-container {
        padding: 0.75rem;
        margin: 1.5rem 0;
    }
    
    .heatmap-grid {
        min-width: auto;
        grid-template-columns: repeat(auto-fit, 14px);
    }
}

@media (max-width: 768px) {
    .heatmap-container {
        padding: 0.5rem;
        margin: 1rem 0;
        font-size: 0.9rem;
    }
    
    .heatmap-day {
        width: 12px;
        height: 12px;
        border-radius: 1px;
    }
    
    .heatmap-grid {
        grid-template-columns: repeat(auto-fit, 12px);
        gap: 3px;
    }
    
    .heatmap-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .heatmap-legend-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .legend-activity,
    .legend-special {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .heatmap-day {
        width: 10px;
        height: 10px;
    }
    
    .heatmap-grid {
        grid-template-columns: repeat(auto-fit, 10px);
        gap: 2px;
    }
    
    .heatmap-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .heatmap-stat-value {
        font-size: 1.5rem;
    }
}