/* =====================================================================
   BÖLGE SEÇİCİ — ORTAK STİL (global, header.php her sayfada yükler)
   Kaynak: eskiden css/urun.css içindeydi; buraya taşındı ki hem ürün
   detay (urun.php) hem MOBİL MENÜ (header.php offcanvas) AYNI görünümü
   ve altyapıyı kullansın. Değişiklik burada tek yerde yapılır.
   ===================================================================== */

/* ==================== YENI BOLGE ARAMA SISTEMI ==================== */
.bolge-arama-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.25s ease;
}

.bolge-arama-wrapper:hover {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.bolge-arama-wrapper.active {
    border-color: #22c55e;
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.bolge-arama-wrapper.secildi {
    border-color: #22c55e;
    border-style: solid;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.03) 0%, #fff 100%);
}

/* Ust bar (ikon + arama + kapat) — masaustunde satiri, mobilde tam-sayfa basligi olur */
.bolge-arama-bar {
    display: flex;
    align-items: center;
    flex: 1;
    width: 100%;
    min-width: 0;
}

/* Kapat butonu — yalniz mobil tam-sayfa modunda gorunur */
.bolge-arama-kapat {
    display: none;
}

.bolge-arama-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bolge-arama-icon i {
    width: 36px;
    height: 36px;
    background: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    position: relative;
    animation: bolge-icon-pulse 2s ease-in-out infinite;
}

.bolge-arama-icon i::before {
    position: relative;
    z-index: 1;
}

.bolge-arama-icon i::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #22c55e;
    animation: bolge-ring-ping 2s ease-out infinite;
}

@keyframes bolge-icon-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes bolge-ring-ping {
    0% { transform: scale(1); opacity: 0.6; }
    70% { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

.bolge-arama-wrapper.secildi .bolge-arama-icon i,
.bolge-arama-wrapper.active .bolge-arama-icon i {
    animation: none;
}

.bolge-arama-wrapper.secildi .bolge-arama-icon i::after,
.bolge-arama-wrapper.active .bolge-arama-icon i::after {
    animation: none;
    opacity: 0;
}

.bolge-arama-main {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.bolge-arama-input {
    width: 100%;
    border: none;
    padding: 16px 40px 16px 0;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    background: transparent;
    outline: none;
}

.bolge-arama-input:focus-visible {
    outline: none;
}

.bolge-arama-input::placeholder {
    color: #9ca3af;
}

.bolge-arama-ok {
    position: absolute;
    right: 14px;
    color: #22c55e;
    transition: transform 0.2s;
}

.bolge-arama-wrapper.active .bolge-arama-ok {
    transform: rotate(180deg);
}

/* Secili bolgeyi temizle — minimal yuvarlak x ikonu (secili durumda chevron'un yerini alir) */
.bolge-arama-temizle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    color: #9ca3af;
    text-decoration: none;
    z-index: 2;
    transition: color .15s ease, transform .15s ease;
}
.bolge-arama-temizle:hover {
    color: #ef4444;
    transform: translateY(-50%) scale(1.08);
}
.bolge-arama-wrapper.secildi .bolge-arama-ok {
    display: none;
}

/* ===== Teslimat Bolgesi — Acilir Liste (kurumsal / minimal / simetrik) =====
   Yapi: her satir  [ikon] [bolge adi — esner, tam okunur] [ucret — sagda hizali pill].
   Ucretler sabit min-width + sag hizalama ile dikey kolon olusturur (simetri). */
.bolge-arama-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 16px;
    box-shadow: 0 18px 50px -12px rgba(16, 24, 40, 0.22), 0 4px 12px rgba(16, 24, 40, 0.05);
    max-height: 348px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 9999;
    display: none;
}

.bolge-arama-wrapper.active .bolge-arama-dropdown {
    display: block;
}

/* Il grup basligi — minimal, sticky */
.bolge-arama-il {
    padding: 9px 16px;
    background: #fafbfc;
    font-size: 10.5px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #f1f5f9;
}

/* Bolge satiri */
.bolge-arama-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f4f6f8;
    transition: background 0.15s ease;
}

.bolge-arama-item:last-child {
    border-bottom: none;
}

.bolge-arama-item:hover {
    background: #f7faf8;
}

.bolge-arama-item.secili {
    background: #f0fdf4;
    box-shadow: inset 3px 0 0 #22c55e;
}

/* Konum ikonu — yumusak tonlu squircle */
.bolge-arama-item-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: #16a34a;
    border-radius: 10px;
    font-size: 16px;
}

.bolge-arama-item.secili .bolge-arama-item-icon {
    background: #16a34a;
    color: #fff;
}

/* Bolge adi — esner ve tam sarar (mobilde kesilmez) */
.bolge-arama-item-ad {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.35;
    word-break: break-word;
}

/* Ucret — sagda hizali pill (kolon simetrisi icin sabit min-width) */
.bolge-arama-item-ucret {
    flex-shrink: 0;
    min-width: 74px;
    text-align: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    background: #f1f5f9;
    white-space: nowrap;
}

.bolge-arama-item-ucret.ucretsiz {
    color: #059669;
    background: #ecfdf5;
}

.bolge-arama-item.secili .bolge-arama-item-ucret.ucretsiz {
    background: #dcfce7;
}

.bolge-arama-bos {
    padding: 30px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.bolge-arama-bos i {
    font-size: 26px;
    margin-bottom: 6px;
    display: block;
    color: #cbd5e1;
}

/* ===== Mobil — teslimat bolgesi TAM SAYFA acilir + cok daha kucuk fontlar =====
   Kullanici tiklayinca (.active) tum secici viewport'u kaplar: ust bar sabit baslik,
   liste kalan yuksekligi doldurur ve akici kayar. Fontlar kucultuldu ki bir ekrana
   daha cok bolge sigsin ve okunaklilik netlessin (eskiden buyutuluyordu). */
@media (max-width: 576px) {
    /* Tam-sayfa modu acikken arka planin kaymasini kilitle */
    body.bolge-tam-sayfa-acik {
        overflow: hidden;
    }

    /* --- Tam sayfa acilir --- */
    .bolge-arama-wrapper.active {
        position: fixed;
        inset: 0;
        z-index: 10050;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        border: none;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }
    .bolge-arama-wrapper.active .bolge-arama-bar {
        flex: 0 0 auto;
        gap: 8px;
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        border-bottom: 1px solid #eef0f3;
        box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
    }
    .bolge-arama-wrapper.active .bolge-arama-icon {
        width: 40px;
        height: 40px;
    }
    .bolge-arama-wrapper.active .bolge-arama-icon i {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    .bolge-arama-wrapper.active .bolge-arama-input {
        padding: 12px 8px 12px 4px;
        font-size: 16px; /* iOS'ta <16px input focus'ta otomatik zoom yapar → 16px ile engellenir */
    }
    .bolge-arama-wrapper.active .bolge-arama-ok {
        display: none;
    }
    .bolge-arama-wrapper.active .bolge-arama-temizle {
        display: none;
    }
    .bolge-arama-wrapper.active .bolge-arama-kapat {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 10px;
        background: #f1f5f9;
        color: #475569;
        font-size: 15px;
        cursor: pointer;
    }
    .bolge-arama-wrapper.active .bolge-arama-kapat:active {
        background: #e2e8f0;
    }
    .bolge-arama-wrapper.active .bolge-arama-dropdown {
        position: static;
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    /* --- Liste ogeleri: cok daha kucuk font + kompakt satir --- */
    .bolge-arama-il {
        padding: 7px 14px;
        font-size: 9.5px;
        letter-spacing: 0.6px;
    }
    .bolge-arama-item {
        padding: 9px 14px;
        gap: 10px;
    }
    .bolge-arama-item-icon {
        width: 28px;
        height: 28px;
        font-size: 13px;
        border-radius: 8px;
    }
    .bolge-arama-item-ad {
        font-size: 12px;
        line-height: 1.3;
    }
    .bolge-arama-item-ucret {
        min-width: 56px;
        font-size: 10.5px;
        padding: 3px 8px;
    }
    .bolge-arama-bos {
        font-size: 12px;
    }
}

/* =====================================================================
   MOBİL MENÜ full-page picker (#menuBolgeFp) — body seviyesinde render
   edilir (offcanvas transform'una hapsolmaz). Offcanvas ≤991px'te açıldığı
   için full-page davranışı ≤991.98px aralığına genişletildi (telefon+tablet).
   id-scoped → urun.php'nin kendi ≤576px full-page kuralını ETKİLEMEZ.
   ===================================================================== */
#menuBolgeFp { display: none; }
body.bolge-tam-sayfa-acik { overflow: hidden; }
@media (max-width: 991.98px) {
    #menuBolgeFp.active {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 10050;
        flex-direction: column;
        align-items: stretch;
        border: none;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }
    #menuBolgeFp.active .bolge-arama-bar {
        flex: 0 0 auto;
        gap: 8px;
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        border-bottom: 1px solid #eef0f3;
        box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
    }
    #menuBolgeFp.active .bolge-arama-icon { width: 40px; height: 40px; }
    #menuBolgeFp.active .bolge-arama-icon i { width: 30px; height: 30px; font-size: 13px; }
    #menuBolgeFp.active .bolge-arama-input { padding: 12px 8px 12px 4px; font-size: 16px; }
    #menuBolgeFp.active .bolge-arama-ok { display: none; }
    #menuBolgeFp.active .bolge-arama-kapat {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 10px;
        background: #f1f5f9;
        color: #475569;
        font-size: 15px;
        cursor: pointer;
    }
    #menuBolgeFp.active .bolge-arama-kapat:active { background: #e2e8f0; }
    #menuBolgeFp.active .bolge-arama-dropdown {
        position: static;
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    /* Liste öğeleri: küçük font (urun.php ≤576 ile aynı okunaklılık) */
    #menuBolgeFp .bolge-arama-il { padding: 7px 14px; font-size: 9.5px; letter-spacing: .6px; }
    #menuBolgeFp .bolge-arama-item { padding: 9px 14px; gap: 10px; }
    #menuBolgeFp .bolge-arama-item-icon { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
    #menuBolgeFp .bolge-arama-item-ad { font-size: 12px; line-height: 1.3; }
    #menuBolgeFp .bolge-arama-item-ucret { min-width: 56px; font-size: 10.5px; padding: 3px 8px; }
    #menuBolgeFp .bolge-arama-bos { font-size: 12px; }
}
/* Menüdeki tetik-bar: readonly, tıklanınca full-page açılır (typing yok) */
#menuBolgeTetik { cursor: pointer; }
#menuBolgeTetik .bolge-arama-input { cursor: pointer; background: transparent; }

/* =====================================================================
   ARAMA KAPALI MODU (20'den az aktif bölge) — bolge_arama_acik()=false.
   Seçici salt-okunur bir tetiktir: yazma yok, tıklanınca tüm bölgeler
   listelenir ve kullanıcı oradan seçer. Metin imleci yerine tıklanabilir
   imleç + tüm bar tıklanabilir görünür (readonly input tüm yüzeyleri kapsar).
   ===================================================================== */
.bolge-secim-modu { cursor: pointer; }
.bolge-secim-modu .bolge-arama-input,
.bolge-arama-input[readonly] {
    cursor: pointer;
    background: transparent;
}
