/* =================== Responsive Styles =================== */

/* Скрываем мобильную поисковую строку на десктопе */
.mobile-search-container {
    display: none;
}

@media (max-width: 1024px) {
    /* Стили для окна аутентификации на мобильных устройствах */
    .auth-modal-content {
        width: 90%; /* Занимает почти всю ширину экрана */
        max-width: 500px; /* Но не слишком широко на планшетах */
        padding: 20px;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
    }

    .auth-modal-content h2 {
        font-size: 24px; /* Увеличиваем заголовок */
    }

    .auth-modal-content input[type="email"],
    .auth-modal-content input[type="password"] {
        padding: 15px; /* Увеличиваем поля для удобства ввода */
        font-size: 16px;
    }

    .auth-modal-content .auth-button {
        padding: 15px; /* Увеличиваем кнопку */
        font-size: 18px;
    }

    /* Убираем отступы и задаём размеры для body и html */
    html, body {
        margin: 0;
        padding: 0;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
    }

    /* Увеличиваем размер search-container для мобильных */
    .search-container {
        position: fixed;
        top: 0;
        left: 50px; /* Отступ от бургера */
        right: 50px; /* Отступ от кнопки геолокации */
        height: 50px;
        z-index: 1001;
        display: flex;
        align-items: center;
        padding: 0 10px;
        box-sizing: border-box;
        background-color: rgba(255, 255, 255, 0.95);
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    /* Увеличиваем поле ввода */
    .search-container input[type="text"] {
        flex: 1;
        height: 36px;
        font-size: 16px;
        padding: 8px 12px;
        color: #000000;
        background-color: rgb(255, 255, 255);
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        box-sizing: border-box;
    }
    
    /* Увеличиваем кнопку поиска */
    .search-container button {
        margin-left: 8px;
        width: 36px;
        height: 36px;
        background-color: #3498db;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .search-container button:hover {
        background-color: #2980b9;
    }
    
    /* Подсказки поиска для мобильных */
    .search-suggestions {
        position: absolute;
        top: 100%;
        left: 10px;
        right: 10px;
        background-color: white;
        border: 1px solid #ccc;
        border-top: none;
        max-height: 150px;
        overflow-y: auto;
        z-index: 1002;
        border-radius: 0 0 4px 4px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .search-suggestions div {
        padding: 12px;
        cursor: pointer;
        font-size: 16px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .search-suggestions div:hover {
        background-color: #f8f9fa;
    }

    /* Скрываем блок ошибок или делаем его более компактным */
    .error-message {
        display: none;
    }

    /* Увеличиваем подсказки поиска */
    .search-suggestions div {
        padding: 0px;       /* Увеличиваем отступы в подсказках */
        font-size: 16px;     /* Увеличиваем размер шрифта */
    }
    
    /* Показываем поисковую строку на мобильных */
    .search-container {
        display: flex !important;
    }
    
    /* Показываем мобильную поисковую строку */
    .mobile-search-container {
        display: flex !important;
    }
    
    /* Скрываем оригинальную поисковую строку на мобильных */
    .search-container {
        display: none !important;
    }
    
    /* Мобильная поисковая строка */
    .mobile-search-container {
        position: fixed;
        top: 0;
        left: 50px; /* Отступ от бургера */
        right: 50px; /* Отступ от кнопки геолокации */
        height: 50px;
        z-index: 1001;
        display: flex;
        align-items: center;
        padding: 0 10px;
        box-sizing: border-box;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-search-container input[type="text"] {
        flex: 1;
        height: 36px;
        font-size: 16px;
        padding: 8px 12px;
        color: #000000;
        background-color: rgb(255, 255, 255);
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        box-sizing: border-box;
    }
    
    .mobile-search-container button {
        display: none !important;
    }
    
    .mobile-search-container button:hover {
        background-color: #2980b9;
    }
    
    .mobile-search-suggestions {
        position: absolute;
        top: 100%;
        left: 10px;
        right: 10px;
        background-color: white;
        border: 1px solid #ccc;
        border-top: none;
        max-height: 150px;
        overflow-y: auto;
        z-index: 1002;
        border-radius: 0 0 4px 4px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
        display: none;
    }
    
    .mobile-search-suggestions div {
        padding: 12px;
        cursor: pointer;
        font-size: 16px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mobile-search-suggestions div:hover {
        background-color: #f8f9fa;
    }
    
    #controlsMenu, .controls {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 0px;
        display: flex;
        align-items: center;
        background-color: rgba(255, 255, 255, 0); /* полупрозрачный фон */
        box-sizing: border-box;
    }

    .geojson-controls {
        display: none !important;
    }

    #beforeLayerControls {
        left: 55px; /* Сдвигаем вправо на мобильных */
    }

    #afterLayerControls {
        right: 55px; /* Сдвигаем влево на мобильных */
    }

    /* Контейнер для сравнения */
    .compare-container {
        width: 100%;
        height: 50vh;
        top: 50%;
        border-radius: 0;
        border: none;
        box-shadow: none;
        margin: 0;
        padding: 0;
        position: absolute;
    }

    /* Элементы управления */
    .controls {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 15;
        background-color: rgba(255, 255, 255, 0.9);
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        width: 310px;
        transition: max-height 0.3s ease, opacity 0.3s ease;
        overflow: hidden;
        max-height: 1000px;
        opacity: 1;
    }

    .controls input[type="text"], .controls button {
        font-size: 14px;
    }

    /* Меню слоев сравнения на мобильных устройствах */
    .compare-layer-controls {
        width: 180px;
        padding: 8px;
        top: 10px; /* Обновили позицию */
    }

    .compare-menu-toggle {
        width: 35px; /* Вернули к исходному */
        height: 35px; /* Вернули к исходному */
        top: 8px;
    }

    .compare-layer-item label {
        font-size: 14px;
    }

    #checkboxContainer input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 10px;
        cursor: pointer;
        z-index: 1020;
    }

    /* Кнопка "Мое местоположение" */
    .my-location-button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        background-color: #fff;
        border: 2px solid #ccc;
        border-radius: 50%;
        cursor: pointer;
        position: absolute;
        top: 27px; /* Отступ от верхнего края */
        right: 8px; /* Отступ от правого края */
        z-index: 2016;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        transition: background-color 0.3s, border-color 0.3s;
    }

    /* Ползунок времени */
    #timeSliderContainer {
        width: 50%;
        padding: 10px;
        bottom: 80px;
    }

    #timeSlider {
        width: 80%;
    }

    #leftLabel, #rightLabel {
        font-size: 10px;
    }

    /* Спиннер */
    #globalSpinner {
        width: 50px;
        height: 50px;
        border-width: 8px;
    }

    /* Бургер-меню для основных настроек */
    .menu-toggle-label {
        display: flex !important; /* Показывать на мобильных устройствах */
        z-index: 1010;
        top: 10px; /* Отступ от верхнего края */
        left: 10px; /* Отступ от правого края */
        position: fixed !important;
        visibility: visible !important;
        opacity: 1 !important;
        /* Принудительно показываем на всех браузерах */
        padding: 8px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
        width: 30px !important;
        height: 25px !important;
        cursor: pointer !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    /* Контейнер чекбоксов при открытом меню */
    .menu-toggle-checkbox:checked ~ #checkboxContainer {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
        left: 50px;
        z-index: 2010;
    }

    #checkboxContainer {
        transform: translateX(-110%);
        opacity: 0;
        left: 50px;
        pointer-events: none;
        padding-left: 20px;
    }

    #checkboxContainer label {
        font-size: 18px;
        display: flex;
        align-items: center;
    }

    /* Корректируем стиль для самого крестика */
    .menu-toggle-checkbox:checked + .menu-toggle-label span:nth-child(1),
    .menu-toggle-checkbox:checked + .menu-toggle-label span:nth-child(3) {
        background-color: #fbf6f6; /* Делаем темнее для лучшей видимости */
    }

    /* Стили для полосок бургер-меню */
    .menu-toggle-label span {
        display: block !important;
        width: 100% !important;
        height: 3px !important;
        background-color: #333 !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }

    /* Мобильное меню с кнопкой выхода */
    .mobile-menu-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(139, 195, 74, 0.9));
        z-index: 2000;
        display: none;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(10px);
    }

    /* Убираем CSS зависимость от :checked, теперь управляем через JavaScript */
    /* .menu-toggle-checkbox:checked ~ .mobile-menu-container {
        display: flex;
    } */

    .mobile-menu-content {
        background: #fff;
        border-radius: 20px;
        padding: 30px;
        width: 95%;
        max-width: 450px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
        max-height: 85vh;
        overflow-y: auto;
        position: relative;
    }

    .mobile-close-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(76, 175, 80, 0.1);
        border: 2px solid rgba(76, 175, 80, 0.3);
        color: #4CAF50;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        font-size: 16px;
    }

    .mobile-close-btn:hover {
        background: rgba(76, 175, 80, 0.2);
        border-color: rgba(76, 175, 80, 0.5);
        transform: scale(1.1);
    }

    .mobile-menu-section {
        margin-bottom: 25px;
        padding-bottom: 20px;
        border-bottom: 1px solid #f0f0f0;
    }

    .mobile-menu-section:last-of-type {
        border-bottom: none;
        margin-bottom: 0;
    }

    .mobile-menu-section h4 {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0 0 15px 0;
        color: #333;
        font-size: 18px;
        font-weight: 600;
    }

    .mobile-menu-section h4 i {
        color: #4CAF50;
        font-size: 16px;
    }

    .mobile-checkbox-item {
        display: flex;
        align-items: center;
        margin-bottom: 12px;
        cursor: pointer;
        position: relative;
        padding: 8px 0;
    }

    .mobile-checkbox-item.sub-item {
        margin-left: 25px;
        margin-bottom: 8px;
    }

    .mobile-checkbox-item input[type="checkbox"] {
        display: none;
    }

    .checkmark {
        width: 22px;
        height: 22px;
        border: 2px solid #ddd;
        border-radius: 6px;
        margin-right: 12px;
        position: relative;
        transition: all 0.3s ease;
        background: #fff;
    }

    .mobile-checkbox-item input[type="checkbox"]:checked + .checkmark {
        background: #4CAF50;
        border-color: #4CAF50;
    }

    .mobile-checkbox-item input[type="checkbox"]:checked + .checkmark::after {
        content: '✓';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #fff;
        font-size: 14px;
        font-weight: bold;
    }

    .label-text {
        color: #333;
        font-size: 16px;
        font-weight: 500;
    }

    .mobile-weather-layers {
        margin-top: 10px;
        padding-left: 15px;
        border-left: 2px solid #e0e0e0;
    }

    .mobile-menu-actions {
        margin-top: 25px;
        padding-top: 20px;
        border-top: 1px solid #f0f0f0;
    }

    .mobile-user-info {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 15px;
        background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(139, 195, 74, 0.1));
        border: 1px solid rgba(76, 175, 80, 0.3);
        border-radius: 12px;
        margin-bottom: 15px;
    }

    .mobile-user-info i {
        color: #4CAF50;
        font-size: 18px;
    }

    .mobile-user-info span {
        color: #333;
        font-size: 16px;
        font-weight: 500;
    }

    /* Модальное окно авторизации - используем существующее */
    .modal-overlay {
        z-index: 3000; /* Увеличиваем z-index для мобильной версии */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(0, 0, 0, 0.5) !important;
    }

    .modal-content {
        width: 90% !important;
        max-width: 500px !important;
        margin: 0 !important;
        transform: none !important;
    }

    .mobile-logout-btn {
        background: linear-gradient(135deg, #4CAF50, #45a049);
        color: white;
        border: none;
        padding: 18px 25px;
        border-radius: 15px;
        font-size: 18px;
        font-weight: 600;
        cursor: pointer;
        width: 100%;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
        margin-top: 10px;
    }

    .mobile-logout-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
        background: linear-gradient(135deg, #45a049, #4CAF50);
    }

    .mobile-logout-btn i {
        font-size: 18px;
    }

    .mobile-debug-btn {
        background: #6c757d !important;
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        width: 100%;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-top: 10px;
    }

    .mobile-debug-btn:hover {
        background: #5a6268 !important;
        transform: translateY(-1px);
    }

    /* Сообщения */
    .mobile-message {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%) translateY(-100px);
        background: #fff;
        color: #333;
        padding: 15px 25px;
        border-radius: 25px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        font-size: 16px;
        font-weight: 500;
        z-index: 3000;
        transition: all 0.3s ease;
        opacity: 0;
    }

    .mobile-message.show {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    .mobile-message-success {
        background: #d4edda;
        color: #155724;
        border-left: 4px solid #4CAF50;
    }

    .mobile-message-error {
        background: #f8d7da;
        color: #721c24;
        border-left: 4px solid #dc3545;
    }

    .mobile-message-info {
        background: #d1ecf1;
        color: #0c5460;
        border-left: 4px solid #17a2b8;
    }
} 