/* Основной контейнер */
.map-wrapper { display: flex; flex-direction: column; gap: 15px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; width: 100%; margin-bottom: 20px; position: relative; }

/* Сайдбар */
.map-sidebar { width: 100%; background: #fff; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); display: flex; flex-direction: column; overflow: hidden; border: 1px solid #eaeaea; max-height: 400px; }
.map-search-wrap { position: relative; border-bottom: 1px solid #eee; }
.map-search-wrap::before { content: '🔍'; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: 0.5; }
.map-search { width: 100%; padding: 14px 15px 14px 40px; border: none; font-size: 14px; outline: none; box-sizing: border-box; background: transparent; }

.map-stock-filter { width: 100%; padding: 12px 15px; border: none; border-bottom: 1px solid #eee; font-size: 13px; font-weight: bold; color: #333; outline: none; background: #fafafa; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 15px top 50%; background-size: 10px auto; }

.map-sort-btn { width: 100%; padding: 12px 15px; background: #fff; border: none; border-bottom: 1px solid #eee; cursor: pointer; font-size: 13px; font-weight: bold; color: #6a1b9a; text-align: left; transition: background .15s; outline: none; display: flex; align-items: center; gap: 8px; }
.map-sort-btn:hover:not(:disabled) { background: #fafafa; }
.map-sort-btn.active { background: #f3e5f5; }

/* Список объектов */
.map-list { flex: 1; overflow-y: auto; padding: 0; margin: 0; list-style: none; }
.map-list-item { padding: 12px 15px; border-bottom: 1px solid #f5f5f5; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: background .15s; }
.map-list-item:hover { background: #fafafa; }
.map-list-item-active { background: #e8f5e9; box-shadow: inset 4px 0 0 #2e7d32; }
.map-list-item img { width: 45px; height: 45px; border-radius: 8px; object-fit: cover; flex-shrink: 0; border: 1px solid #eee; }
.map-list-item-title { font-weight: 600; font-size: 14px; color: #222; margin-bottom: 3px; line-height: 1.3; }
.map-list-item-desc { font-size: 12px; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.map-list-item-distance { font-size: 11px; color: #6a1b9a; font-weight: bold; margin-top: 3px; }

/* Бейджи */
.stock-badge { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 6px; color: #fff; font-weight: bold; margin-left: 6px; vertical-align: middle; }
.bloom-list-badge { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 6px; background: #fce4ec; color: #ad1457; font-weight: bold; margin-left: 6px; vertical-align: middle; border: 1px solid #f8bbd0; }
.peak-list-badge { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 6px; background: #ff6f00; color: #fff; font-weight: bold; margin-left: 6px; vertical-align: middle; animation: pulse 2s infinite; }

/* Правая колонка (карта + фильтры) */
.map-right-col { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }

/* Фильтры (Чипсы) */
.map-controls { display: flex; flex-direction: row; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.map-controls::-webkit-scrollbar { display: none; }

.map-control-btn { flex-shrink: 0; background: #fff; border: 1px solid #e0e0e0; padding: 8px 16px; border-radius: 30px; cursor: pointer; font-size: 13px; font-weight: 600; box-shadow: 0 2px 5px rgba(0,0,0,0.04); transition: all 0.2s ease; color: #444; display: flex; align-items: center; gap: 6px; }
.map-control-btn:hover { background: #f9f9f9; border-color: #ccc; }
.map-control-btn.active { background: #2e7d32; border-color: #2e7d32; color: #fff; box-shadow: 0 4px 10px rgba(46,125,50,0.3); }

.map-bloom-btn { color: #ad1457; border-color: #f8bbd0; }
.map-bloom-btn:hover { background: #fce4ec; }
.map-bloom-btn.active { background: #ad1457; border-color: #ad1457; color: #fff; box-shadow: 0 4px 10px rgba(173,20,87,0.3); }

/* Карта */
.map-container { width: 100%; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.08); position: relative; background: #f8f4f0; border: 1px solid #eaeaea; }

/* Десктоп */
@media (min-width: 900px) {
    .map-wrapper { flex-direction: row; align-items: flex-start; }
    .map-sidebar { width: 340px; max-height: 540px; flex-shrink: 0; }
    .map-right-col { position: relative; }
    .map-controls { position: absolute; top: 15px; left: 15px; z-index: 1000; flex-direction: column; align-items: flex-start; max-width: 250px; padding-bottom: 0; background: transparent; overflow: visible; }
    .map-control-btn { width: 100%; justify-content: flex-start; background: rgba(255,255,255,0.95); backdrop-filter: blur(5px); }
}

/* Мобильная версия */
@media (max-width: 768px) {
    .map-controls {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        top: 5px; left: 5px; right: 5px;
        max-width: calc(100% - 10px);
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    .map-controls::-webkit-scrollbar { display: none; }
    .map-control-btn { flex-shrink: 0; }
}

/* Стили попапа */
.maplibregl-popup-content { max-height: 60vh; overflow-y: auto; padding: 15px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.maplibregl-popup-close-button { font-size: 24px !important; color: #333 !important; top: 8px !important; right: 8px !important; font-weight: bold; background: transparent !important; z-index: 10; }
.maplibregl-popup-close-button:hover { color: #e74c3c !important; }

.map-warning-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: #c62828; color: #fff; border-radius: 50%; font-size: 11px; font-weight: bold; margin-left: 6px; cursor: help; vertical-align: middle; }

.popup-btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.popup-btn { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px; border-radius: 6px; text-decoration: none; font-weight: bold; font-size: 12px; border: none; cursor: pointer; box-sizing: border-box; transition: 0.2s; text-align: center;}
.popup-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.popup-btn-route { background: #2e7d32; color: #fff; }
.popup-btn-call { background: #1976d2; color: #fff; }
.popup-btn-catalog { background: #f57c00; color: #fff; grid-column: span 2; }
.popup-btn-qr { background: #455a64; color: #fff; }
.popup-btn-share { background: #f5f5f5; color: #333; border: 1px solid #ddd; }

.popup-stock { padding: 6px; border-radius: 6px; text-align: center; font-weight: bold; margin-bottom: 10px; font-size: 13px; color: #fff; }
.popup-bloom-now { background: #fce4ec; color: #ad1457; padding: 6px; text-align: center; font-weight: bold; font-size: 13px; border-radius: 6px; margin-bottom: 10px; border: 1px solid #f8bbd0; }
.popup-address { font-size: 12px; color: #555; margin-bottom: 10px; background: #f0f0f0; padding: 6px 10px; border-radius: 6px; display:inline-block; }

.popup-assortment { background: #f0f8ff; border-left: 3px solid #1976d2; padding: 8px; font-size: 12px; margin-bottom: 10px; border-radius: 4px; color: #333; max-height: 150px; overflow-y: auto; }
.popup-assortment .as-item { display: flex; justify-content: space-between; border-bottom: 1px solid #e0e0e0; padding: 4px 0; }
.popup-assortment .as-item:last-child { border-bottom: none; }
.popup-assortment .as-badge { font-size: 10px; padding: 1px 4px; border-radius: 3px; color: #fff; margin-right: 5px; }

.popup-before-after { display: flex; gap: 5px; margin-bottom: 10px; }
.popup-before-after div { flex: 1; position: relative; }
.popup-before-after img { width: 100%; height: 80px; object-fit: cover; border-radius: 4px; }
.popup-before-after span { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 10px; text-align: center; padding: 2px; border-radius: 0 0 4px 4px; }

.popup-gallery { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 5px; }
.popup-gallery img { height: 60px; border-radius: 4px; cursor: zoom-in; object-fit: cover; }

.work-status { display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 10px; margin-bottom: 5px; color: #fff; font-weight: bold; }
.status-open { background: #2e7d32; }
.status-closed { background: #c62828; }

.promo-badge { background: #ffebee; color: #c62828; border: 1px dashed #c62828; padding: 6px; text-align: center; font-weight: bold; font-size: 13px; border-radius: 4px; margin-bottom: 10px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

.max-float-btn { position: absolute; bottom: 30px; right: 20px; background-color: #0077ff; color: white; border-radius: 50px; padding: 10px 18px; text-align: center; font-size: 14px; font-weight: bold; box-shadow: 0 4px 15px rgba(0,119,255,0.4); z-index: 1000; text-decoration: none; display: flex; align-items: center; gap: 8px; transition: transform 0.2s; }
.max-float-btn:hover { transform: scale(1.05); color: white; }
.max-float-btn svg { width: 20px; height: 20px; fill: currentColor; }
@media (max-width: 600px) { .max-float-btn { padding: 8px 14px; font-size: 13px; bottom: 15px; right: 15px; } }

.custom-marker { width: 40px; height: 40px; background-size: contain; background-repeat: no-repeat; cursor: pointer; transform: translateZ(0); }
.promo-marker { position: relative; }
.promo-marker::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid #c62828; animation: promo-ring 2s ease-out infinite; pointer-events: none; }
@keyframes promo-ring { 0% { transform: scale(0.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }

.qr-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: none; align-items: center; justify-content: center; z-index: 99999; cursor: pointer; }
.qr-overlay img { background: #fff; padding: 10px; border-radius: 8px; max-width: 200px; }