/* ============================================================
   ГЛОБАЛЬНЫЕ СТИЛИ
   ============================================================ */
* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: #f5f5f5;
}

/* Карта – скрываем прокрутку только для страницы карты */
body.map-page {
    overflow: hidden;
    height: 100%;
}

/* Остальные страницы (профиль) – прокрутка есть */
body:not(.map-page) {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

/* ============================================================
   КАРТА (Яндекс.Карты)
   ============================================================ */
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* СКРЫВАЕМ СТАНДАРТНЫЕ МАРКЕРЫ POI (чтобы не перекрывали наши) */
.ymaps3x0--map .ymaps3x0--features-layer .ymaps3x0--marker,
.ymaps3x0--map .ymaps3x0--features-layer .ymaps3x0--placemark,
.ymaps3x0--features-layer > * {
    display: none !important;
}

/* Наши кастомные маркеры – поверх всех */
.custom-marker {
    z-index: 1000 !important;
}

/* ============================================================
   ПОИСК АДРЕСА (фиксирован вверху)
   ============================================================ */
#search-container {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 60px;
    z-index: 100 !important;
    display: flex;
    gap: 6px;
    max-width: 600px;
}

#search-container input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#search-container input:focus {
    background: rgba(255, 255, 255, 1);
    border-color: #2196F3;
    outline: none;
}

#search-container button {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#search-container button:hover {
    background: #f0f0f0;
}

/* ============================================================
   ФИЛЬТР "ЧТО ХОТИМ?" (под поиском)
   ============================================================ */
#filter-container {
    position: fixed;
    top: 68px;
    left: 12px;
    right: 60px;
    z-index: 100 !important;
    display: flex;
    gap: 6px;
    max-width: 600px;
}

#filter-container input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#filter-container input:focus {
    background: rgba(255, 255, 255, 1);
    border-color: #9c27b0;
    outline: none;
}

#filter-container button {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #ccc;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#filter-container button:hover {
    background: #f0f0f0;
}

#filter-clear {
    padding: 10px 14px;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #f44336;
    border-radius: 10px;
    color: #f44336;
    cursor: pointer;
    font-size: 15px;
}

/* ============================================================
   КНОПКА ГЕОЛОКАЦИИ (справа от поиска)
   ============================================================ */
#locate-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

#locate-btn:hover {
    background: #f0f0f0;
}

/* ============================================================
   БЛОК КНОПОК ДЕЙСТВИЙ (профиль + создать точку)
   ============================================================ */
#action-buttons {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#profile-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ccc;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

#profile-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

#add-point-btn {
    padding: 16px 28px;
    background: linear-gradient(135deg, #4a6cf7, #6a3de8);
    color: white;
    border: none;
    border-radius: 60px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

#add-point-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 24px rgba(74, 108, 247, 0.5);
}

#add-point-btn:active {
    transform: scale(0.96);
}

/* ============================================================
   ПОПАП (кастомный для Яндекс.Карт)
   ============================================================ */
.ymap-popup-content {
    max-width: min(400px, 95vw) !important;
    min-width: 300px !important;
    padding: 0 8px !important;
    overflow: hidden !important;
    word-wrap: break-word !important;
}
.ymap-popup {
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
    overflow: hidden !important;
}
.popup-content {
    padding: 4px 0;
    max-height: 70vh;
    overflow-y: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.slide img,
.popup-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}
@media (max-width: 480px) {
    .ymap-popup-content {
        max-width: 85vw !important;
        min-width: 200px !important;
        padding: 0 4px !important;
        font-size: 14px;
    }
    .popup-content { max-height: 60vh; }
    .slide img { max-height: 150px; }
    .vote-btn { font-size: 12px; padding: 4px 10px; }
    .comment-form { display: flex; flex-direction: column; gap: 4px; }
    .comment-form input { width: 100%; font-size: 14px; padding: 6px 8px; }
    .comment-form button { width: 100%; font-size: 14px; padding: 6px 8px; }
    .popup-content h3 { font-size: 16px; margin: 0 0 4px 0; }
}

/* ============================================================
   СЛАЙДЕР ДЛЯ ГАЛЕРЕИ
   ============================================================ */
.slider-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin: 8px 0;
    background: #f5f5f5;
}
.slider-wrapper {
    display: flex;
    transition: transform 0.3s ease;
}
.slide {
    min-width: 100%;
    box-sizing: border-box;
}
.slide img {
    display: block;
    width: 100%;
    max-height: 200px;
    object-fit: cover;
}
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 50%;
    font-size: 16px;
    z-index: 10;
}
.slider-btn.prev { left: 8px; }
.slider-btn.next { right: 8px; }
.slider-btn:hover { background: rgba(0, 0, 0, 0.8); }
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 6px 0;
}
.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    border: none;
}
.slider-dot.active { background: #2196F3; }

/* ============================================================
   МАРКЕРЫ НА КАРТЕ (кастомные)
   ============================================================ */
.custom-marker {
    cursor: pointer;
    z-index: 1000 !important;
}
.user-location-marker {
    font-size: 28px;
    line-height: 1;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

/* ============================================================
   КНОПКИ ДЕЙСТВИЙ В ПОПАПЕ
   ============================================================ */
.vote-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 6px;
    font-size: 13px;
}
.vote-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.vote-btn:hover:not(:disabled) {
    background: #388E3C;
}

/* ============================================================
   СТИЛИ ДЛЯ СТРАНИЦЫ СОЗДАНИЯ ТОЧКИ (add.html)
   ============================================================ */
body.add-page {
    overflow: auto !important;
    height: auto !important;
}
.form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}
.form-container .form-group {
    margin-bottom: 16px;
}
.form-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
    color: #333;
}
.form-container select,
.form-container input,
.form-container textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}
.form-container textarea {
    min-height: 80px;
    resize: vertical;
}
.form-container .coords-info {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
    text-align: center;
}
.map-container {
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    position: relative;
}
.map-container #map-select {
    height: 100%;
    width: 100%;
}
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.map-controls button {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.map-controls button:hover {
    background: #f0f0f0;
}
.search-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 80px;
    z-index: 1000;
    display: flex;
    gap: 6px;
}
.search-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.search-bar input:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: #2196F3;
    outline: none;
}
.search-bar button {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.search-bar button:hover {
    background: #f0f0f0;
}
.btn-submit {
    width: 100%;
    padding: 14px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
}
.btn-submit:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
}
.clear-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}
.clear-btn:hover {
    color: #f44336;
}
.filename {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}
.message {
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
    font-weight: 500;
}
.file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.file-row input[type="file"] {
    flex: 1;
}
#image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
#image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
}
.category-group {
    margin-top: 8px;
    padding: 12px;
    background: #f0f4ff;
    border-radius: 8px;
    border-left: 4px solid #4a6cf7;
}
.date-group {
    margin-top: 8px;
}
.hidden {
    display: none !important;
}
#loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-size: 18px;
    color: #666;
}

/* ============================================================
   СТИЛИ ДЛЯ ПРОФИЛЯ
   ============================================================ */
body.profile-page {
    overflow-y: auto !important;
    height: auto !important;
    padding: 20px 16px 40px;
    background: #f8f9fa;
}
.profile-container {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    padding: 24px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #4a6cf7;
    text-decoration: none;
    font-weight: 500;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.avatar-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #666;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #4a6cf7;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}
.profile-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
}
.profile-field {
    margin-bottom: 24px;
}
.profile-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1a1a2e;
    font-size: 15px;
}
.profile-field .sub-label {
    font-weight: normal;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    display: block;
}
.profile-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 70px;
    background: #fafafa;
}
.profile-field textarea:focus {
    border-color: #4a6cf7;
    outline: none;
    background: white;
}
.profile-field .hint {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}
.locations-list {
    margin-top: 8px;
}
.location-item {
    background: #f5f5f5;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.location-item .loc-info {
    font-size: 14px;
    color: #333;
}
.location-item .remove-loc {
    color: #d32f2f;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    background: none;
    border: none;
}
.add-location-btn {
    background: #e8f0fe;
    color: #4a6cf7;
    border: 1px dashed #4a6cf7;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    width: 100%;
    text-align: center;
    margin-top: 4px;
    font-weight: 500;
}
.add-location-btn:hover {
    background: #dce6fa;
}
.save-profile-btn {
    width: 100%;
    padding: 14px;
    background: #4a6cf7;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
}
.save-profile-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.message {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    display: none;
}
.message.success { background: #d4edda; color: #155724; }
.message.error { background: #f8d7da; color: #721c24; }

/* Модалка для геозоны */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: white;
    padding: 24px;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content .map-container {
    height: 280px;
    border-radius: 12px;
    margin: 12px 0;
}
.modal-content .radius-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}
.modal-content .radius-control input[type="range"] {
    flex: 1;
}
.modal-content .actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}
.modal-content .actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
}
.modal-content .actions .btn-cancel { background: #e0e0e0; }
.modal-content .actions .btn-save { background: #4a6cf7; color: white; }
.modal-content input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
}
@media (max-width: 480px) {
    .profile-container { padding: 16px; }
    .profile-header { gap: 12px; }
    .avatar-wrapper { width: 60px; height: 60px; font-size: 28px; }
    .profile-title { font-size: 18px; }
    .modal-content { padding: 16px; }
}