/* ============================================================
   DotaFlow — оптимизированный style.css
   Сохранены: фон, текстуры, hover, анимации и адаптив.
   Удалены: явные дубликаты и селекторы, которые не используются в index.html.
   Комментарии — на русском, кратко поясняют блоки.
   ============================================================ */

/* =========================
   0. Базовые глобальные стили
   - Шрифты, фон, базовые тёмные цвета
   ========================= */
html, body {
    margin: 0;
    padding: 0;
    color: #fff;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* отключаем автоматический скролл-behavior чтобы поведение было предсказуемым */
    scroll-behavior: auto !important;
}

/* Фиксированный градиентный фон (слой 1) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #000000, #320101, #4c0000);
    z-index: -2;
    pointer-events: none;
}

/* Текстура поверх градиента (слой 2) */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: url('/img/topography.svg') repeat;
    background-size: 500px 500px;
    opacity: 0.7;
    filter: invert(1);
    mix-blend-mode: overlay;
    z-index: -1;
    pointer-events: none;
}

/* Корневой контейнер приложения */
#root {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

/* helper-утилиты, которые используются в HTML */
.min-h-screen { min-height: 100vh; position: relative; z-index: 1; }
.p-1 { padding: 1rem; }
.max-w-7xl { max-width: 80rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.gap-6 { gap: 1.5rem; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-white { color: white; }
.font-bold { font-weight: bold; }

/* Уточнение для md-grid-cols-3 (вспомогательно используется через media query) */
@media (min-width: 768px) {
    .md-grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
}

/* =========================
   1. Хидер (логотип + обертки)
   - .header-container и logo
   ========================= */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.logo-img {
    width: 60px;
    height: auto;
    object-fit: contain;
}

@media (max-width: 480px) {
    .logo-img { width: 45px; }
}

/* =========================
   2. Навигация и Telegram-кнопка
   - табы, кнопка канала
   ========================= */

/* Секция навигации и кнопки каналов */
.navigation-section { margin-top: 0; margin-bottom: 1.5rem; }
.telegram-section { display: flex; justify-content: center; margin-bottom: 2.5rem; }

/* Карточка канала (Telegram) */
.channel-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 1rem;
    padding: 0.3rem 0.5rem;
    text-align: center;
    transition: all 0.24s ease;
    text-decoration: none;
    cursor: pointer;
    max-width: 12.5rem;
    width: 100%;
    height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.channel-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.03);
    box-shadow: 0 0 2rem rgba(0, 0, 0, 0.45);
}

/* Иконка канала — картинка или fallback emoji */
.channel-icon-img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.channel-icon-emoji {
    font-size: 1.2rem;
}

/* Текст в карточке канала */
.channel-text {
    font-size: 0.85rem;
    color: white;
    line-height: 1.2;
}

/* Табы (кнопки навигации) */
.tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-button {
    padding: 1rem 2rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    border: none;
    min-width: 140px;
    transition: all 0.24s ease;
    position: relative;
    color: #ddd;
    font-weight: 600;
    font-size: 0.9rem;         /* размер шрифта */
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.tab-button.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: #6e6e73;
    box-shadow: inset 0 0 1.25rem rgba(255, 255, 255, 0.06);
}

/* =========================
   3. Карточки новостей (NewsCard)
   - картинка, контент, метаданные
   ========================= */
.news-card {
    overflow: hidden;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1rem;
    box-shadow: 0 0 1.25rem rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
}

.news-card-clickable { cursor: pointer; }

.news-card:hover, .news-card-clickable:hover {
    transform: translateY(-0.5rem);
    box-shadow: 0 0 2rem rgba(74,73,73,0.36);
    background: rgba(255,255,255,0.12);
}

/* Картинка карточки */
.news-img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
    border-radius: 1rem 1rem 0 0;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Если изображение успешно загрузилось — показываем */
.news-img[src]:not([src=""]) { opacity: 1; }

/* Контент карточки */
.news-content { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.news-title {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    height: calc(1.125rem * 1.4 * 2);
    font-weight: 600;
}

/* Мета-информация (тип события, дата) */
.news-event_type {
    font-size: 0.875rem;
    color: #bbb;
    margin: 0;
    font-weight: 600;
}

.news-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #bbb;
    margin: 0;
}

.news-date-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    vertical-align: middle;
}

/* Краткое описание */
.news-summary {
    font-size: 0.9375rem;
    line-height: 1.4;
    color: #eee;
    margin-top: 0.25rem;
    flex: 1;
}

/* =========================
   4. Сетка версий (VersionsCard)
   ========================= */
.versions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.version-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.24s ease;
}

.version-card:hover {
    transform: translateY(-0.25rem);
    box-shadow: 0 0 1.5rem rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.12);
}

.version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.version-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.version-content { display: flex; flex-direction: column; gap: 0.75rem; }

.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.version-label { font-size: 0.875rem; color: #bbb; font-weight: 500; }
.version-value {
    font-size: 0.875rem;
    color: white;
    font-weight: 600;
    background: rgba(255,255,255,0.08);
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    min-width: 60px;
    text-align: center;
}

/* =========================
   5. Патчи (PatchCard)
   - виртуальные карточки, major, clickable
   ========================= */
.patches-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.patch-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    transition: all 0.24s ease;
}

.patch-card:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    cursor: pointer;
}

.patch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.patch-title {
    min-height: 3em;
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.patch-date { font-size: 0.875rem; color: #bbb; }

.patch-diff { font-size: 0.875rem; color: #ddd; }
.patch-diff-label { font-weight: 500; color: #aaa; }
.patch-diff-value { font-weight: 600; margin-left: 0.25rem; color: #fff; }

/* Виртуальные карточки (индикация — не кликабельны) */
.patch-card-virtual {
    background: rgba(255,255,255,0.06);
    border-style: dashed;
    border-color: rgba(255,255,255,0.22);
    cursor: progress;
    text-align: center;
}
.patch-card-virtual:hover { transform: none; box-shadow: none; cursor: default; }
.patch-card-virtual .patch-title { font-size: 1.2rem; color: #aaa; }
.patch-card-virtual .patch-date { color: #fff; font-size: 1.1rem; font-weight: 600; }

/* Major патч — акцент */
.patch-card-major {
    border-color: rgba(255,80,80,0.5);
    background: rgba(255,0,0,0.08);
    box-shadow: 0 0 1.25rem rgba(255,0,0,0.18);
}
.patch-card-major:hover { background: rgba(255,40,40,0.14); box-shadow: 0 0 1.5rem rgba(255,60,60,0.22); }
.patch-card-major .patch-title { color: #ff8a8a; text-shadow: 0 0 4px rgba(255,60,60,0.4); }
.patch-card-major .patch-title::before { content: "🔥 "; color: #ff4b4b; font-size: 1.2em; }

/* =========================
   6. Календарь (Calendar)
   - грид месяцев, дни, легенда, year selector
   ========================= */
.calendar-container { max-width: 1200px; margin: 0 auto; }

.calendar-year-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.year-button {
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.08);
    color: white;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.year-button:hover { background: rgba(255,255,255,0.12); transform: translateY(-2px); }
.year-button.active { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.28); box-shadow: 0 0 1rem rgba(255,255,255,0.06); }

/* Легенда (цветовые квадратики) */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 1rem;
    padding: 1rem;
    max-width: 420px;
    margin: 0 auto 2rem auto;
}

.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: #ddd; white-space: nowrap; }
.legend-color { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.18); flex-shrink: 0; }

/* Цвета легенды — новости / патчи / крупные */
.news-color { background: #30d158; }
.patch-color { background: #007aff; }
.major-color { background: #ff453a; }

/* Сетка месяцев и дни */
.calendar-months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.calendar-month {
    background: rgba(80, 31, 31, 0.75); /* фон блока месяца */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1rem;
    padding: 1.2rem;
    box-shadow: 0 0 1rem rgba(0,0,0,0.25);
}

.calendar-month-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: white;
    margin: 0 0 0.75rem 0;
    text-align: center;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-weekday {
    font-size: 0.75rem;
    font-weight: 600;
    color: #bbb;
    text-align: center;
    padding: 0.45rem 0;
    text-transform: uppercase;
}

/* Ячейки дня — квадратные, центрируем число */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: white;
    background: rgba(255,255,255,0.03);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
    border: 1px solid transparent;
}

.calendar-day:hover { background: rgba(255,255,255,0.08); transform: scale(1.05); }

.calendar-day.empty {
    background: transparent;
    border: 1px dashed rgba(255,255,255,0.06);
    cursor: default;
}
.calendar-day.empty:hover { background: transparent; transform: none; }

/* Статусы дня: новости / патч / крупное обновление */
.calendar-day.has-news { background: rgba(52,211,153,0.18); border-color: rgba(52,211,153,0.36); color: #fff; }
.calendar-day.has-patch { background: rgba(0,122,255,0.16); border-color: rgba(0,122,255,0.36); color: #fff; }
.calendar-day.has-major {
    background: rgba(255,69,58,0.26);
    border-color: rgba(255,69,58,0.6);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(255,69,58,0.22);
}
.calendar-day.has-major::after {
    content: "🔥";
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
}

/* =========================
   7. Модальное окно (Calendar day -> events)
   - overlay + контент + кнопка Close
   ========================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.28s ease;
    padding: 1rem; /* Добавляем отступы от краев экрана */
    box-sizing: border-box;
    overflow-y: auto; /* Добавляем скролл, если контент не помещается */
}

.modal-content {
    background: linear-gradient(135deg, #1a1a1a, #2a0a0a);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 1.25rem;
    padding: 0;
    max-width: 520px;
    width: 100%; /* Занимает всю доступную ширину с учетом padding */
    max-height: calc(100vh - 2rem); /* Ограничиваем по высоте с учетом отступов */
    overflow: hidden;
    animation: modalSlideIn 0.28s ease;
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    flex-shrink: 0; /* Запрещаем сжатие заголовка */
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0;
    flex: 1;
    padding-right: 1rem;
    word-break: break-word; /* Перенос длинных слов */
}

.modal-close {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: white;
    border-radius: 0.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.16s ease;
    flex-shrink: 0; /* Запрещаем сжатие кнопки */
}
.modal-close:hover { background: rgba(255,255,255,0.12); transform: scale(1.06); }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    background: rgba(0,0,0,0.02);
    flex: 1; /* Занимает все доступное пространство */
    min-height: 0; /* Важно для правильного flex-растяжения */
}

.modal-event-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 0.9rem;
    transition: all 0.12s ease;
    word-break: break-word; /* Перенос длинных слов */
}
.modal-event-item:hover { background: rgba(255,255,255,0.05); transform: translateY(-2px); }
.modal-event-item:last-child { margin-bottom: 0; }

/* Содержимое события */
.event-type-badge {
    display: inline-block;
    background: rgba(255,255,255,0.06);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ddd;
    margin-bottom: 0.6rem;
}
.event-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    margin: 0 0 0.6rem 0;
    word-break: break-word; /* Перенос длинных слов */
    line-height: 1.3;
}
.event-summary {
    font-size: 0.9rem;
    color: #bbb;
    line-height: 1.4;
    margin: 0 0 0.75rem 0;
    word-break: break-word; /* Перенос длинных слов */
}
.event-link {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    word-break: break-all; /* Разрешаем разрыв ссылок */
}
.event-link:hover { color: #ff8a8a; text-decoration: underline; }

.no-events { text-align: center; color: #888; font-style: italic; margin: 0; }

/* Адаптивность для модального окна */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0.5rem; /* Меньшие отступы на мобильных */
        align-items: flex-start; /* Выравниваем по верху на мобильных */
    }

    .modal-content {
        max-height: calc(100vh - 1rem); /* Учитываем меньшие отступы */
        margin: 0; /* Убираем margin */
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-title {
        font-size: 1.15rem;
        padding-right: 0.75rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-close {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 1.1rem;
    }

    .event-title {
        font-size: 1rem;
    }

    .event-summary {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 0.25rem; /* Минимальные отступы на маленьких экранах */
    }

    .modal-content {
        max-height: calc(100vh - 0.5rem);
        border-radius: 1rem; /* Немного меньше скругление */
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-event-item {
        padding: 0.75rem;
    }

    .event-title {
        font-size: 0.95rem;
    }

    .event-summary {
        font-size: 0.8rem;
    }

    .event-link {
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .modal-header {
        padding: 0.5rem 0.75rem;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-body {
        padding: 0.75rem;
    }

    .modal-event-item {
        padding: 0.5rem;
    }

    .event-title {
        font-size: 0.9rem;
    }

    .event-summary {
        font-size: 0.75rem;
    }
}

/* Для очень маленьких экранов - горизонтальная ориентация */
@media (max-width: 320px) and (max-height: 480px) {
    .modal-overlay {
        padding: 0.25rem;
    }

    .modal-content {
        max-height: calc(100vh - 0.5rem);
        max-width: none; /* Снимаем ограничение по ширине */
    }

    .modal-body {
        padding: 0.5rem;
    }
}
/* =========================
   8. Анимации, переходы и утилиты
   - плавное появление карточек, модалок, пульсация лоадера
   ========================= */
@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes cardAppear {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes tabSwitch {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulse {
    0%,100% { opacity: 0.7; } 50% { opacity: 1; }
}

/* Присвоение анимаций элементам */
.min-h-screen { animation: fadeInContent 0.28s ease-in-out; }
.news-card, .version-card, .patch-card, .calendar-month { animation: cardAppear 0.28s ease-in-out; }
.content-section > div { animation: tabSwitch 0.18s ease-in-out; }
.modal-overlay { animation: modalFadeIn 0.28s ease-in-out; }
.modal-content { animation: modalSlideIn 0.28s ease-in-out; }

/* Лоадер (если используется) */
.loader {
    text-align: center;
    padding: 2.5rem;
    font-size: 1.125rem;
    color: white;
    opacity: 0.85;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Плавные переходы в навигации и hover-эффекты */
.tab-button { transition: all 0.24s ease-in-out; }

/* Предотвращение мерцания изображений — см. .news-img */
.news-img { transition: opacity 0.3s ease-in-out; }

/* Чтобы заголовки не меняли высоту карточек сильно */
.news-title, .version-title, .patch-title {
    .version-title, .patch-title {
        min-height: 3em;
        display: flex;
        align-items: center;
    }

    /* А для news-title — свой, безопасный */

    .news-title {
        margin: 0;
        font-size: 1.125rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600;
    }
}

/* =========================
   9. Адаптивность (мобильные и планшетные)
   - упрощённые правила, совпадающие с поведением в index.html
   ========================= */
@media (max-width: 1024px) {
    .min-h-screen.p-1 { padding: 0.75rem; }
}

@media (max-width: 768px) {
    .header-container { flex-direction: column; align-items: flex-start; padding: 0 0.25rem; }
    .versions-grid { grid-template-columns: 1fr; }
    .version-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .version-item { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
    .version-value { align-self: flex-start; }

    .calendar-months-grid { grid-template-columns: 1fr; gap: 1rem; }
    .calendar-year-selector { flex-wrap: wrap; }
    .year-button { flex: 1; min-width: 100px; }

    .calendar-legend { flex-direction: column; gap: 1rem; align-items: center; }

    .modal-content { width: 95%; margin: 1rem; }
    .modal-header { padding: 1rem 1.5rem; }
    .modal-body { padding: 1.25rem; }
    .modal-title { font-size: 1.15rem; }

    /* Уменьшаем padding на мобилках */
    .min-h-screen.p-1 { padding: 0.5rem; }
}

@media (max-width: 480px) {
    .min-h-screen.p-1 { padding: 0.5rem; }
}

/* =========================
   10. Финальные мелочи / совместимость
   - оставляем scroll-anchor отключенным, чтобы не прыгало при навигации
   ========================= */
html { overflow-y: scroll; }
body { overflow-anchor: none; }

/* =========================
   11. Charts — график обновлений по дням недели
   ========================= */
.charts-container {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 0 1rem rgba(0, 0, 0, 0.4);
    animation: fadeInContent 0.3s ease-in-out;
    max-width: 800px;
    margin: 0 auto;
    overflow: visible; /* ИСПРАВЛЕНИЕ: Изменено с hidden на visible, чтобы tooltip не обрезался */
}

.charts-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin: 0 0 2rem 0;
}

.charts-wrapper {
    display: flex;
    gap: 1rem;
    height: 350px; /* Высота для десктопа */
    margin-bottom: 0;
    overflow: visible; /* ИСПРАВЛЕНИЕ: Изменено с hidden на visible для tooltip */
}

/* Левая шкала */
.charts-y-axis {
    position: relative;
    min-width: 40px;
    height: 100%;
}

.charts-y-axis-labels {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 0 0 0;
    box-sizing: border-box;
    pointer-events: none;
}

.charts-y-label {
    font-size: 0.875rem;
    color: #bbb;
    font-weight: 500;
    line-height: 1;
    text-align: right;
    padding-right: 5px;
    margin: 0;
}

/* Область графика */
.charts-graph-area {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
    padding-bottom: 0;
}

/* Линии сетки */
.charts-grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.charts-grid-line {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    flex: none;
    height: 0;
}

/* Столбцы */
.charts-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex: 1;
    padding: 0 0.5rem 0 0.5rem;
    gap: 0.8rem;
    height: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.charts-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    height: 100%;
    justify-content: flex-end;
    z-index: 1;
    max-width: 60px;
}

.charts-bar-container:hover {
    z-index: 10;
}

.charts-bar {
    width: 100%;
    min-width: 20px;
    max-width: 60px;
    background: linear-gradient(180deg, #ff4b4b, #7a0000);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(255, 75, 75, 0.3);
    min-height: 4px;
    flex-shrink: 0;
}

.charts-bar-empty {
    width: 100%;
    min-width: 20px;
    max-width: 60px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px 4px 0 0;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    height: 2px !important;
    flex-shrink: 0;
}

.charts-bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 75, 75, 0.5);
    filter: brightness(1.2);
}

/* Подсказка при наведении */
.charts-bar-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 9999;
    pointer-events: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-weight: 500;
    max-width: 90vw;
    overflow: hidden;
}

.charts-bar:hover .charts-bar-tooltip,
.charts-bar:active .charts-bar-tooltip,
.charts-bar:focus-within .charts-bar-tooltip { /* ИСПРАВЛЕНИЕ: Добавлен :focus-within для лучшей поддержки тача на мобильных */
    opacity: 1;
    visibility: visible;
}

.charts-bar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(20, 20, 20, 0.95);
}

/* Подписи дней — отдельный блок ниже графика */
.charts-x-axis {
    display: flex;
    justify-content: space-around; /* ИЗМЕНЕНИЕ: Вместо space-between — равномерно вокруг */
    padding: 0; /* Убираем padding, если gap мешает */
    gap: 0; /* ИЛИ убери gap, если он большой */
    margin-top: 0.5rem;
    margin-left: 40px; /* Верни базовое, или подкорректируй только для первого */
    width: 97%;
}

.charts-day {
    font-size: 0.9rem;
    color: #ddd;
    font-weight: 600;
    text-align: center;
    flex: 1;
    min-width: 0;
    max-width: 60px;
}

/* Адаптивность для графика */
@media (max-width: 768px) {
    .charts-container {
        padding: 1.5rem;
    }

    .charts-wrapper {
        height: 250px; /* Уменьшаем высоту для планшетов */
        gap: 0.5rem;
    }

    .charts-bars {
        gap: 0.3rem;
        padding: 0 0.25rem 0 0.25rem;
    }

    .charts-x-axis {
        margin-left: 33px; /* ИСПРАВЛЕНИЕ: Сдвиг вправо на 2px (было 35px) */
        width: calc(100% - 33px); /* ИСПРАВЛЕНИЕ: Корректируем ширину */
        padding: 0 0.25rem;
        gap: 0.3rem;
    }

    .charts-bar {
        min-width: 15px;
        max-width: 45px;
    }

    .charts-bar-empty {
        min-width: 15px;
        max-width: 45px;
    }

    .charts-bar-container {
        max-width: 45px;
    }

    .charts-day {
        max-width: 45px;
        font-size: 0.8rem;
    }

    .charts-y-label {
        font-size: 0.8rem;
    }

    .charts-bar-tooltip {
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
        white-space: normal;
        text-align: center;
        min-width: 100px;
        border-width: 2px;
    }
}

@media (max-width: 480px) {
    .charts-container {
        padding: 1rem;
    }

    .charts-wrapper {
        height: 200px; /* Еще меньше для телефонов */
    }

    .charts-bars {
        gap: 0.2rem;
        padding: 0 0.15rem 0 0.15rem;
    }

    .charts-x-axis {
        margin-left: 38px; /* ИСПРАВЛЕНИЕ: Сдвиг вправо на 2px (было 30px) */
        width: 90%; /* ИСПРАВЛЕНИЕ: Корректируем ширину */
    }

    .charts-bar {
        min-width: 12px;
        max-width: 35px;
    }

    .charts-bar-empty {
        min-width: 12px;
        max-width: 35px;
    }

    .charts-bar-container {
        max-width: 35px;
    }

    .charts-day {
        max-width: 35px;
        font-size: 0.75rem;
    }

    .charts-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 360px) {
    .charts-wrapper {
        height: 180px; /* Минимальная высота */
    }

    .charts-bar {
        min-width: 10px;
        max-width: 30px;
    }

    .charts-bar-empty {
        min-width: 10px;
        max-width: 30px;
    }

    .charts-bar-container {
        max-width: 30px;
    }

    .charts-day {
        max-width: 30px;
        font-size: 0.7rem;
    }

    .charts-bars {
        gap: 0.15rem;
    }

    .charts-x-axis {
        gap: 0.15rem;
    }
}

/* ИСПРАВЛЕНИЕ: Динамическое позиционирование tooltip для мобильных (теперь с мягким переопределением, без избыточных !important) */
@media (max-width: 480px) {
    .charts-bar-tooltip {
        bottom: auto; /* Позиционируем снизу */
        top: calc(100% + 12px); /* Под столбцом */
        max-width: 80vw;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        white-space: normal;
        text-align: center;
        overflow-y: auto;
        max-height: 120px;
        border-width: 2px; /* Толще граница */
    }

    .charts-bar-tooltip::after {
        top: auto;
        bottom: 100%;
        border-top-color: transparent;
        border-bottom-color: rgba(20, 20, 20, 0.95); /* Стрелка вверх */
    }

    .charts-bar-container:hover,
    .charts-bar-container:focus-within { /* ИСПРАВЛЕНИЕ: Улучшен z-index для мобильных */
        z-index: 20;
    }

    /* Дополнительно: Принудительное отображение на таче (touchstart/touchend) */
    .charts-bar:active + .charts-bar-tooltip,
    .charts-bar:focus + .charts-bar-tooltip {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Конец файла */
/*Language button styles*/
.lang-switch {
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 9999;
    background: rgba(0,0,0,0.45);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    gap: 6px;
    align-items: center;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.15);
}

.lang-option {
    cursor: pointer;
    color: #ddd;
    font-weight: 600;
    transition: 0.2s;
}

.lang-option:hover {
    color: #fff;
    transform: scale(1.05);
}

.lang-option.active {
    color: #fff;
    text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

.lang-separator {
    color: #777;
}
.tab-button .badge-new {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff3b3b;
    color: white;
    padding: 2px 6px;
    font-size: 0.65rem;
    border-radius: 8px;
    font-weight: 700;
    box-shadow: 0 0 6px rgba(255,0,0,0.6);
    animation: pulseNew 1.4s infinite ease-in-out;
}

@keyframes pulseNew {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
