/* =================================================================
   Telefon alani (2026-11-18): bayrakli ulke secici + numara girisi. Sepet (client/cart.php) ve
   kayit (client/register.php) kullanir; isaretleme includes/helpers/telefon.php > oyuntag_telefon_alani().
   Sayfa kendi olcusunu degiskenlerle verir: --tel-h, --tel-r, --tel-zemin, --tel-cizgi.
   Bayraklar: assets/img/bayraklar.webp (245 bayrak, 16 sutun, 2x cizim; flag-icons, MIT).
================================================================= */

.tel-alan {
    --tel-h: 48px;
    --tel-r: 12px;
    --tel-zemin: transparent;
    --tel-cizgi: var(--border-color, rgba(255, 255, 255, 0.12));
    --tel-yazi: var(--text-main, var(--text-primary, #f4f5f9));
    --tel-soluk: var(--text-sub, var(--text-secondary, #9aa3b2));
    --tel-vurgu: var(--accent-color, #b43fe6);
    --tel-vurgu-rgb: var(--accent-rgb, 180, 63, 230);
    --tel-kart: var(--oz-surface-card, var(--bg-card, #16181f));
    --tel-hata: #f87171;
    --tel-vurgu-yazi: var(--accent-color, #b43fe6);
    display: grid;
    gap: 0.5rem;
}

html.light-theme .tel-alan {
    --tel-hata: #b91c1c;
    --tel-vurgu-yazi: var(--oz-text-accent, #601580);
}

/* ---------- Kutu: [bayrak +90 v] | numara ---------- */
.tel-kutu {
    display: flex;
    align-items: stretch;
    min-height: var(--tel-h);
    border: 1px solid var(--tel-cizgi);
    border-radius: var(--tel-r);
    background: var(--tel-zemin);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tel-kutu:focus-within {
    border-color: var(--tel-vurgu);
    box-shadow: 0 0 0 3px rgba(var(--tel-vurgu-rgb), 0.22);
}

/* Klavye odagi: halka ic alanda degil tum kutuda (site geneli odak kurali korunur) */
.tel-kutu:has(.tel-girdi:focus-visible) {
    outline: 2px solid var(--oz-focus, var(--tel-vurgu));
    outline-offset: 2px;
}

.tel-alan.is-hatali .tel-kutu {
    border-color: var(--tel-hata);
}

.tel-ulke {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0 0.45rem 0 0.75rem;
    border: 0;
    border-right: 1px solid var(--tel-cizgi);
    border-radius: 0;
    background: transparent;
    color: var(--tel-yazi);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.tel-ulke:hover {
    background: rgba(127, 127, 127, 0.09);
}

.tel-ulke i {
    font-size: 1rem;
    color: var(--tel-soluk);
    transition: transform 0.15s ease;
}

.tel-ulke[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.tel-girdi {
    flex: 1;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0 0.85rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--tel-yazi);
    font: inherit;
    font-size: 1rem; /* iOS'ta odakta yakinlasmasin */
    letter-spacing: 0.03em;
    font-variant-numeric: tabular-nums;
}

.tel-girdi::placeholder {
    letter-spacing: 0;
    color: var(--tel-soluk);
    opacity: 0.75;
}

/* html[data-onizleme] :is(..., [tabindex]):focus-visible (0,3,1) ve sayfa kurallarini gecmek icin ayni onek */
.tel-alan .tel-girdi:focus,
.tel-alan .tel-girdi:focus-visible,
html[data-onizleme] .tel-alan .tel-girdi:focus-visible,
.tel-alan .tel-ara-girdi:focus,
.tel-alan .tel-ara-girdi:focus-visible,
html[data-onizleme] .tel-alan .tel-ara-girdi:focus-visible {
    outline: none !important;
    border: 0;
    box-shadow: none;
}

.tel-alan.is-hatali .tel-girdi {
    color: var(--tel-hata);
}

/* ---------- Bayrak ---------- */
.tel-bayrak {
    flex: none;
    display: inline-block;
    width: 20px;
    height: 15px;
    border-radius: 3px;
    background: url("../img/bayraklar.webp?v=1") var(--bx, 0) var(--by, 0) / 352px 272px no-repeat;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* Turkiye dugmede kucuk gomulu SVG: sprite yalniz liste acilinca / baska ulke secilince yuklenir */
.tel-ulke .tel-bayrak[data-iso="TR"] {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 480'%3E%3Cpath fill='%23e30a17' d='M0 0h640v480H0z'/%3E%3Cpath fill='%23fff' d='M407 247.5c0 66.2-54.6 119.9-122 119.9s-122-53.7-122-120 54.6-119.8 122-119.8 122 53.7 122 119.9'/%3E%3Cpath fill='%23e30a17' d='M413 247.5c0 53-43.6 95.9-97.5 95.9s-97.6-43-97.6-96 43.7-95.8 97.6-95.8 97.6 42.9 97.6 95.9z'/%3E%3Cpath fill='%23fff' d='m430.7 191.5-1 44.3-41.3 11.2 40.8 14.5-1 40.7 26.5-31.8 40.2 14-23.2-34.1 28.3-33.9-43.5 12-25.8-37z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* ---------- Hata ---------- */
.tel-hata {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--tel-hata);
}

.tel-hata[hidden],
.tel-panel[hidden],
.tel-oge[hidden],
.tel-bos[hidden] {
    display: none;
}

/* ---------- Ulke listesi ---------- */
.tel-panel {
    border: 1px solid var(--tel-cizgi);
    border-radius: var(--tel-r);
    background: var(--tel-kart);
    box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    animation: telPanelAc 0.16s ease-out;
}

html.light-theme .tel-panel {
    box-shadow: 0 18px 40px -26px rgba(15, 23, 42, 0.3);
}

@keyframes telPanelAc {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.tel-panel:has(.tel-ara-girdi:focus-visible) {
    border-color: var(--tel-vurgu);
}

.tel-ara {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.75rem;
    border-bottom: 1px solid var(--tel-cizgi);
    color: var(--tel-soluk);
}

.tel-ara-girdi {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tel-yazi);
    font: inherit;
    font-size: 1rem;
}

.tel-ara-girdi::placeholder {
    color: var(--tel-soluk);
}

.tel-liste {
    max-height: 248px;
    margin: 0;
    padding: 0.3rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.tel-oge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 40px;
    margin: 0;
    padding: 0 0.55rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--tel-yazi);
    cursor: pointer;
}

/* Turkiye ilk sirada; altinda ince ayirici */
.tel-oge.is-ilk {
    position: relative;
    margin-bottom: 0.4rem;
}

.tel-oge.is-ilk::after {
    content: "";
    position: absolute;
    left: 0.55rem;
    right: 0.55rem;
    bottom: -0.22rem;
    height: 1px;
    background: var(--tel-cizgi);
}

.tel-oge:hover,
.tel-oge.is-aktif {
    background: rgba(127, 127, 127, 0.1);
}

.tel-oge[aria-selected="true"] {
    font-weight: 700;
}

.tel-oge-ad {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tel-oge-kod {
    flex: none;
    font-variant-numeric: tabular-nums;
    color: var(--tel-soluk);
}

.tel-oge[aria-selected="true"] .tel-oge-kod {
    color: var(--tel-vurgu-yazi);
}

.tel-bos {
    margin: 0;
    padding: 0.8rem 0.55rem;
    font-size: 0.88rem;
    color: var(--tel-soluk);
}

@media (prefers-reduced-motion: reduce) {
    .tel-panel { animation: none; }
    .tel-ulke i,
    .tel-kutu { transition: none; }
}

/* Gorunmez etiket (ekran okuyucu icin) */
.tel-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
