/**
 * BTS Shipping Checkout Styles
 * Стили для оформления заказа с доставкой BTS
 */

/* Контейнер выбора филиала */
.bts-pickup-selector {
    margin: 15px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bts-pickup-selector h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.bts-pickup-description {
    margin: 0 0 20px 0;
    padding: 10px 15px;
    background: #e8f5e9;
    border-left: 4px solid #4CAF50;
    font-size: 14px;
    color: #2e7d32;
    border-radius: 4px;
}

.bts-city-selector,
.bts-branch-selector {
    margin-bottom: 15px;
}

.bts-city-selector label,
.bts-branch-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

/* Селект города и филиала */
.bts-city-select,
.bts-branch-select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
}

.bts-city-select:focus,
.bts-branch-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

/* Загрузка филиалов */
.bts-loading {
    display: inline-block;
    margin-left: 10px;
    font-size: 14px;
    color: #666;
}

.bts-loading::after {
    content: '...';
    animation: bts-dots 1.5s steps(4, end) infinite;
}

@keyframes bts-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Информация о выбранном филиале */
.bts-branch-info {
    margin-top: 20px;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.bts-branch-details h5 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 700;
    color: #2e7d32;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8f5e9;
}

.branch-info-grid {
    display: grid;
    gap: 15px;
}

.bts-branch-info p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
}

.bts-branch-info p strong {
    display: block;
    margin-bottom: 4px;
    color: #2c3e50;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bts-branch-info .branch-address {
    color: #495057;
}

.bts-branch-info .branch-phone {
    color: #2196F3;
}

.bts-branch-info .branch-hours {
    color: #6c757d;
}

/* Карта филиала */
.bts-branch-map {
    margin-top: 15px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.bts-map-container p {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.bts-map-link {
    display: inline-block;
    padding: 10px 20px;
    background: #2196F3;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.bts-map-link:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

/* Информация о доставке */
.bts-delivery-info {
    margin: 15px 0;
    padding: 12px 15px;
    background: #e8f5e9;
    border-left: 4px solid #4CAF50;
    border-radius: 3px;
}

.bts-delivery-info p {
    margin: 0;
    font-size: 14px;
    color: #2e7d32;
}

.bts-delivery-info .delivery-cost {
    font-weight: 600;
    font-size: 16px;
}

.bts-delivery-info .delivery-time {
    font-size: 13px;
    color: #558b2f;
    margin-top: 5px;
}

/* Ошибки */
.bts-error {
    margin: 10px 0;
    padding: 12px 15px;
    background: #ffebee;
    border-left: 4px solid #f44336;
    border-radius: 3px;
    color: #c62828;
    font-size: 14px;
}

/* Иконки статуса */
.bts-status-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    vertical-align: middle;
}

.bts-status-icon.success {
    color: #4CAF50;
}

.bts-status-icon.error {
    color: #f44336;
}

.bts-status-icon.warning {
    color: #ff9800;
}

/* Адаптивность */
@media (max-width: 768px) {
    .bts-pickup-selector {
        padding: 12px;
    }
    
    .bts-branch-info {
        padding: 12px;
    }
    
    .bts-branch-map {
        height: 200px;
    }
}

/* Анимация появления */
.bts-fade-in {
    animation: btsFadeIn 0.3s ease-in;
}

@keyframes btsFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Скрыть элементы по умолчанию */
.bts-hidden {
    display: none !important;
}

/* Прогресс-бар бесплатной доставки */
.klb-free-progress-bar {
    margin: 15px 0;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
}

.klb-free-progress-bar.success {
    background: #d1fae5;
    border-color: #10b981;
}

.klb-free-progress-bar .free-shipping-notice {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #856404;
    margin-bottom: 10px;
}

.klb-free-progress-bar.success .free-shipping-notice {
    color: #065f46;
}

.klb-progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.klb-progress-bar .progress {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
    transition: width 0.3s ease;
}

.klb-free-progress-bar.success .klb-progress-bar .progress {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

/* Кнопка обновления расчёта доставки */
.bts-recalculate-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: #2196F3;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.bts-recalculate-btn:hover {
    background: #1976D2;
}

.bts-recalculate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Скрываем стандартные поля адреса в форме checkout */
#billing_country_field,
#billing_address_1_field,
#billing_address_2_field,
#billing_city_field,
#billing_state_field,
#billing_postcode_field,
.woocommerce-shipping-fields {
    display: none !important;
}

/* Скрываем строку доставки в таблице tfoot и в корзине */
.woocommerce-checkout-review-order-table tfoot .woocommerce-shipping-totals,
.woocommerce-cart-form__contents .woocommerce-shipping-totals,
.cart_totals .woocommerce-shipping-totals,
tr.woocommerce-shipping-totals,
.woocommerce-cart-form + .cart-collaterals .woocommerce-shipping-totals,
.shop_table.cart .woocommerce-shipping-totals,
table.shop_table_responsive tr.woocommerce-shipping-totals,
.woocommerce table.shop_table tr.woocommerce-shipping-totals {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* Скрываем калькулятор доставки и связанные элементы */
.woocommerce-shipping-calculator,
.shipping-calculator-button,
.woocommerce-shipping-destination,
form.woocommerce-shipping-calculator,
.shipping-calculator-form,
#shipping-calculator-form {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* Стили для блока доставки в основной форме */
.bts-delivery-section {
    background: #fff;
    padding: 20px;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
}

.bts-delivery-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Горизонтальное расположение методов доставки */
.bts-shipping-methods #shipping_method {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

.bts-shipping-methods .shipping-method-item {
    flex: 1;
    min-width: 200px;
    padding: 20px;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    text-align: center;
}

.bts-shipping-methods .shipping-method-item:hover {
    border-color: #DD3333;
    background: #fff5f5;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(221, 51, 51, 0.2);
}

/* Стили для выбранного метода (когда radio checked) */
.bts-shipping-methods .shipping-method-item.selected,
.bts-shipping-methods .shipping-method-item:has(input[type="radio"]:checked) {
    border-color: #DD3333;
    border-width: 3px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    box-shadow: 0 6px 20px rgba(221, 51, 51, 0.25);
}

.bts-shipping-methods .shipping-method-item input[type="radio"] {
    display: none;
}

.bts-shipping-methods .shipping-method-item label {
    cursor: pointer;
    margin: 0;
    display: block;
    width: 100%;
}

.bts-shipping-methods .shipping-method-item label > div:first-child {
    font-size: 17px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    transition: color 0.3s;
}

.bts-shipping-methods .shipping-method-item.selected label > div:first-child,
.bts-shipping-methods .shipping-method-item:has(input[type="radio"]:checked) label > div:first-child {
    color: #DD3333;
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .bts-shipping-methods #shipping_method {
        flex-direction: column;
    }
    
    .bts-shipping-methods .shipping-method-item {
        min-width: 100%;
    }
}

.bts-pickup-fields,
.bts-courier-fields {
    margin-top: 15px;
}

/* Скрытые поля для гостей */
.bts-hidden-for-guests {
    display: none !important;
}

/* Стили для полей региона и района */
#shipping_region,
#shipping_district,
#bts-pickup-branch-combined,
.bts-branch-select,
.bts-region-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Убеждаемся что select НЕ выглядит disabled */
#shipping_region:not([disabled]),
#shipping_district:not([disabled]),
#bts-pickup-branch-combined:not([disabled]) {
    background-color: #fff !important;
    color: #333 !important;
    cursor: pointer !important;
}

/* Только disabled select выглядит неактивным */
#shipping_region[disabled],
#shipping_district[disabled],
#bts-pickup-branch-combined[disabled] {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

#shipping_street,
#shipping_postcode {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Модальное окно авторизации - убедимся что оно поверх всего */
.authentication-modal.is-active {
    z-index: 99999 !important;
}

.authentication-modal .klb-modal-inner {
    z-index: 100000 !important;
}

.login-drawer-overlay {
    z-index: 99998 !important;
}
