/* ─────────────────────────────────────────────────────────────────────────────
   WC ПВЗ на карте + Fluid Checkout v1.4
   ВАЖНО: нет ни одного :has() — для надёжности в Chrome и Safari
───────────────────────────────────────────────────────────────────────────── */

/* ══ 1. Fluid Checkout: порядок секций ══════════════════════════════════════ */
.fc-checkout-steps {
    display: flex !important;
    flex-direction: column !important;
}
.fc-checkout-steps > section:has(#fc-step__title--shipping) { order: 1 !important; }
.fc-checkout-steps > section:has(#fc-step__title--payment)  { order: 2 !important; }
.fc-checkout-steps > section:has(#fc-step__title--contact)  { order: 3 !important; }
.fc-checkout-steps > section:has(#fc-step__title--billing)  { order: 4 !important; }

/* ══ 2. Скрываем адресные поля по ID — точечно, без :has() ══════════════════ */
#billing_company_field,
#billing_address_1_field,
#billing_address_2_field,
#billing_city_field,
#billing_postcode_field,
#billing_country_field,
#billing_state_field,
#shipping_company_field,
#shipping_address_1_field,
#shipping_address_2_field,
#shipping_city_field,
#shipping_postcode_field,
#shipping_country_field,
#shipping_state_field { display: none !important; }

/* ══ 3. Скрываем: регистрация и адрес доставки (по классу substep) ══════════ */
.fc-step__substep--shipping_address,
[data-substep-id="shipping_address"],
.fc-step__substep--account_creation,
[data-substep-id="account_creation"],
.woocommerce-form-login-toggle,
.fc-step__substep--coupon_code,
[data-substep-id="coupon_code"] { display: none !important; }

/* ══ 4. Десктоп: левый дубль кнопки и согласий — прячем по классам ══════════ */
/* Используем JS для точного таргетинга, здесь только CSS-запасной вариант */
@media (min-width: 768px) {
    .fc-checkout-steps .fc-place-order { display: none !important; }
    .fc-checkout-steps .fc-terms-checkbox-wrap { display: none !important; }
}

/* ══ 5. Мобильный чекаут: центрируем логотип через flex ════════════════════ */
@media (max-width: 767px) {
    /* Fluid Checkout header — делаем flex с тремя зонами */
    .fc-page-header__content {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: relative !important;
    }
    /* Логотип абсолютно по центру */
    .fc-page-header__logo {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    /* Виджет города — левый край, не перекрывает логотип */
    #wc-pvz-city-widget {
        position: relative !important;
        z-index: 1;
        flex-shrink: 0;
    }
}

/* ══ 6. Секция ПВЗ ══════════════════════════════════════════════════════════ */
#shipping_method li { list-style: none; }

#pvz-map-section {
    margin: 10px 0 4px 24px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
#pvz-selection-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#pvz-selected-label { flex: 1; min-width: 180px; font-size: 13px; color: #374151; line-height: 1.5; }
#pvz-selected-label small { color: #6b7280; }
.pvz-carrier-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #fff; vertical-align: middle; }
#pvz-open-map-btn { white-space: nowrap; font-size: 13px !important; padding: 7px 14px !important; }

/* ══ 7. Модал ═══════════════════════════════════════════════════════════════ */
#pvz-map-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; }
#pvz-map-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
#pvz-map-dialog { position: relative; z-index: 1; display: flex; flex-direction: column; width: 90vw; max-width: 900px; height: 85vh; max-height: 700px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
#pvz-map-header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: #1e293b; color: #fff; flex-shrink: 0; }
#pvz-map-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #fff; }
#pvz-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.pvz-legend-item { padding: 3px 10px; border: 2px solid; border-radius: 20px; font-size: 12px; color: #fff; background: rgba(255,255,255,0.12); font-weight: 500; }
#pvz-close-btn { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 4px; line-height: 1; margin-left: 8px; }
#pvz-close-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }
#pvz-map-status { flex-shrink: 0; padding: 8px 18px; font-size: 13px; color: #6b7280; background: #f1f5f9; border-bottom: 1px solid #e2e8f0; display: none; }
#pvz-map-container { flex: 1; min-height: 0; }

/* ══ 8. Балун и адаптив ═════════════════════════════════════════════════════ */
.pvz-balloon-address  { margin: 4px 0; font-size: 13px; }
.pvz-balloon-schedule, .pvz-balloon-phone { margin: 4px 0; font-size: 12px; color: #555; }
.pvz-select-btn { display: block !important; width: 100%; margin-top: 10px !important; text-align: center; font-size: 13px !important; padding: 7px 12px !important; background: #1d4ed8 !important; color: #fff !important; border: none !important; border-radius: 6px !important; cursor: pointer !important; }
.pvz-select-btn:hover { background: #1e40af !important; }

@media (max-width: 640px) {
    #pvz-map-dialog { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
    #pvz-map-header { flex-wrap: wrap; }
    #pvz-legend { margin-left: 0; order: 3; width: 100%; }
    #pvz-selection-box { flex-direction: column; align-items: flex-start; }
    #pvz-open-map-btn { width: 100%; }
}

/* ── Блок тарифа в балуне ────────────────────────────────────────────────── */
.pvz-delivery-info {
    margin: 8px 0 6px;
    min-height: 20px;
}
.pvz-delivery-loading {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}
.pvz-delivery-result {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    color: #166534;
}
.pvz-delivery-na {
    font-size: 12px;
    color: #94a3b8;
}

/* ── Тариф в строке выбранного ПВЗ на чекауте ───────────────────────────── */
.pvz-delivery-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 2px 8px;
    margin-top: 3px;
}

/* ── Виджет города в заголовке карты ────────────────────────────────────── */
#pvz-map-city-btn {
    display:          inline-flex;
    align-items:      center;
    gap:              5px;
    background:       rgba(255,255,255,0.15);
    border:           1px solid rgba(255,255,255,0.3);
    border-radius:    20px;
    color:            #fff;
    padding:          5px 12px;
    font-size:        13px;
    font-weight:      500;
    cursor:           pointer;
    white-space:      nowrap;
    transition:       background 0.15s;
    margin-left:      8px;
}
#pvz-map-city-btn:hover {
    background: rgba(255,255,255,0.28);
}
.pvz-map-city-pin  { font-size: 14px; }
.pvz-map-city-arrow { font-size: 9px; opacity: 0.7; }
