/**
 * Стили для фронтенд части плагина Яндекс Карты - Зоны Доставки
 * Совместимость с популярными темами WooCommerce
 */

/* Контейнер карты доставки - универсальный */
.ymdz-delivery-map-wrapper,
.woocommerce .ymdz-delivery-map-wrapper,
.woocommerce-page .ymdz-delivery-map-wrapper,
body.woocommerce-checkout .ymdz-delivery-map-wrapper {
    margin: 20px 0 !important;
    padding: 15px !important;
    background: #f9f9f9 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    clear: both !important;
}

.ymdz-delivery-map-wrapper h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.woocommerce #ymdz-frontend-map, .woocommerce-page #ymdz-frontend-map {
    display: flex !important;
}

/* Кнопка переключения карты */
.ymdz-toggle-map-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.3s;
    margin-bottom: 15px;
}

.ymdz-toggle-map-btn:hover {
    background: #1976D2;
    color: white;
    text-decoration: none;
}

.ymdz-toggle-map-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
}

/* Сама карта */
#ymdz-frontend-map {
    width: 100%;
    height: 400px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
    display: none; /* Скрыта по умолчанию */
}

#ymdz-frontend-map.ymdz-map-visible {
    display: block;
}

/* Информация о маршруте */
#ymdz-map-info {
    display: none;
    padding: 15px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.ymdz-route-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.ymdz-route-info span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #555;
}

.ymdz-route-info strong {
    color: #333;
    font-weight: 600;
}

/* Информация о складе и доставке */
.ymdz-warehouse-info {
    padding: 15px;
    background: #E3F2FD;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
    margin-bottom: 15px;
}

.ymdz-warehouse-info h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1976D2;
}

.ymdz-warehouse-info p {
    margin: 5px 0;
    font-size: 14px;
    color: #555;
}

.ymdz-warehouse-info .ymdz-warehouse-name {
    font-weight: 600;
    color: #333;
}

.ymdz-warehouse-info .ymdz-delivery-cost {
    font-size: 16px;
    font-weight: 700;
    color: #4CAF50;
    margin-top: 10px;
}

/* Иконки */
.ymdz-info-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    vertical-align: middle;
}

.ymdz-info-icon::before {
    content: "📦";
}

.ymdz-info-icon.location::before {
    content: "📍";
}

.ymdz-info-icon.distance::before {
    content: "📏";
}

.ymdz-info-icon.time::before {
    content: "⏱️";
}

.ymdz-info-icon.price::before {
    content: "💰";
}

/* Переопределение стилей тем для карты */
.woocommerce #ymdz-frontend-map,
.woocommerce-page #ymdz-frontend-map {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Divi theme */
.et_pb_section #ymdz-frontend-map {
    width: 100% !important;
}

/* Astra theme */
.ast-container #ymdz-frontend-map {
    width: 100% !important;
}

/* Flatsome theme */
.cart-container #ymdz-frontend-map,
.checkout-page #ymdz-frontend-map {
    width: 100% !important;
}

/* Адаптивность для мобильных */
@media screen and (max-width: 768px) {
    #ymdz-frontend-map,
    .woocommerce #ymdz-frontend-map {
        height: 300px !important;
    }
    
    .ymdz-route-info {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    
    .ymdz-delivery-map-wrapper,
    .woocommerce .ymdz-delivery-map-wrapper {
        padding: 10px !important;
    }
}

/* Загрузчик карты */
.ymdz-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: #f5f5f5;
    border-radius: 4px;
}

.ymdz-map-loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: ymdz-spin 1s linear infinite;
}

@keyframes ymdz-spin {
    to { transform: rotate(360deg); }
}

/* Стили для информации о доставке в чекауте */
.ymdz-delivery-info {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.ymdz-delivery-info.success {
    background: #d4edda;
    border-color: #c3e6cb;
}

.ymdz-delivery-info.error {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.ymdz-delivery-info p {
    margin: 5px 0;
    font-size: 14px;
}

.ymdz-delivery-info .success {
    color: #155724;
    font-weight: 600;
}

.ymdz-delivery-info .error {
    color: #721c24;
    font-weight: 600;
}

.ymdz-delivery-info .loading {
    color: #856404;
}

.ymdz-delivery-info .free-delivery {
    color: #28a745;
    font-weight: 700;
    font-size: 16px;
}

/* Уведомление о зоне доставки */
.ymdz-zone-notice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #E8F5E9;
    border: 1px solid #4CAF50;
    border-radius: 4px;
    font-size: 13px;
    color: #2E7D32;
    margin-top: 10px;
}

.ymdz-zone-notice::before {
    content: "✓";
    font-weight: bold;
    color: #4CAF50;
}

/* Предупреждение о недоступности доставки */
.ymdz-no-delivery-warning {
    padding: 15px;
    background: #FFF3CD;
    border: 1px solid #FFEB3B;
    border-left: 4px solid #FF9800;
    border-radius: 4px;
    color: #856404;
    margin: 15px 0;
}

.ymdz-no-delivery-warning::before {
    content: "⚠️ ";
}
