/* ════════════════════════════════════════════════════════════════════
   SÜRELİ KAREKOD + GERİ SAYIM (09.10.2026) — wwwroot/js/karekod-sayac.js'in çizdiği yapı:
   .ks > .ks-kutu (beyaz kutu: .ks-qr [.ks-qr-ciz = qrcodejs çizimi + .ks-logo = ortadaki firma logosu] + .ks-perde + .ks-yukleniyor)
        + .ks-sayac (.ks-cubuk + .ks-kalan) + .ks-hata
   Durum kök öğedeki data-durum ile: yukleniyor | gecerli | dolmus | hata. Son 5 sn: .ks-az (kırmızı, yanıp söner).
   İki yerde kullanılır: _Layout "QR Kodum" modalı (tema değişkenleri var, koyu tema dahil) ve Karekod.cshtml
   (Layout=null, değişken yok) → her renk var(--x, yedek) ile yazılır. QR kutusu HER temada beyaz (okuyucu kontrastı).
   Layout düzeyinde küçük parça → kendi dosyası (site.css'e yığılmaz; global kural). Boyut: JS --ks-boyut verir.
   ════════════════════════════════════════════════════════════════════ */
.ks {
    display: block;
    text-align: center;
    --ks-boyut: 220px;
}

.ks-kutu {
    position: relative;
    display: inline-block;
    padding: 14px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.12));
    line-height: 0;
}

.ks-qr {
    position: relative;          /* 10.10.2026: ortadaki logo kutusu (.ks-logo) buna göre konumlanır */
    display: block;
    width: var(--ks-boyut);
    height: var(--ks-boyut);
    max-width: 72vw;
    max-height: 72vw;
    line-height: 0;
    transition: filter .25s, opacity .25s;
}

    /* qrcodejs çizim hedefi (canvas + img). Logo KARDEŞ öğede (.ks-logo) → clear()/makeCode() logoya dokunmaz. */
    .ks-qr-ciz {
        width: 100%;
        height: 100%;
        line-height: 0;
    }

        .ks-qr-ciz img,
        .ks-qr-ciz canvas {
            display: block;
            width: 100%;
            height: 100%;
        }

/* FİRMA LOGOSU — karekodun TAM ORTASINDA (10.10.2026, kullanıcı isteği). Beyaz kutu + iç boşluk logoyu modüllerden ayırır
   (okuyucu örtülen modülleri "bozuk" sayar; hata düzeltme H ile %30'a kadar kayıp telafi edilir — kutu alanın ~%7'si).
   Boyut QR'a ORANLI (%26): 220 px modalda ~57 px, 280 px tam sayfada ~73 px. Logo yoksa JS kutuyu hiç çizmez (karekod-sayac.js).
   .ks-qr'ın içinde olduğu için süre dolunca/yüklenirken QR ile birlikte bulanıklaşır. */
.ks-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26%;
    height: 26%;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    padding: 4px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

    .ks-logo img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

/* Süre dolunca / üretilirken / hatada: QR bulanık + soluk (okunamaz), üstünde perde */
.ks[data-durum="dolmus"] .ks-qr,
.ks[data-durum="yukleniyor"] .ks-qr,
.ks[data-durum="hata"] .ks-qr {
    filter: blur(7px);
    opacity: .25;
}

.ks-perde,
.ks-yukleniyor {
    display: none;
    position: absolute;
    inset: 0;
    border-radius: 16px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    line-height: 1.3;
    color: #1b2733;              /* perde beyaz kutunun üstünde → sabit koyu metin */
}

.ks[data-durum="dolmus"] .ks-perde { display: flex; }

.ks[data-durum="yukleniyor"] .ks-yukleniyor {
    display: flex;
    flex-direction: row;
    font-size: .9rem;
    color: #5a6b7b;
}

.ks-perde-ikon { font-size: 2rem; color: var(--red, #DC2626); }
.ks-perde-baslik { font-weight: 800; font-size: 1.05rem; }
.ks-perde-alt { font-size: .82rem; color: #5a6b7b; max-width: 230px; }

.ks-uret {
    margin-top: 8px;
    border: 0;
    border-radius: 12px;
    background: var(--red, #DC2626);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    padding: 10px 16px;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--red-gl, rgba(220,38,38,.25));
}

    .ks-uret:active { transform: scale(.97); }

/* Geri sayım: ince çubuk + "Kalan süre: 30 sn" */
.ks-sayac { margin-top: 12px; }

.ks-cubuk {
    height: 6px;
    border-radius: 3px;
    background: var(--s3, #E2E8F0);
    overflow: hidden;
    width: var(--ks-boyut);
    max-width: 72vw;
    margin: 0 auto 6px;
}

.ks-cubuk-dolu {
    height: 100%;
    width: 100%;
    border-radius: 3px;
    background: var(--grn, #16A34A);
    transition: width .25s linear, background .3s;
}

.ks-kalan { font-size: .88rem; color: var(--tx3, #64748B); }

    .ks-kalan b {
        color: var(--grn, #16A34A);
        font-variant-numeric: tabular-nums;
    }

.ks-az .ks-cubuk-dolu { background: var(--red, #DC2626); }

.ks-az .ks-kalan b {
    color: var(--red, #DC2626);
    animation: ks-vur .6s ease-in-out infinite alternate;
}

@keyframes ks-vur {
    from { opacity: 1; }
    to { opacity: .45; }
}

/* Perde / yükleme / hata varken sayaç satırı yer tutar ama görünmez (modal zıplamasın) */
.ks[data-durum="dolmus"] .ks-sayac,
.ks[data-durum="yukleniyor"] .ks-sayac,
.ks[data-durum="hata"] .ks-sayac { visibility: hidden; }

/* Hata satırı (token isteği başarısız) */
.ks-hata {
    display: none;
    margin-top: 10px;
    color: var(--red, #B02A37);
    font-weight: 600;
    font-size: .9rem;
}

.ks[data-durum="hata"] .ks-hata { display: block; }

.ks-tekrar {
    border: 1px solid var(--brd, #E2E8F0);
    background: var(--s2, #F1F5F9);
    color: inherit;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: .85rem;
    cursor: pointer;
    margin-left: 6px;
}

.ks-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #c8d2e0;
    border-top-color: var(--red, #DC2626);
    animation: ks-don .8s linear infinite;
    vertical-align: -3px;
    margin-right: 4px;
}

@keyframes ks-don {
    to { transform: rotate(360deg); }
}
