* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1a1a1a;
    display: flex;
    flex-direction: column;
}

/* ===== Шапка ===== */
#site-header {
    background: #2c1810;
    color: #f5e6d3;
    padding: 10px 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-bottom: 3px solid #8b2222;
}

#site-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #f5e6d3;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ===== Основной блок (карта + сайдбар) ===== */
#app {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ===== Карта (левая часть) ===== */
#map-container {
    flex: 0 0 65%;
    height: 100%;
    position: relative;
}

/* ===== Сайдбар (правая часть) ===== */
#sidebar {
    flex: 0 0 35%;
    height: 100%;
    background: #f8f5f0;
    overflow-y: auto;
    border-left: 2px solid #d4c5a9;
    padding: 0;
}

#sidebar-content {
    padding: 32px 28px;
    min-height: 100%;
}

/* Приветствие */
#sidebar-welcome h1 {
    font-size: 28px;
    font-weight: 700;
    color: #2c1810;
    margin-bottom: 4px;
    line-height: 1.2;
}

#sidebar-welcome h2 {
    font-size: 18px;
    font-weight: 400;
    color: #8b7355;
    margin-bottom: 24px;
}

#sidebar-welcome p {
    font-size: 15px;
    line-height: 1.7;
    color: #3d3228;
    margin-bottom: 16px;
}

#sidebar-welcome .hint {
    font-size: 14px;
    color: #a0896e;
    font-style: italic;
    border-left: 3px solid #d4c5a9;
    padding-left: 12px;
    margin-top: 24px;
}

/* Информация о заводе */
#sidebar-place.hidden {
    display: none;
}

#sidebar-place #place-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c1810;
    margin-bottom: 12px;
    line-height: 1.3;
}

#sidebar-place #place-description {
    font-size: 15px;
    line-height: 1.8;
    color: #3d3228;
    margin-bottom: 20px;
}

/* ===== Галерея ===== */
#gallery {
    animation: fadeIn 0.3s ease-in-out;
}

/* Вьювер изображения */
#gallery-viewer {
    position: relative;
    width: 100%;
    height: 280px;
    background: #e0d6c8;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

#gallery-viewer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Кнопки навигации */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(44, 24, 16, 0.6);
    color: white;
    border: none;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
    line-height: 1;
}

.gallery-nav:hover {
    background: rgba(44, 24, 16, 0.9);
}

#gallery-prev {
    left: 8px;
}

#gallery-next {
    right: 8px;
}

/* Счётчик */
#gallery-counter {
    text-align: center;
    font-size: 13px;
    color: #8b7355;
    margin-bottom: 4px;
}

/* Описание изображения */
#gallery-description {
    text-align: center;
    font-size: 14px;
    color: #3d3228;
    font-style: italic;
    margin-bottom: 12px;
    min-height: 1.4em;
}

/* Миниатюры */
#gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px solid #d4c5a9;
}

.gallery-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.7;
    transition: opacity 0.2s, border-color 0.2s;
    background: #e0d6c8;
}

.gallery-thumb:hover {
    opacity: 1;
}

.gallery-thumb.active {
    border-color: #8b2222;
    opacity: 1;
}

/* Анимация */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Подвал ===== */
#site-footer {
    background: #2c1810;
    color: #a0896e;
    padding: 12px 24px;
    flex-shrink: 0;
    text-align: center;
    font-size: 13px;
    border-top: 3px solid #8b2222;
}

#site-footer p {
    margin-bottom: 2px;
}

#site-footer .footer-data {
    font-size: 11px;
    color: #75634a;
}

/* ===== Скрытые элементы ===== */
.hidden {
    display: none !important;
}

/* Скрываем логотип Leaflet и attribution на карте (оставляем кнопки зума) */
.leaflet-control-attribution,
.leaflet-control-logo {
    display: none !important;
}

/* ===== Адаптация под планшеты и мобильные ===== */
@media (max-width: 1024px) {
    /* Фиксируем высоту app строго в рамках между header и footer */
    #app {
        flex-direction: column;
        flex: 1 1 auto;
        overflow: hidden;
    }

    #map-container {
        flex: 0 0 50vh;
        min-height: 300px;
    }

    #sidebar {
        flex: 1 1 auto;
        max-height: none;
        overflow-y: auto;
        border-left: none;
        border-top: 2px solid #d4c5a9;
    }

    #sidebar-content {
        padding: 20px 16px;
        min-height: auto;
    }

    /* Уменьшаем галерею на узких экранах */
    #gallery-viewer {
        height: 200px;
    }

    .gallery-thumb {
        width: 44px;
        height: 44px;
    }

    #sidebar-place #place-title {
        font-size: 18px;
    }

    #sidebar-welcome h1 {
        font-size: 22px;
    }

    #sidebar-welcome h2 {
        font-size: 16px;
    }
}


