/* Payment Portal — self-hosted, runtime CDN yok.
 *
 * CSP kısıtları (AddPortalContentSecurityPolicyHeaders):
 *   style-src 'self'  → inline <style> ve style="" YASAK, her şey bu dosyada
 *   font-src  'self'  → webfont yok, sistem stack'i kullanılır
 *   img-src   'self'  → görseller /system/payment-portal/ altından
 *
 * Palet storefront login.css'ten türetildi (marka sürekliliği):
 *   #282a39 #3C4051 #5C6077 mürekkep/arduvaz, #1f82e6 #3699FF aksan, #f1416c hata.
 */

:root {
    color-scheme: light;

    /* Kontrast oranları WCAG 2 AA'ya göre hesaplandı (metin 4.5:1, arayüz 3:1).
     * Ölçülen değerler yorumlarda; renk değiştirilirse yeniden hesaplanmalı. */
    --ink: #282a39;
    --ink-soft: #3c4051;
    --slate: #5c6077;          /* beyaz üstünde 6.19:1 */
    --muted: #666c80;          /* beyaz 5.22:1 · zemin 4.61:1 (eski #8b90a3 = 3.17:1, AA fail) */
    --line: #e2e5ec;
    --line-soft: #eef0f4;
    --field-line: #858da0;     /* beyaz 3.33:1 — input sınırı tek görsel ipucu (1.4.11) */
    --surface: #ffffff;
    --ground: #eef1f6;

    --accent: #1a6fc4;         /* beyaz metin 5.10:1 · beyaz zeminde link 5.10:1
                                * (eski #1f82e6 = 3.89:1, hem butonda hem linkte AA fail) */
    --accent-ink: #14508f;     /* hover + odak hâlkası, beyaz üstünde 8.16:1 */
    --accent-wash: #eaf3fd;

    --ok: #0f7b4f;
    --ok-wash: #e8f4ee;
    --bad: #d92d54;
    --bad-wash: #fdecf0;
    --warn: #b26b00;
    --warn-wash: #fbf2e3;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(40, 42, 57, .05), 0 12px 32px -18px rgba(40, 42, 57, .28);
}

*, *::before, *::after { box-sizing: border-box; }

/* Yalnız ekran okuyucu için — boş th'ye erişilebilir başlık verir.
 * position:absolute KULLANILMAZ: konumlandırılmamış bir <th> içinde absolute
 * eleman ilk kapsayan bloğa kaçar ve sayfanın yatay scroll genişliğini
 * büyütür (ölçüldü: html scrollW 500 → 837). clip-path aynı işi taşırmadan yapar. */
.sr-only {
    display: inline-block;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 32px 18px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: var(--ground);
    background-image: linear-gradient(180deg, #f5f7fa 0%, var(--ground) 100%);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Marka bandı (kart dışında, her sayfada) ---------- */

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    text-align: center;
}

.brand-mark { height: 26px; width: auto; display: block; }

.brand-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Kart ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 30px 28px;
    width: 100%;
    max-width: 440px;
    /* Flex item varsayılanı min-width:auto — geniş içerik (geçmiş tablosu)
     * kartı viewport dışına taşırır ve .history-wrap'in overflow'u devreye
     * girmez. Sıfırlanmazsa dar ekranda sayfa yatay kayar. */
    min-width: 0;
    box-shadow: var(--shadow);
}

.card.wide { max-width: 760px; }

h1 {
    font-size: 21px;
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -.01em;
    margin: 0 0 6px;
    text-wrap: balance;
}

p.sub {
    color: var(--slate);
    font-size: 14px;
    margin: 0 0 22px;
}

/* ---------- Form ---------- */

.field { margin-bottom: 15px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

/* Tip-bağımsız seçici: yeni bir input tipi (password/tel/number) eklendiğinde
 * stilsiz kalmasın — CVV'nin type=password olduğu için çıplak render edilmesi
 * tam olarak böyle bir regresyondu. */
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--field-line);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .12s ease, box-shadow .12s ease;
}

input::placeholder { color: #b3b8c6; }

input:hover:not(:focus), select:hover:not(:focus) { border-color: #6f7789; }

/* Odak göstergesi GERÇEK outline ile verilir. Önceki sürüm `outline: none` +
 * soluk bir box-shadow halesi (beyaz üstünde 1.24:1) kullanıyordu ve göstergenin
 * diğer yarısı `border-color` idi — kenarlığı olmayan çıplak metin linklerinde
 * (`.links a`, tablodaki "Detay") border-style:none olduğu için tamamen görünmezdi.
 * outline her elemanda çizilir ve kutu geometrisini bozmaz. (WCAG 2.4.11 / 1.4.11) */
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent-ink);   /* beyaz üstünde 8.16:1 */
    outline-offset: 2px;
}

/* Alanın kendi sınırı da odakta vurgulanır (fare kullanıcısı için affordans) */
input:focus, select:focus { border-color: var(--accent); }

/* Rakamsal alanlar hizalı okunsun */
input[inputmode=numeric],
input[inputmode=decimal],
#card_number { font-variant-numeric: tabular-nums; }

#card_number { font-size: 16px; letter-spacing: .04em; }

/* OTP: tek satırda okunaklı, hizalı 6 hane */
input.otp {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: .32em;
    text-indent: .32em;
    padding: 13px 12px;
    font-variant-numeric: tabular-nums;
}

input.otp::placeholder { letter-spacing: .32em; font-weight: 400; }

/* Ay ve yıl 2 hane, CVV 3-4 hane — eşit genişlik doğru olan.
 * Önceki 2fr 1fr 1fr ay'ı gereksiz genişletiyordu. */
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 15px; }

/* Grid içindeki alanlar kendi alt boşluklarını taşımasın; ritmi gap kurar */
.row3 .field { margin-bottom: 0; }

/* Tutar alanı: para birimi soneki input'un içinde */
.affix { position: relative; }
.affix input { padding-right: 46px; }

.affix-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    pointer-events: none;
}

/* Kart numarası alanının başlık satırı + marka rozeti */
.field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.card-brand {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--accent-ink);
    background: var(--accent-wash);
    border-radius: 5px;
    padding: 2px 7px;
    margin-bottom: 6px;
    opacity: 0;
    transition: opacity .15s ease;
}

.card-brand.on { opacity: 1; }

/* ---------- Butonlar ---------- */

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 650;
    font-size: 15px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color .12s ease, transform .06s ease;
}

button:hover { background: var(--accent-ink); }
button:active { transform: translateY(1px); }

button.secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink-soft);
}

button.secondary:hover {
    background: #f7f8fb;
    border-color: #cfd4de;
}

/* Çift gönderim kilidi (portal.js).
 * `opacity` KULLANILMAZ: butonun etiketini de soldurur ("Güvenli Öde" 3.89 → 2.24:1)
 * ve bu hâl 3D yönlendirme boyunca saniyelerce ekranda kalır. Bunun yerine koyu
 * "çalışıyor" zemini — beyaz metinle 8.16:1. */
button[disabled], button.busy {
    cursor: progress;
    background: var(--accent-ink);
}

/* İkincil buton kilitlenirse: `button[disabled]` (0,1,1) ile `button.secondary`
 * (0,1,1) aynı özgüllükte ve sonraki kazanırdı → mavi zemin üstünde koyu gri
 * etiket (1.56:1). Bugün tetiklenmiyor ama açıkça çözülüyor. */
button.secondary[disabled], button.secondary.busy {
    background: var(--surface);
    color: var(--ink-soft);
}

button.secondary.busy::before {
    border-color: rgba(60, 64, 81, .3);
    border-top-color: var(--ink-soft);
}

button.busy::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ---------- Bildirimler ---------- */

.error, .status {
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 14px;
}

.error { background: var(--bad-wash); border: 1px solid #f6ccd6; color: #a81f42; }
.status { background: var(--ok-wash); border: 1px solid #c3e0d1; color: var(--ok); }

.field-error { color: var(--bad); font-size: 12px; font-weight: 500; margin-top: 5px; }

.error.result-detail { margin-top: 16px; margin-bottom: 0; }

/* ---------- Bağlantılar / dipnot ---------- */

.links {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.links a { color: var(--accent); font-weight: 550; text-decoration: none; }
.links a:hover { color: var(--accent-ink); text-decoration: underline; }

.muted-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    margin: 16px 0 0;
    text-align: center;
}

/* Sayfa altı güvenlik satırı (kart dışında) */
.page-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.page-foot svg { width: 13px; height: 13px; flex: none; }

/* ---------- Ana sayfa eylem kutuları ---------- */

.actions { display: grid; gap: 10px; }

.action {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-decoration: none;
    color: inherit;
    transition: border-color .12s ease, background-color .12s ease;
}

.action:hover { border-color: var(--accent); background: #fbfdff; }

.action-icon {
    width: 38px;
    height: 38px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--accent-wash);
    color: var(--accent-ink);
}

.action-icon svg { width: 19px; height: 19px; }

.action-body { min-width: 0; }
.action-title { display: block; font-weight: 600; font-size: 14px; }
.action-desc { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.action-chev { margin-left: auto; color: #c2c7d3; flex: none; }
.action-chev svg { width: 16px; height: 16px; display: block; }
.action:hover .action-chev { color: var(--accent); }

/* Çıkış: ana eylemlerle aynı görsel ağırlıkta olmamalı */
.logout {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    text-align: center;
}

.logout button {
    margin-top: 0;
    width: auto;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 550;
    background: transparent;
    border-color: transparent;
    color: var(--slate);
}

/* border-color açıkça sıfırlanır: `button.secondary:hover` ile aynı özgüllükte
 * olduğu için oradaki gri kenarlık sızıyor ve buton hover'da "zıplıyordu". */
.logout button:hover { background: #f2f4f8; color: var(--ink); border-color: transparent; }

/* ---------- Geçmiş tablosu ---------- */

.history-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

table.history {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.history th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 8px 9px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.history td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

table.history tr:last-child td { border-bottom: 0; }
table.history tbody tr:hover { background: #fafbfd; }

.col-date, .col-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-amount, th.col-amount { text-align: right; }
.col-amount { font-weight: 600; }
.col-desc { color: var(--slate); }
.col-action, th.col-action { text-align: right; white-space: nowrap; }

table.history a { color: var(--accent); font-weight: 550; text-decoration: none; }
table.history a:hover { text-decoration: underline; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 650;
    white-space: nowrap;
}

.badge.ok { background: var(--ok-wash); color: var(--ok); }
.badge.bad { background: var(--bad-wash); color: #a81f42; }
.badge.warn { background: var(--warn-wash); color: #8a5200; }
.badge.muted { background: #eef0f4; color: var(--slate); }

/* ---------- Sonuç sayfası ---------- */

.hero { text-align: center; padding: 4px 0 2px; }

.hero .icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.hero .icon svg { width: 30px; height: 30px; }

.hero.ok .icon { background: var(--ok-wash); color: var(--ok); }
.hero.bad .icon { background: var(--bad-wash); color: var(--bad); }
.hero.warn .icon { background: var(--warn-wash); color: var(--warn); }

.hero h1 { font-size: 22px; margin-bottom: 8px; }
.hero.ok h1 { color: var(--ok); }
.hero.bad h1 { color: #a81f42; }

.hero p { margin: 5px 0; color: var(--slate); font-size: 14px; }
.hero p.transfer { color: var(--ok); font-weight: 600; }
.hero p.company { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 10px; }

dl.detail {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 11px 18px;
    background: #f8f9fc;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 18px;
    margin: 22px 0 0;
    font-size: 14px;
}

dl.detail dt { color: var(--muted); font-size: 13px; }

dl.detail dd {
    margin: 0;
    font-weight: 550;
    text-align: right;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}

dl.detail dd.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    font-weight: 400;
}

/* ---------- Sayfalama ---------- */

.pagination { margin-top: 18px; font-size: 13px; }

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pager-link {
    color: var(--accent);
    font-weight: 550;
    text-decoration: none;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    white-space: nowrap;
}

.pager-link:hover { border-color: var(--accent); background: var(--accent-wash); }

.pager-link.disabled {
    color: #b9c0cd;
    border-color: var(--line-soft);
    background: transparent;
    pointer-events: none;
}

.pager-status { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Dar ekran ---------- */

@media (max-width: 560px) {
    body { padding: 22px 14px 30px; justify-content: flex-start; }
    .card { padding: 24px 19px; border-radius: 12px; }
    h1 { font-size: 19px; }
    .hero h1 { font-size: 20px; }
    .row3 { gap: 9px; }
    table.history { font-size: 13px; }
    table.history th, table.history td { padding-left: 6px; padding-right: 6px; }
    dl.detail { padding: 15px; gap: 9px 12px; }
    .pager { flex-wrap: wrap; justify-content: center; }
    .pager-status { order: -1; width: 100%; text-align: center; }
}
