/* ========================================= */
/*      Общие стили для всего сайта          */
/* ========================================= */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 20px;
    color: #333;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /* Ширина по умолчанию для history.html */
    max-width: 900px;
}

h1 {
    text-align: center;
    color: #1c1e21;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

h2 {
    text-align: center;
    color: #1c1e21;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 20px;
}


/* ========================================= */
/*      Стили для главной страницы (index)   */
/* ========================================= */

/* Используем id для надежного определения главной страницы */
#page-home .container {
    max-width: 900px;
}

#map-title {
    text-align: center;
    color: #1c1e21;
    font-size: 1.8em; /* Можно настроить размер */
    margin-bottom: 15px;
    border-bottom: none; /* Убираем стандартную черту под H1 */
}

#map-container {
    text-align: center;
    margin-bottom: 20px;
    line-height: 0; /* Убирает лишний отступ под картинкой */
}

#map-image {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.info-block {
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.info-block h2 {
    text-align: left;
    margin-top: 0;
    border-bottom: none;
}

.info-block ul {
    list-style-type: none;
    padding-left: 0;
}

.info-block li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    line-height: 1.5;
    gap: 8px;
}

.icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid #ccc;
    flex-shrink: 0;
    margin-top: 2px;
}

.red-circle {
    background-color: red;
    border-radius: 50%;
}

.blue-circle {
    background-color: blue;
    border-radius: 50%;
}


/* ========================================= */
/*      Стили для страницы истории (history) */
/* ========================================= */

.controls {
    text-align: center;
    margin-bottom: 30px;
}

#calendar {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    background-color: #fff;
    width: 250px;
    text-align: center;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 30px;
}

#chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 5px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
}

.legend-color-box {
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border: 1px solid #777;
}

#gallery-container {
    display: none; /* Скрыто по умолчанию */
    margin-top: 30px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

#gallery-title {
    font-size: 1.2em;
    margin-bottom: 15px;
}

/* --- Стили для двухслойной галереи --- */
#image-slider {
    position: relative;
    width: 100%;
    /* Задаем пропорции 1:1, чтобы контейнер не схлопывался */
    aspect-ratio: 1 / 1;
}

#base-map-layer {
    /* Базовая карта - это основа. */
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Вписываем, сохраняя пропорции */
    border-radius: 8px;

    /* Базовая карта лежит НАД неактивными слоями */
    position: relative;
    z-index: 1;
}

#storm-layers-container {
    /* Контейнер для слоев накладывается точно поверх базы */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#storm-layers-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    
    display: block;

    /* Неактивные слои лежат в самом низу, ПОД базовой картой */
    z-index: 0;

    transform: translateZ(0);    
}

#storm-layers-container img.active {
    /*display: block;  Показываем только активный */
    z-index: 2;
}

.loading-message {
    position: absolute;
    top: 45%;
    width: 100%;
    text-align: center;
    font-weight: bold;
    color: #555;
    font-size: 1.2em;
}

.loading-message.error {
    color: #D8000C; /* Красный для ошибок */
    background-color: #FFBABA;
    padding: 10px;
    border-radius: 5px;
}
/* --- Конец стилей для галереи --- */


#slider-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

#slider-nav button {
    padding: 8px 15px;
    font-size: 18px;
    background-color: #1877f2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#slider-nav button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#slider-nav button:hover:not(:disabled) {
    background-color: #166fe5;
}

#image-info {
    font-weight: bold;
    font-size: 16px;
    color: #555;
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#play-pause-btn {
    padding: 8px 12px;
    font-size: 14px;
    background-color: #42b72a;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    min-width: 90px;
}

#play-pause-btn:hover {
    background-color: #36a420;
}

.chart-container {
    position: relative; /* Обязательно, чтобы дочерние absolute-элементы позиционировались относительно него */
    height: 300px;
    margin-bottom: 30px;
}

.chart-indicator {
    /* --- Внешний вид стрелки --- */
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid #e74c3c; /* Ярко-красный цвет для заметности */

    /* --- Позиционирование и анимация --- */
    position: absolute;
    bottom: -15px; /* Располагаем под графиком */
    left: 0; /* Начальное положение */
    transform: translateX(-50%); /* Центрируем стрелку относительно ее 'left' */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Плавный переход */

    opacity: 0; /* По умолчанию скрыта */
    visibility: hidden;
    transition-property: left, opacity;
    transition-duration: 0.3s;
}

.chart-indicator.visible {
    opacity: 1;
    visibility: visible;
    bottom: 60px;
}


/* ========================================= */
/*    Общие стили для кнопок навигации       */
/* ========================================= */

.nav-buttons {
    text-align: center;
    margin-bottom: 20px;
}

.button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #1877f2;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.button:hover {
    background-color: #166fe5;
}


/* ========================================= */
/*      Адаптивность для мобильных           */
/* ========================================= */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 15px;
        width: auto;
        max-width: 100%;
    }
    h1 {
        font-size: 1.5em;
    }
    .info-block li {
        font-size: 0.9em;
    }
    #chart-legend {
        gap: 10px;
    }
}
