/* ==========================================================================
   SMS telefon dogrulama popup
   Analiz / tasarim: Docs/TELEFON-DOGRULAMA-ANALIZ.md  (bkz. §8)
   Tasarim hedefi: 15 yasindaki de 90 yasindaki da tek bakista yapabilsin.
   - Tek is: kodu gir. Baska hicbir alan yok.
   - Buyuk punto, buyuk dokunma alani (min 48px), yuksek kontrast.
   - Kucuk ekranda / klavye acikken TASMAZ: kaydirma katmani overlay'dedir.
   ========================================================================== */

/* TASMA KORUMASI — iki ayri tuzak kapatiliyor:
   1) "align-items:center" ile ortalanan bir kutu viewport'tan uzunsa UST kismi
      overlay'in disina tasar ve kaydirilarak ULASILAMAZ (klasik flexbox hatasi).
      Cozum: align-items:flex-start + kutuda "margin:auto" -> yer varken ortalar,
      yer yokken kirpmaz.
   2) Kaydirma kutunun icinde degil OVERLAY'de: boylece dvh/vh destegi ya da mobil
      klavyenin viewport'u kucultmesi fark etmeksizin her sey erisilebilir kalir. */
.smsd {
    position: fixed;
    inset: 0;
    z-index: 2147483000; /* header / spotlight / karsilastirma barinin ustunde */
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px;
    background: rgba(9, 11, 14, .55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.smsd.is-open {
    display: flex;
}

/* Popup acikken arka plan kaymasin */
body.smsd-open {
    overflow: hidden;
}

.smsd__box {
    width: 100%;
    max-width: 420px;
    margin: auto; /* dikey ortalama — tasma durumunda kirpmayan guvenli yontem */
    background: var(--card, #fff);
    border-radius: var(--r-lg, 20px);
    box-shadow: var(--sh-3, 0 30px 70px rgba(9,11,14,.16));
    padding: 26px 24px 22px;
    text-align: center;
    animation: smsdIn .22s cubic-bezier(.4, 0, .2, 1);
}

@keyframes smsdIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .smsd__box { animation: none; }
}

/* ---------------------------------------------------------------- baslik */
.smsd__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted, #697682);
    border-radius: 50%;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.smsd__close:hover {
    background: var(--soft, #F5F6F8);
    color: var(--ink, #14171A);
}

.smsd__head {
    position: relative;
}

.smsd__ic {
    width: 56px;
    height: 56px;
    margin: 2px auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gri-tint, #F0F0F1);
    color: var(--gri, #8B8C8E);
}

.smsd__ic svg {
    width: 28px;
    height: 28px;
}

.smsd__title {
    font-family: var(--display, sans-serif);
    font-weight: 800;
    font-size: 21px;
    line-height: 1.25;
    color: var(--ink, #14171A);
    margin-bottom: 8px;
}

.smsd__desc {
    font-size: 15px;
    line-height: 1.55;
    color: var(--muted, #697682);
    margin-bottom: 4px;
}

.smsd__tel {
    display: block;
    font-weight: 700;
    font-size: 17px;
    color: var(--ink, #14171A);
    letter-spacing: .02em;
    margin: 6px 0 2px;
}

.smsd__edit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 6px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gri, #8B8C8E);
    text-decoration: underline;
    cursor: pointer;
}

.smsd__edit:hover {
    color: var(--gri-dark, #6A6C6E);
}

/* ------------------------------------------------------------ kod girisi */
.smsd__kod {
    width: 100%;
    margin: 18px 0 6px;
    padding: 16px 12px;
    border: 2px solid var(--line-2, #DDE2E6);
    border-radius: var(--r, 14px);
    background: var(--soft, #F5F6F8);
    /* 16px altinda iOS odaklaninca sayfayi otomatik zoomlar */
    font-family: var(--display, sans-serif);
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    letter-spacing: .38em;
    text-indent: .38em; /* letter-spacing'in sagda biraktigi bosluk telafisi */
    color: var(--ink, #14171A);
    transition: border-color .2s, background .2s;
}

.smsd__kod::placeholder {
    color: var(--faint, #9AA6B0);
    font-weight: 600;
}

.smsd__kod:focus {
    outline: none;
    border-color: var(--gri, #8B8C8E);
    background: #fff;
    box-shadow: 0 0 0 4px var(--gri-glow, rgba(139,140,142,.20));
}

.smsd__kod:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.smsd__kod.is-invalid {
    border-color: #D92D20;
    background: #FEF3F2;
}

/* --------------------------------------------------------------- sayac */
.smsd__sayac {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 26px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted, #697682);
    margin-bottom: 14px;
}

.smsd__sayac svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.smsd__sayac.is-bitti {
    color: #D92D20;
}

/* --------------------------------------------------------------- mesaj */
.smsd__msg {
    display: none;
    font-size: 14.5px;
    line-height: 1.5;
    font-weight: 600;
    border-radius: var(--r-sm, 10px);
    padding: 10px 12px;
    margin-bottom: 14px;
    text-align: center;
}

.smsd__msg.show {
    display: block;
}

.smsd__msg--error {
    background: #FEF3F2;
    color: #B42318;
}

.smsd__msg--ok {
    background: #ECFDF3;
    color: #027A48;
}

/* -------------------------------------------------------------- butonlar */
.smsd__submit {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: var(--r-sm, 10px);
    background: var(--gri, #8B8C8E);
    color: #fff;
    font-family: var(--display, sans-serif);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
}

.smsd__submit:hover:not(:disabled) {
    background: var(--gri-dark, #6A6C6E);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px var(--gri-glow, rgba(139,140,142,.20));
}

.smsd__submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.smsd__tekrar-sat {
    margin-top: 14px;
    font-size: 14.5px;
    color: var(--muted, #697682);
}

.smsd__tekrar {
    background: none;
    border: none;
    padding: 8px 6px;
    min-height: 40px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--gri, #8B8C8E);
    text-decoration: underline;
    cursor: pointer;
}

.smsd__tekrar:disabled {
    color: var(--faint, #9AA6B0);
    text-decoration: none;
    cursor: not-allowed;
}

.smsd__tekrar:not(:disabled):hover {
    color: var(--gri-dark, #6A6C6E);
}

/* ------------------------------------------------------------- yukleniyor */
.smsd__box.is-busy .smsd__kod,
.smsd__box.is-busy .smsd__tekrar {
    pointer-events: none;
    opacity: .6;
}

/* ------------------------------------------------------------------ mobil */
@media (max-width: 420px) {
    .smsd { padding: 10px; }
    .smsd__box { padding: 22px 18px 18px; border-radius: var(--r, 14px); }
    .smsd__title { font-size: 19px; }
    .smsd__kod { font-size: 26px; letter-spacing: .3em; text-indent: .3em; }
}

/* ---------------------------------------------------------- kisa ekranlar
   Klavye acildiginda ve kucuk/yatay telefonlarda dikey alan ciddi daralir.
   Icerik yine kaydirilabilir (overlay scroll) ama once dikey ayak izini kisalt:
   tek ekranda gorunsun, kullanici kaydirmak zorunda kalmasin. */
@media (max-height: 680px) {
    .smsd__box { padding: 18px 18px 16px; }
    .smsd__ic { width: 44px; height: 44px; margin-bottom: 10px; }
    .smsd__ic svg { width: 22px; height: 22px; }
    .smsd__title { font-size: 18px; margin-bottom: 6px; }
    .smsd__desc { font-size: 14px; line-height: 1.45; }
    .smsd__tel { font-size: 16px; margin: 4px 0 0; }
    .smsd__edit { font-size: 13px; padding: 4px; }
    .smsd__kod { margin: 12px 0 4px; padding: 12px; font-size: 24px; }
    .smsd__sayac { min-height: 22px; margin-bottom: 10px; }
    .smsd__msg { margin-bottom: 10px; padding: 8px 10px; }
    .smsd__tekrar-sat { margin-top: 10px; }
}

/* Cok kisa (yatay telefon / klavye acik): ikon gizlenir, is yapan parcalar kalir.
   Ikon gidince basligin ustune cikan kapat butonu icin: buton kuculur ve baslik
   iki yandan simetrik padding alir (ortalama bozulmadan metin X'in altina girmez). */
@media (max-height: 480px) {
    .smsd__ic { display: none; }
    .smsd__desc { margin-bottom: 0; }
    .smsd__box { padding: 14px 16px 14px; }
    .smsd__submit { min-height: 46px; }
    .smsd__close { top: 0; right: 0; width: 34px; height: 34px; }
    .smsd__close svg { width: 17px; height: 17px; }
    .smsd__title { padding: 0 36px; font-size: 17px; }
}
