/**
 * ============================================================================
 *  PSİKOLOJİK ÖLÇEK TEST MOTORU — STİLLER  (olcek-motoru.css)
 * ============================================================================
 *  testler.css içindeki palet ile uyumludur:
 *    --t-primary: #835368 (erguvan moru), --t-accent: #e8976c (turuncu)
 *  Tek dosyada, dış bağımlılık olmadan çalışır (Tailwind gerekmez).
 * ---------------------------------------------------------------------------
 */

/* ---------- Değişkenler (fallback'li) ---------- */
:root {
    --pt-primary: #835368;
    --pt-primary-dark: #5e3a4c;
    --pt-primary-light: #a87290;
    --pt-accent: #e8976c;
    --pt-bg: #faf8f6;
    --pt-card: #ffffff;
    --pt-text: #1a1a2e;
    --pt-muted: #64748b;
    --pt-border: rgba(131, 83, 104, 0.10);
    --pt-radius: 22px;
    --pt-shadow: 0 10px 34px rgba(131, 83, 104, 0.10);

    /* Seviye renkleri */
    --pt-ok: #22c55e;
    --pt-hafif: #eab308;
    --pt-orta: #f59e0b;
    --pt-siddetli: #ef4444;
}

/* ---------- Kapsayıcı ---------- */
#psiko-test-app {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--pt-text);
    max-width: 760px;
    margin: 0 auto;
    padding: 0 0 40px;
}
#psiko-test-app *,
#psiko-test-app *::before,
#psiko-test-app *::after { box-sizing: border-box; }

/* ---------- Kart + giriş animasyonu ---------- */
.pt-card {
    background: var(--pt-card);
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius);
    padding: 40px 38px;
    box-shadow: var(--pt-shadow);
    position: relative;
    overflow: hidden;
}
.pt-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pt-primary), var(--pt-accent));
    opacity: .9;
}
.pt-in { animation: ptFade .45s cubic-bezier(.4, 0, .2, 1) both; }
@keyframes ptFade {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pt-eyebrow {
    display: inline-block;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pt-primary);
    background: rgba(131, 83, 104, .08);
    border: 1px solid rgba(131, 83, 104, .12);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.pt-card h1 {
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    font-weight: 900;
    line-height: 1.15;
    margin: 0 0 18px;
}

/* ---------- Meta çipleri ---------- */
.pt-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pt-chip {
    font-size: .76rem; font-weight: 700;
    color: var(--pt-primary-dark);
    background: rgba(232, 151, 108, .12);
    border: 1px solid rgba(232, 151, 108, .25);
    padding: 6px 12px; border-radius: 10px;
}
.pt-desc { font-size: .98rem; line-height: 1.7; color: var(--pt-muted); margin: 0 0 22px; }

/* ---------- Kutular (yönerge / ölçek / açıklama) ---------- */
.pt-box, .pt-scale, .pt-explain, .pt-subs {
    background: var(--pt-bg);
    border: 1px solid var(--pt-border);
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 18px;
}
.pt-box-title {
    font-size: .78rem; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; color: var(--pt-primary);
    margin-bottom: 8px;
}
.pt-box p, .pt-explain p { margin: 0; font-size: .93rem; line-height: 1.75; color: var(--pt-text); }

/* Likert ölçek açıklaması */
.pt-lk { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pt-lk li {
    display: flex; align-items: center; gap: 12px;
    font-size: .88rem;
}
.pt-lk .lk-dot {
    flex: 0 0 auto; width: 30px; height: 30px;
    display: grid; place-items: center;
    background: #fff; border: 2px solid var(--pt-primary);
    color: var(--pt-primary); font-weight: 800; font-size: .85rem;
    border-radius: 10px;
}
.pt-lk strong { display: block; color: var(--pt-text); font-size: .9rem; }
.pt-lk small { color: var(--pt-muted); font-size: .78rem; }

/* ---------- Uyarı (disclaimer) ---------- */
.pt-disclaimer {
    font-size: .82rem; line-height: 1.65;
    color: var(--pt-primary-dark);
    background: rgba(131, 83, 104, .06);
    border-left: 3px solid var(--pt-primary);
    padding: 12px 16px; border-radius: 0 12px 12px 0;
    margin-bottom: 22px;
}
.pt-disclaimer strong { color: var(--pt-primary); }

/* ---------- Butonlar ---------- */
.pt-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.pt-btn {
    font-family: inherit; font-size: .95rem; font-weight: 700;
    padding: 14px 26px; border-radius: 14px;
    border: 1px solid transparent; cursor: pointer;
    transition: transform .2s, box-shadow .2s, background .2s, opacity .2s;
    -webkit-tap-highlight-color: transparent;
}
.pt-btn:focus-visible { outline: 3px solid var(--pt-accent); outline-offset: 2px; }
.pt-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }
.pt-btn-primary {
    background: linear-gradient(135deg, var(--pt-primary), var(--pt-primary-light));
    color: #fff; box-shadow: 0 8px 22px rgba(131, 83, 104, .28);
}
.pt-btn-primary:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(131, 83, 104, .35); }
.pt-btn-ghost {
    background: #fff; color: var(--pt-primary);
    border-color: rgba(131, 83, 104, .25);
}
.pt-btn-ghost:not(:disabled):hover { background: rgba(131, 83, 104, .06); }
.pt-actions-wrap .pt-btn { flex: 1 1 200px; }

/* ================================================================
 *  QUIZ (Wizard) Ekranı
 * ================================================================ */
.pt-progress {
    height: 9px; background: rgba(131, 83, 104, .10);
    border-radius: 999px; overflow: hidden; margin-bottom: 16px;
}
.pt-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pt-primary), var(--pt-accent));
    border-radius: 999px;
    transition: width .45s cubic-bezier(.4, 0, .2, 1);
}
.pt-qhead {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .82rem; color: var(--pt-muted); margin-bottom: 14px;
}
.pt-qhead b { color: var(--pt-primary); font-size: 1rem; }
.pt-counter-right { font-weight: 600; }

.pt-qtext {
    font-size: clamp(1.15rem, 3.4vw, 1.5rem);
    font-weight: 800; line-height: 1.35;
    margin: 0 0 6px; color: var(--pt-text);
}
.pt-qhint { font-size: .84rem; color: var(--pt-muted); margin: 0 0 22px; }

/* Seçenek butonları */
.pt-opts { display: grid; gap: 12px; margin-bottom: 24px; }
.pt-opt {
    display: flex; align-items: center; gap: 16px;
    width: 100%; text-align: left;
    background: #fff; border: 2px solid var(--pt-border);
    border-radius: 16px; padding: 15px 18px;
    cursor: pointer; font-family: inherit;
    transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
}
.pt-opt:hover { border-color: rgba(131, 83, 104, .4); transform: translateX(4px); }
.pt-opt:focus-visible { outline: 3px solid var(--pt-accent); outline-offset: 2px; }
.pt-opt.is-active {
    border-color: var(--pt-primary);
    background: linear-gradient(135deg, rgba(131, 83, 104, .07), rgba(232, 151, 108, .07));
    box-shadow: 0 8px 22px rgba(131, 83, 104, .14);
}
.pt-opt-val {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: var(--pt-bg); border: 2px solid rgba(131, 83, 104, .2);
    border-radius: 12px;
    font-weight: 900; font-size: 1rem; color: var(--pt-primary);
    transition: all .2s;
}
.pt-opt.is-active .pt-opt-val {
    background: var(--pt-primary); color: #fff; border-color: var(--pt-primary);
}
.pt-opt-body { display: flex; flex-direction: column; gap: 2px; }
.pt-opt-label { font-weight: 700; font-size: .98rem; color: var(--pt-text); }
.pt-opt-hint  { font-size: .8rem; color: var(--pt-muted); }

/* Navigasyon */
.pt-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pt-nav-mid { flex: 1; text-align: center; }
.pt-ok { font-size: .82rem; font-weight: 700; color: var(--pt-ok); }
.pt-nav .pt-btn { min-width: 120px; }

/* İlerleme noktacıkları */
.pt-dots {
    display: flex; flex-wrap: wrap; gap: 5px;
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--pt-border);
    justify-content: center;
}
.pt-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: rgba(131, 83, 104, .18);
    transition: all .25s;
}
.pt-dot.is-done { background: rgba(131, 83, 104, .45); }
.pt-dot.is-now  { background: var(--pt-accent); transform: scale(1.5); }

/* ================================================================
 *  SONUÇ Ekranı
 * ================================================================ */
.pt-score { text-align: center; padding: 12px 0 22px; }
.pt-score-num {
    font-size: clamp(3rem, 12vw, 4.6rem);
    font-weight: 900; line-height: 1;
    color: var(--pt-primary);
}
.pt-score-max { font-size: .38em; font-weight: 700; color: var(--pt-muted); margin-left: 4px; }
.pt-score-badge {
    display: inline-block; margin-top: 14px;
    font-size: .95rem; font-weight: 800;
    padding: 10px 22px; border-radius: 999px; color: #fff;
}
.pt-score-sub { font-size: .85rem; color: var(--pt-muted); margin-top: 10px; }

/* Seviye renk sınıfları */
.sev-ok      { --lvl: var(--pt-ok); }
.sev-hafif   { --lvl: var(--pt-hafif); }
.sev-orta    { --lvl: var(--pt-orta); }
.sev-siddetli{ --lvl: var(--pt-siddetli); }
.pt-score-badge.sev-ok,
.pt-score-badge.sev-hafif,
.pt-score-badge.sev-orta,
.pt-score-badge.sev-siddetli { background: var(--lvl); }

/* Grafik çubuğu */
.pt-chart { margin-bottom: 8px; }
.pt-chart-track {
    height: 20px; background: rgba(131, 83, 104, .10);
    border-radius: 999px; overflow: hidden;
}
.pt-chart-fill {
    height: 100%; border-radius: 999px;
    background: var(--lvl, var(--pt-primary));
    transition: width .8s cubic-bezier(.4, 0, .2, 1);
}
.pt-chart-labels {
    display: flex; justify-content: space-between;
    font-size: .78rem; color: var(--pt-muted); margin-top: 8px;
}
.pt-chart-now b { color: var(--pt-primary); font-size: .95rem; }

/* Kesme noktaları şeridi */
.pt-bands { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 18px 0; }
.pt-band {
    text-align: center; padding: 10px 6px;
    border-radius: 12px; border: 1px solid var(--pt-border);
    background: var(--pt-bg);
    opacity: .5; transition: all .3s;
}
.pt-band.is-active {
    opacity: 1;
    background: color-mix(in srgb, var(--lvl) 12%, #fff);
    border-color: var(--lvl);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--lvl) 30%, transparent);
    transform: translateY(-3px);
}
.pt-band-range { display: block; font-size: .72rem; font-weight: 700; color: var(--pt-muted); }
.pt-band-label { display: block; font-size: .8rem; font-weight: 800; color: var(--lvl); margin-top: 2px; }

/* Açıklama kutusu renklendirmesi */
.pt-explain { border-left: 4px solid var(--lvl, var(--pt-primary)); }

/* Alt boyutlar */
.pt-sub-row { margin-bottom: 14px; }
.pt-sub-row:last-child { margin-bottom: 0; }
.pt-sub-head {
    display: flex; justify-content: space-between;
    font-size: .86rem; font-weight: 700; margin-bottom: 6px;
}
.pt-sub-val { color: var(--pt-muted); font-weight: 600; }
.pt-bar { height: 12px; background: rgba(131, 83, 104, .10); border-radius: 999px; overflow: hidden; }
.pt-bar-fill {
    height: 100%; border-radius: 999px;
    background: var(--lvl, var(--pt-primary));
    transition: width .9s cubic-bezier(.4, 0, .2, 1);
}

.pt-foot { font-size: .8rem; color: var(--pt-muted); line-height: 1.6; margin: 18px 0 0; text-align: center; }

/* Hata ekranı */
.pt-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    text-align: center; font-weight: 600;
}

/* ================================================================
 *  FORM MODU (tüm sorular tek sayfada — yerel, Coda'sız)
 * ================================================================ */

/* Ölçek başlık satırı (sabit sütun başlıkları) */
.pt-scale-row {
    display: flex; flex-wrap: wrap; gap: 10px 14px;
    font-size: .8rem; color: var(--pt-muted);
}
.pt-colhead { display: inline-flex; align-items: center; gap: 5px; }
.pt-colhead b {
    display: inline-grid; place-items: center;
    width: 20px; height: 20px; border-radius: 6px;
    background: rgba(131, 83, 104, .1); color: var(--pt-primary);
    font-size: .72rem; font-weight: 800;
}

/* Kimlik kutusu */
.pt-idbox {
    background: var(--pt-bg);
    border: 1px solid var(--pt-border);
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 20px;
}
.pt-idgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pt-field { display: flex; flex-direction: column; gap: 6px; }
.pt-label { font-size: .8rem; font-weight: 700; color: var(--pt-text); }
.pt-label b { color: var(--pt-siddetli); }
.pt-label small { color: var(--pt-muted); font-weight: 500; }
.pt-input {
    font-family: inherit; font-size: .92rem;
    padding: 12px 14px; border-radius: 12px;
    border: 2px solid var(--pt-border); background: #fff;
    color: var(--pt-text);
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
}
.pt-input:focus {
    outline: none;
    border-color: var(--pt-primary);
    box-shadow: 0 0 0 3px rgba(131, 83, 104, .12);
}
.pt-idnote { font-size: .76rem; color: var(--pt-muted); margin: 12px 0 0; line-height: 1.5; }

/* Form ilerleme */
.pt-form-progress { margin: 0 0 20px; }
.pt-fp-count { display: block; font-size: .84rem; color: var(--pt-muted); margin-bottom: 8px; }
.pt-fp-count b { color: var(--pt-primary); font-size: 1rem; }

/* Soru blokları */
.pt-fq-list { display: grid; gap: 14px; margin-bottom: 22px; }
.pt-fq {
    background: #fff;
    border: 1px solid var(--pt-border);
    border-radius: 16px;
    padding: 16px 18px;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.pt-fq.is-done {
    border-color: rgba(131, 83, 104, .3);
    background: linear-gradient(135deg, rgba(131, 83, 104, .04), rgba(232, 151, 108, .04));
}
.pt-fq-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.pt-fq-no {
    flex: 0 0 auto;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    background: var(--pt-bg); border: 1px solid rgba(131, 83, 104, .2);
    border-radius: 9px;
    font-weight: 800; font-size: .82rem; color: var(--pt-primary);
}
.pt-fq.is-done .pt-fq-no { background: var(--pt-primary); color: #fff; border-color: var(--pt-primary); }
.pt-fq-text { font-size: .98rem; font-weight: 600; line-height: 1.45; color: var(--pt-text); padding-top: 3px; }

/* Radyo seçenekleri */
.pt-fq-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-radio {
    position: relative;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px;
    border: 2px solid var(--pt-border);
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
    transition: border-color .18s, background .18s, transform .15s;
    user-select: none;
}
.pt-radio:hover { border-color: rgba(131, 83, 104, .4); transform: translateY(-1px); }
.pt-radio:focus-within { outline: 3px solid var(--pt-accent); outline-offset: 2px; }
.pt-radio.is-active {
    border-color: var(--pt-primary);
    background: linear-gradient(135deg, rgba(131, 83, 104, .07), rgba(232, 151, 108, .07));
}
.pt-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.pt-radio-dot {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(131, 83, 104, .35);
    background: #fff;
    transition: all .18s;
}
.pt-radio.is-active .pt-radio-dot {
    border-color: var(--pt-primary);
    background: var(--pt-primary);
    box-shadow: inset 0 0 0 2px #fff;
}
.pt-radio-num { font-weight: 800; font-size: .92rem; color: var(--pt-primary); }

/* Form hata + gönderim notu */
.pt-form-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    border-radius: 12px; padding: 12px 16px;
    font-size: .88rem; font-weight: 600; margin-bottom: 16px;
}
.pt-send-note {
    text-align: center; font-size: .88rem; font-weight: 700;
    border-radius: 12px; padding: 12px 16px; margin: 16px 0 0;
}
.pt-send-note.is-ok   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.pt-send-note.is-fail { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* "Online henüz çözülemiyor" ekranı */
.pt-unavailable { max-width: 760px; }
.pt-unavailable .pt-box { background: #fff; }

/* ================================================================
 *  Duyarlılık (mobil)
 * ================================================================ */
@media (max-width: 640px) {
    .pt-card { padding: 28px 20px; border-radius: 18px; }
    .pt-nav { flex-direction: row; }
    .pt-nav .pt-btn { min-width: 0; flex: 1; padding: 13px 14px; }
    .pt-nav-mid { display: none; }
    .pt-bands { grid-auto-flow: row; grid-auto-columns: auto; }
    .pt-band { display: flex; justify-content: space-between; align-items: center; }
    .pt-band-label { margin-top: 0; }
    .pt-actions .pt-btn { width: 100%; flex: 1 1 100%; }
    .pt-idgrid { grid-template-columns: 1fr; }
    .pt-fq-opts { gap: 6px; }
    .pt-radio { flex: 1 1 calc(50% - 6px); justify-content: center; }
}

/* ================================================================
 *  Yazdırma (PDF indirme penceresi)
 *  window.print() çağrıldığında sadece sonuç kartı basılır.
 * ================================================================ */
@media print {
    body * { visibility: hidden !important; }
    #psiko-test-app, #psiko-test-app * { visibility: visible !important; }
    #psiko-test-app { position: absolute; inset: 0; max-width: 100%; padding: 0; }
    .pt-card {
        box-shadow: none; border: 1px solid #ddd;
        page-break-inside: avoid; padding: 20px;
    }
    .pt-actions, .pt-foot, .pt-nav, .pt-dots { display: none !important; }
    .pt-chart-fill, .pt-bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .pt-score-badge, .pt-band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
