/* map/styles.css - Стилі для системи доставки з Google Maps */

/* ========== ЗМІННІ ========== */
:root {
    --delivery-free-color: #28a745;
    --delivery-paid-color: #dc3545;
    --delivery-warning-color: #ffc107;
    --delivery-info-color: #17a2b8;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

/* ========== GOOGLE PLACES АВТОЗАПОВНЕННЯ ========== */
.pac-container {
    background-color: #ffffff !important;
    border: 2px solid #333333 !important;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    z-index: 999999 !important;
    margin-top: 4px;
    overflow: hidden;
    animation: slideDown var(--transition-speed) ease;
}

.pac-item {
    border-bottom: 1px solid #e0e0e0 !important;
    cursor: pointer;
    padding: 12px 16px;
    font-size: 14px !important;
    line-height: 1.5;
    transition: background-color 0.2s ease;
    color: var(--text-primary) !important;
    background-color: #ffffff !important;
    position: relative;
}

.pac-item:hover,
.pac-item-selected {
    background-color: #f0f8ff !important;
}

.pac-item:last-child {
    border-bottom: none !important;
}

.pac-item-query {
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

.pac-matched {
    font-weight: 700 !important;
    color: #1976d2 !important;
}

/* Інструкція у випадаючому списку */
.selection-instruction {
    padding: 10px 16px !important;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border-bottom: 2px solid #90caf9 !important;
    font-size: 13px !important;
    color: #1565c0 !important;
    font-weight: 600 !important;
    text-align: center;
    letter-spacing: 0.3px;
}

/* ========== ІНДИКАТОР ДОСТАВКИ ========== */
.delivery-indicator {
    margin-top: 12px;
    border-radius: var(--border-radius);
    display: none;
    transition: all var(--transition-speed) ease;
    border: 2px solid;
    position: relative;
    overflow: hidden;
    animation: fadeIn var(--transition-speed) ease;
}

.delivery-indicator.free {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-color: var(--delivery-free-color);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.delivery-indicator.paid {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border-color: var(--delivery-paid-color);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
}

.delivery-indicator.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: var(--delivery-warning-color);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

/* Контент індикатора */
.delivery-info {
    padding: 14px 16px;
}

.delivery-status {
    font-size: 15px !important;
    font-weight: 700 !important;
    margin-bottom: 8px;
    line-height: 1.4;
}

.delivery-details {
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.5;
    opacity: 0.95;
}

/* Кольори тексту залежно від статусу */
.delivery-indicator.free .delivery-status,
.delivery-indicator.free .delivery-details {
    color: #155724;
}

.delivery-indicator.paid .delivery-status,
.delivery-indicator.paid .delivery-details {
    color: #721c24;
}

.delivery-indicator.warning .delivery-status,
.delivery-indicator.warning .delivery-details {
    color: #856404;
}

/* ========== СТИЛІ ПОЛІВ АДРЕСИ ========== */
.delivery-free {
    border-color: var(--delivery-free-color) !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15) !important;
    background-color: rgba(40, 167, 69, 0.03) !important;
    transition: all var(--transition-speed) ease !important;
}

.delivery-paid {
    border-color: var(--delivery-paid-color) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15) !important;
    background-color: rgba(220, 53, 69, 0.03) !important;
    transition: all var(--transition-speed) ease !important;
}

.address-warning {
    border-color: var(--delivery-warning-color) !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2) !important;
    background-color: rgba(255, 193, 7, 0.05) !important;
}

/* ========== АНІМАЦІЇ ========== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========== АДАПТИВНІСТЬ ========== */
@media (max-width: 768px) {
    .pac-container {
        border-width: 1px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    }
    
    .pac-item {
        padding: 10px 14px;
        font-size: 13px !important;
    }
    
    .delivery-info {
        padding: 12px 14px;
    }
    
    .delivery-status {
        font-size: 14px !important;
    }
    
    .delivery-details {
        font-size: 12px !important;
    }
    
    .selection-instruction {
        padding: 8px 14px !important;
        font-size: 12px !important;
    }
}

/* ========== СУМІСНІСТЬ З ТЕМАМИ ========== */
/* WooCommerce */
.woocommerce .pac-container,
.woocommerce .pac-item,
.woocommerce-page .pac-container,
.woocommerce-page .pac-item {
    background-color: #ffffff !important;
    color: var(--text-primary) !important;
}

/* Темні теми */
[data-theme="dark"] .pac-container,
.dark-mode .pac-container,
body.dark .pac-container {
    background-color: #ffffff !important;
    border-color: #666666 !important;
}

[data-theme="dark"] .pac-item,
.dark-mode .pac-item,
body.dark .pac-item {
    background-color: #ffffff !important;
    color: var(--text-primary) !important;
}

/* Bricks Builder */
.brxe-form .pac-container {
    background-color: #ffffff !important;
}

/* ========== УТИЛІТИ ========== */
/* Забезпечуємо читабельність тексту */
.pac-container *,
.delivery-indicator * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Забороняємо виділення тексту в інструкціях */
.selection-instruction {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* Покращення доступності */
.pac-item:focus,
.pac-item-selected {
    outline: 2px solid #1976d2;
    outline-offset: -2px;
}

/* Підсвітка активного поля */
input:focus.delivery-free,
input:focus.delivery-paid,
input:focus.address-warning {
    outline: none;
    box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25) !important;
}