/* ============================================================
   ADDRESS MAP MODAL - Объединённые стили
   ============================================================ */

/* ========== ОСНОВНЫЕ СТИЛИ МОДАЛЬНОГО ОКНА ========== */
.address-map-modal .modal-dialog {
    max-width: 900px;
    margin: 1.75rem auto;
}

.address-map-modal .modal-content {
    border-radius: 12px;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.address-map-modal .modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

.address-map-modal .modal-body {
    padding: 0;
    height: 600px;
}

/* ========== СТИЛИ ДЛЯ КОЛОНОК ========== */
.address-map-columns {
    display: flex;
    height: 100%;
}

.address-search-column {
    width: 350px;
    background: #f8fafc;
    padding: 1.5rem;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.address-map-column {
    flex: 1;
    position: relative;
}

/* ========== СТИЛИ ДЛЯ ПОИСКА ========== */
.address-search-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.address-search-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.address-search-input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    width: 100%;
    transition: border-color 0.2s;
}

.address-search-input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.address-search-button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    border: none;
    background: #3b82f6;
    color: white;
    border-radius: 0 8px 8px 0;
    padding: 0 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.address-search-button:hover {
    background: #2563eb;
}

/* ========== ВЫПАДАЮЩИЙ СПИСОК ПОДСКАЗОК ========== */
.address-suggestions-dropdown {
    position: absolute;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    margin-top: 0.25rem;
    display: none;
}

.address-suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
}

.address-suggestion-item:last-child {
    border-bottom: none;
}

.address-suggestion-item:hover {
    background-color: #f8fafc;
}

/* ========== ПОЛЯ ФОРМЫ ========== */
.address-form-group {
    margin-bottom: 1.5rem;
}

.address-form-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.address-form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    margin-bottom: 0.75rem;
}

.address-form-input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.address-form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* ========== КНОПКИ ========== */
.address-action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.address-primary-button {
    background: #3b82f6;
    color: white;
    border: none;
}

.address-primary-button:hover {
    background: #2563eb;
}

.address-outline-button {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #3b82f6;
}

.address-outline-button:hover {
    background: #f8fafc;
}

/* ========== КАРТА ========== */
#yandexMap {
    height: 100%;
    width: 100%;
}

.current-location-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.current-location-button:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.current-location-button i {
    margin-right: 0.25rem;
}

/* ========== СТИЛИ КАРТОЧЕК СЛУЖБ ДОСТАВКИ ========== */
.delivery-providers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.delivery-provider-card {
    display: block;
    cursor: pointer;
    position: relative;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.delivery-provider-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.delivery-provider-card .provider-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.delivery-provider-card:hover .provider-content {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.delivery-provider-card input[type="radio"]:checked + .provider-content {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.provider-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.provider-icon svg {
    width: 22px;
    height: 22px;
}

.provider-icon-pochta {
    background: linear-gradient(135deg, #0066CC 0%, #004499 100%);
    color: white;
    box-shadow: 0 3px 8px rgba(0, 102, 204, 0.35);
}

.provider-icon-cdek {
    background: linear-gradient(135deg, #00B33C 0%, #009630 100%);
    color: white;
    box-shadow: 0 3px 8px rgba(0, 179, 60, 0.35);
}

.provider-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.provider-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.provider-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.2;
}

.provider-check {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

.provider-check svg {
    width: 16px;
    height: 16px;
    color: white;
}

.delivery-provider-card input[type="radio"]:checked + .provider-content .provider-check {
    opacity: 1;
    transform: scale(1);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

/* ========== ПЛАВАЮЩИЕ ИКОНКИ НА КАРТЕ ========== */
.map-delivery-icons {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 9999 !important;
    display: none !important;
    flex-direction: row;
    gap: 8px;
    pointer-events: auto;
}

.map-delivery-icons.visible {
    display: flex !important;
}

.map-delivery-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 3px solid transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
}

.map-delivery-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.map-delivery-icon.active {
    border-color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.map-delivery-icon.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
}

.map-delivery-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.map-icon-pochta,
.map-icon-cdek {
    background: #e5e7eb;
    opacity: 0.5;
    filter: grayscale(100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.map-icon-pochta:hover,
.map-icon-cdek:hover {
    opacity: 0.7;
    filter: grayscale(70%);
}

.map-icon-pochta.active,
.map-icon-cdek.active {
    background: #ffffff;
    opacity: 1;
    filter: grayscale(0%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.map-delivery-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.map-delivery-icon:hover::before {
    opacity: 1;
    visibility: visible;
    bottom: -36px;
}

/* ========== СТИЛИ ДЛЯ БАЛУНА ТОЧЕК ПВЗ ========== */
.pickup-point-balloon {
    padding: 8px;
}

.pickup-point-balloon p {
    margin-bottom: 8px;
}

.pickup-point-balloon .btn {
    width: 100%;
}

/* ========== МОБИЛЬНЫЙ ПЕРЕКЛЮЧАТЕЛЬ - СКРЫТ НА ДЕСКТОПЕ ========== */
.mobile-delivery-toggle {
    display: none;
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ МОДАЛКИ ========== */
@media (max-width: 768px) {
    /* Базовая адаптация колонок */
    .address-map-columns {
        flex-direction: column;
    }

    .address-search-column {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .address-map-modal .modal-body {
        height: auto;
        max-height: 80vh;
    }

    /* Переключатель доставки для мобильных */
    .mobile-delivery-toggle {
        display: block !important;
    }
    
    .address-modal-responsive .col-md-4 > .mb-4:first-of-type {
        display: none !important;
    }
    
    .address-modal-responsive {
        max-width: 100% !important;
        margin: 0 !important;
        height: 100vh;
    }
    
    .address-modal-responsive .modal-content {
        height: 100vh;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
    }
    
    .address-modal-responsive .modal-header {
        flex-shrink: 0;
    }
    
    .address-modal-responsive .modal-body {
        /* height: auto !important; */
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 0 !important;
    }
    
    .address-modal-responsive .row {
        flex-direction: column-reverse !important;
        margin: 0 !important;
        flex: 1;
        display: flex;
    }
    
    .address-modal-responsive .col-md-4 {
        width: 100% !important;
        max-width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid #e2e8f0;
        max-height: none !important;
        height: auto !important;
        flex-shrink: 0;
        overflow-y: visible;
        padding: 12px 16px !important;
    }
    
    .address-modal-responsive .col-md-4 > h5:first-of-type {
        display: none;
    }
    
    .address-modal-responsive #deliveryTypeToggle {
        margin-bottom: 12px !important;
    }
    
    .address-modal-responsive .col-md-8 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1;
        min-height: 350px;
        height: auto !important;
        padding: 0 !important;
    }
    
    .address-modal-responsive #yandexMap {
        min-height: 350px;
    }
    
    .address-modal-responsive .modal-footer {
        flex-shrink: 0;
        padding: 12px 16px !important;
    }
    
    .map-delivery-icon {
        width: 56px !important;
        height: 56px !important;
    }
    
    .map-delivery-icon img {
        width: 36px !important;
        height: 36px !important;
    }
    
    .address-modal-responsive .col-md-4 p.text-muted {
        display: none;
    }
    
    .address-modal-responsive #deliveryTypeToggle .btn {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .address-modal-responsive .form-control {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .address-modal-responsive .form-label {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .address-modal-responsive h5 {
        font-size: 14px;
        margin-bottom: 12px;
    }
}

/* ========== СКРЫВАЕМ ЭЛЕМЕНТЫ ЯНДЕКС.КАРТ ========== */
.ymaps-2-1-79-copyrights-pane,
.ymaps-2-1-79-controls__toolbar_right,
.ymaps-2-1-79-controls__toolbar_left,
.ymaps-2-1-79-controls__control_toolbar {
    display: none !important;
}

/* ========== ЛОАДЕР ЗАГРУЗКИ ТОЧЕК НА КАРТЕ ========== */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.map-loading-overlay.active {
    display: flex !important;
}

.map-loading-spinner {
    width: 64px;
    height: 64px;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Иконки доставки НЕ должны терять opacity при загрузке */
#mapDeliveryIcons {
    z-index: 9999 !important;
}

.map-delivery-icon {
    opacity: 1 !important;
}

