/* ============================================
   КАСП ПЛЮС — Виджет филиалов v2
   Компактная версия для встраивания
   
   На ДЕСКТОПЕ: мини-карты iframe
   На МОБИЛЬНЫХ: кнопки (для предотвращения перезагрузки)
   ============================================ */

:root {
    --primary: #B32828;
    --primary-dark: #8a1f1f;
    --bg: #f5f5f5;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-gray: #666;
    --border: #e0e0e0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text);
    background: transparent;
}

/* ============================================
   ПЕРЕКЛЮЧЕНИЕ ДЕСКТОП / МОБАЙЛ
   ============================================ */

/* По умолчанию показываем десктоп версию */
.desktop-only {
    display: block !important;
}

.mobile-only {
    display: none !important;
}

/* На мобильных (<=768px) переключаем */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: flex !important;
    }
}

/* ============================================
   ВИДЖЕТ
   ============================================ */

.branches-widget {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--white);
}

/* Шапка */
.branches-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary);
}

.branches-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.branches-header .phone {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.branches-header .phone:hover {
    text-decoration: underline;
}

/* ============================================
   СЕТКА ФИЛИАЛОВ
   ============================================ */

.branches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

/* Карточка города */
.city-card {
    background: var(--bg);
    border: 1px solid var(--border);
}

.city-name {
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.city-addresses {
    padding: 10px;
}

/* Адрес */
.address-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--white);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text);
}

.address-item:hover {
    border-color: var(--primary);
    background: rgba(179, 40, 40, 0.05);
}

.address-item:hover .address-arrow {
    color: var(--primary);
    transform: translateX(3px);
}

.address-icon {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.address-info {
    flex: 1;
    min-width: 0;
}

.address-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.address-hint {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 2px;
}

.address-arrow {
    color: var(--text-gray);
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* ============================================
   БЛОК АДРЕСА
   ============================================ */

.address-block {
    margin-bottom: 12px;
}

.address-block:last-child {
    margin-bottom: 0;
}

.address-block .address-item {
    margin-bottom: 0;
}

/* ============================================
   МИНИ-КАРТА (ДЕСКТОП)
   ============================================ */

.mini-map {
    display: block;
    position: relative;
    width: 100%;
    height: 120px;
    margin-top: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
}

.mini-map iframe {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.mini-map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    transition: background 0.2s ease;
}

.mini-map:hover .mini-map-overlay {
    background: rgba(179, 40, 40, 0.1);
}

.mini-map:hover {
    border-color: var(--primary);
}

/* ============================================
   КНОПКА "ПОКАЗАТЬ НА КАРТЕ" (МОБАЙЛ)
   ============================================ */

.map-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 60px;
    margin-top: 6px;
    background: linear-gradient(135deg, #e8f4f8 0%, #d4e8eb 100%);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
}

.map-preview:hover {
    background: linear-gradient(135deg, #d4e8eb 0%, #c0dce0 100%);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(179, 40, 40, 0.15);
}

.map-preview-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.map-preview:hover .map-preview-icon {
    transform: scale(1.1);
}

.map-preview-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* ============================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ============================================ */

@media (max-width: 768px) {
    .branches-widget {
        padding: 15px;
    }
    
    .branches-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .branches-header h2 {
        font-size: 16px;
    }
    
    .branches-header .phone {
        font-size: 14px;
    }
    
    .branches-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .city-name {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .city-addresses {
        padding: 8px;
    }
    
    .address-item {
        padding: 10px;
    }
    
    .map-preview {
        height: 50px;
        font-size: 12px;
    }
    
    .map-preview-icon {
        width: 28px;
        height: 28px;
    }
    
    .map-preview-icon svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   ДЛЯ IFRAME
   ============================================ */

body.iframe-mode {
    background: transparent;
}

body.iframe-mode .branches-widget {
    padding: 10px;
}

body.iframe-mode .branches-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
}
