/* ============================================================
   QR Studio — sıcak & yumuşak tema
   Krem/bej zemin, yumuşak gölgeler, yuvarlak köşeler,
   turuncu/yeşil doğal vurgu. Tam responsive.
   ============================================================ */

:root {
    --bg: #f7f3ec;            /* krem zemin */
    --surface: #fffdf8;       /* panel yüzeyi */
    --surface-2: #fbf7ef;     /* iç yüzey (alanlar) */
    --line: #ece4d6;          /* yumuşak kenarlık */
    --line-strong: #ddd2bf;
    --text: #3a342b;          /* sıcak koyu kahve */
    --text-soft: #8c8475;
    --accent: #e07a3f;        /* terracotta turuncu */
    --accent-ink: #fffdf8;
    --accent-soft: #fbe9dc;
    --green: #5b8c5a;         /* doğal yeşil */
    --green-soft: #e6efe2;
    --shadow-sm: 0 2px 8px -2px rgba(95, 75, 45, 0.12);
    --shadow: 0 16px 40px -18px rgba(95, 75, 45, 0.28);
    --radius: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

:root[data-theme="dark"] {
    --bg: #211d18;
    --surface: #2b261f;
    --surface-2: #322c24;
    --line: #3d362c;
    --line-strong: #4a4236;
    --text: #f0e9dc;
    --text-soft: #a89d8a;
    --accent: #f0905a;
    --accent-ink: #211d18;
    --accent-soft: #3a2c22;
    --green: #84b27f;
    --green-soft: #2a3327;
    --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
    --shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
*, *::before, *::after { min-width: 0; } /* grid/flex çocuklarının taşmasını engelle */
html, body { height: 100%; }
html, body { max-width: 100%; overflow-x: hidden; } /* yatay taşma asla olmasın */
img, svg, video, canvas { max-width: 100%; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    transition: background .3s ease, color .3s ease;
}

/* yumuşak doku — çok hafif noktalı arka plan */
body::before {
    content: "";
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(var(--line) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .4;
}

svg { display: block; }

/* ---------- Üst bar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px clamp(16px, 4vw, 44px);
    max-width: 1140px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark {
    display: grid; place-items: center;
    width: 42px; height: 42px; border-radius: 13px;
    background: var(--accent); color: var(--accent-ink);
    box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }

.icon-btn {
    width: 44px; height: 44px; border-radius: 13px;
    border: 1px solid var(--line); background: var(--surface);
    color: var(--text-soft); cursor: pointer;
    display: grid; place-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, color .2s, border-color .2s;
}
.icon-btn:hover { transform: translateY(-2px); color: var(--accent); border-color: var(--line-strong); }
.icon-btn .i-moon { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-moon { display: block; }

/* ---------- Yerleşim ---------- */
.layout {
    max-width: 1140px; margin: 0 auto;
    padding: clamp(8px, 2vw, 20px) clamp(16px, 4vw, 44px) 56px;
    display: grid;
    grid-template-columns: 1.12fr 0.88fr;
    gap: 26px; align-items: start;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(22px, 3vw, 34px);
}

.panel-head h1 { font-size: clamp(23px, 3vw, 31px); margin: 0 0 8px; letter-spacing: -.02em; line-height: 1.2; }
.panel-head p { margin: 0 0 24px; color: var(--text-soft); font-size: 15px; }

/* ---------- Sekmeler ----------
   10+ modül var; tek satıra sığmazsa yatay kaydırılır. Sağ kenardaki
   yumuşak solma (fade) ipucu, kaydırılabilir devam olduğunu gösterir. */
.tabs {
    display: flex; gap: 6px; margin-bottom: 24px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md); padding: 6px;
    overflow-x: auto; scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* sağ/sol kenarda solma maskesi: kaydırma var ipucu */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}
.tabs::-webkit-scrollbar { height: 5px; }
.tabs::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.tab {
    flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start;
    border: 0; background: transparent; cursor: pointer;
    padding: 10px 14px; border-radius: 11px;
    font: inherit; font-weight: 600; font-size: 14px;
    color: var(--text-soft); transition: color .2s, background .2s;
    display: inline-flex; align-items: center; gap: 7px;
}
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--text); }
.tab.is-active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

/* ---------- Form alanları ---------- */
.fields { border: 0; margin: 0; padding: 0; display: grid; gap: 16px; }
.fields.is-hidden { display: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.field { display: grid; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field input, .field textarea, .field select {
    width: 100%; font: inherit; font-size: 15px;
    padding: 13px 15px; border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1.5px solid var(--line);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-soft); opacity: .55; }
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
/* aç/kapa anahtarı */
.toggle {
    display: flex; align-items: center; gap: 14px; cursor: pointer;
    padding: 14px 16px; border-radius: var(--radius-sm);
    background: var(--green-soft); border: 1px solid var(--line);
    margin-top: 2px;
}
.toggle-text { display: grid; gap: 2px; flex: 1; }
.toggle-text strong { font-size: 14px; font-weight: 600; }
.toggle-text small { font-size: 12px; color: var(--text-soft); line-height: 1.35; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
    flex: 0 0 auto; width: 44px; height: 26px; border-radius: 999px;
    background: var(--line-strong); position: relative; transition: background .2s;
}
.toggle-switch::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; border-radius: 50%; background: #fff;
    box-shadow: var(--shadow-sm); transition: transform .2s;
}
.toggle input:checked ~ .toggle-switch { background: var(--green); }
.toggle input:checked ~ .toggle-switch::after { transform: translateX(18px); }
.toggle input:focus-visible ~ .toggle-switch { box-shadow: 0 0 0 4px var(--accent-soft); }

.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238c8475' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; padding-right: 38px; }

/* ---------- Önizleme paneli ---------- */
.preview-panel { position: sticky; top: 20px; display: grid; gap: 22px; }
.qr-stage { display: grid; place-items: center; }
.qr-card {
    background: #fffdf8; border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px; display: grid; place-items: center;
    width: 100%; max-width: 316px; aspect-ratio: 1;
    box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.qr-canvas { display: grid; place-items: center; width: 100%; height: 100%; }
.qr-canvas svg, .qr-canvas canvas, .qr-canvas img {
    width: 100% !important; height: 100% !important;
    max-width: 256px; max-height: 256px;
}
.qr-canvas:empty { display: none; }
.qr-hint {
    position: absolute; inset: 0; display: grid; place-items: center; gap: 10px;
    margin: 0; color: var(--text-soft); font-size: 14px; font-weight: 500;
    text-align: center; padding: 24px; align-content: center;
}
.qr-hint svg { width: 40px; height: 40px; opacity: .5; }
.qr-card.has-qr .qr-hint { display: none; }

/* ---------- Özelleştirme (renk / şekil / logo) ---------- */
.customize { display: grid; gap: 14px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.opt-row > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-soft); flex: 0 0 auto; }
.swatches { display: flex; gap: 9px; }

/* şekil seçici */
.styles { display: flex; gap: 8px; }
.style-opt {
    width: 38px; height: 38px; border-radius: 11px; cursor: pointer;
    border: 1.5px solid var(--line); background: var(--surface-2);
    color: var(--text-soft); display: grid; place-items: center;
    transition: all .15s;
}
.style-opt svg { width: 20px; height: 20px; }
.style-opt:hover { color: var(--text); border-color: var(--line-strong); }
.style-opt.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* logo kontrolü */
.logo-control { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo-btn {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 9px 13px; border-radius: 11px; max-width: 200px;
    border: 1.5px dashed var(--line-strong); background: var(--surface-2);
    color: var(--text-soft); font-size: 13px; font-weight: 600;
    transition: all .15s;
}
.logo-btn:hover { color: var(--accent); border-color: var(--accent); }
.logo-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.logo-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo-clear {
    width: 34px; height: 34px; border-radius: 10px; cursor: pointer; flex: 0 0 auto;
    border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text-soft);
    display: grid; place-items: center; transition: all .15s;
}
.logo-clear:hover { color: var(--accent); border-color: var(--accent); }
.logo-clear svg { width: 16px; height: 16px; }
.swatch {
    width: 30px; height: 30px; border-radius: 10px; cursor: pointer;
    background: var(--c); border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--line);
    transition: transform .15s, box-shadow .15s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }

/* ---------- Aksiyon butonları ---------- */
.actions { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; }
.btn {
    font: inherit; font-weight: 600; font-size: 15px;
    padding: 14px 18px; border-radius: var(--radius-sm);
    cursor: pointer; border: 1.5px solid transparent;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform .15s, box-shadow .2s, opacity .2s, background .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn-primary {
    background: var(--accent); color: var(--accent-ink);
    box-shadow: var(--shadow-sm);
}
.btn-primary:not(:disabled):hover { box-shadow: 0 12px 24px -10px var(--accent); }
.btn-ghost {
    background: var(--surface-2); color: var(--text);
    border-color: var(--line);
}
.btn-ghost:not(:disabled):hover { border-color: var(--line-strong); }
.btn-share {
    width: 100%; margin-top: 10px;
    background: var(--green-soft); color: var(--green);
    border-color: transparent;
}
.btn-share:not(:disabled):hover { box-shadow: 0 10px 22px -10px var(--green); }

/* ---------- Footer / Toast ---------- */
.footer {
    text-align: center; padding: 0 20px 40px; color: var(--text-soft); font-size: 13px;
    display: flex; align-items: center; justify-content: center; gap: 7px;
}
.footer svg { width: 15px; height: 15px; color: var(--green); }
.payload-out { word-break: break-all; font-size: 12px; color: var(--text-soft); }

.toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
    background: var(--text); color: var(--bg);
    padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
    box-shadow: var(--shadow); opacity: 0; pointer-events: none;
    transition: opacity .25s, transform .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ----------
   Yaklaşım: tek panel akışı geniş ekranda iki sütun, dar ekranda tek sütun;
   tüm satırlar gerektiğinde alt alta sarar; hiçbir şey viewport'u taşırmaz. */

/* Tablet ve altı: tek sütun, önizleme üstte */
@media (max-width: 880px) {
    .layout { grid-template-columns: 1fr; gap: 20px; }
    .preview-panel { position: static; order: -1; }
    .qr-card { max-width: 280px; }
    .topbar { flex-wrap: wrap; gap: 12px; }
    .topnav { order: 3; flex: 1 1 100%; justify-content: center; }
}

/* Büyük telefon */
@media (max-width: 560px) {
    .grid-2 { grid-template-columns: 1fr; }
    .actions { grid-template-columns: 1fr 1fr; }
    .panel { padding: 22px 18px; }
    /* özelleştirme satırları: etiket üstte, kontrol altta */
    .opt-row { flex-wrap: wrap; row-gap: 8px; }
    .opt-row > span:first-child { flex: 1 1 100%; }
    .opt-range { width: 100%; }
    .logo-btn { max-width: none; flex: 1; }
    .scan-controls { flex-direction: column; }
}

/* Küçük telefon */
@media (max-width: 380px) {
    .layout { padding-left: 12px; padding-right: 12px; }
    .panel { padding: 18px 14px; }
    .actions { grid-template-columns: 1fr; }
    .brand-text { font-size: 16px; }
    .field input, .field textarea, .field select { font-size: 16px; } /* iOS zoom'u engelle */
}

/* ============================================================
   Eklenenler: üst gezinme, ek özelleştirme, geçmiş, okuyucu
   ============================================================ */

/* ---------- Üst gezinme (Oluştur / Oku) ---------- */
.topnav { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line);
    padding: 4px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.nav-link { text-decoration: none; color: var(--text-soft); font-weight: 600; font-size: 14px;
    padding: 7px 16px; border-radius: 9px; transition: all .15s; }
.nav-link:hover { color: var(--text); }
.nav-link.is-active { background: var(--accent); color: var(--accent-ink); }

/* ---------- Ek özelleştirme satırları ---------- */
.opt-inline { display: flex; align-items: center; gap: 10px; }
.opt-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
    font-weight: 600; color: var(--text-soft); cursor: pointer; }
input[type="color"] { width: 34px; height: 34px; padding: 0; border: 1.5px solid var(--line);
    border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.opt-range { accent-color: var(--accent); width: 150px; }
.opt-select { padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line);
    background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px;
    font-weight: 600; cursor: pointer; }

/* ---------- Geçmiş ---------- */
.history { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.history-head > span { font-size: 13px; font-weight: 700; color: var(--text-soft);
    text-transform: uppercase; letter-spacing: .04em; }
.history-clear { background: none; border: none; color: var(--text-soft); font-size: 12px;
    font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.history-clear:hover { color: var(--accent); background: var(--accent-soft); }
.history-empty { font-size: 13px; color: var(--text-soft); margin: 0; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 280px; overflow-y: auto; }
.hist-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; transition: border-color .15s; }
.hist-item:hover { border-color: var(--accent); }
.hist-mini { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
    background: #fff; display: grid; place-items: center; }
.hist-mini svg { width: 100%; height: 100%; }
.hist-body { flex: 1 1 auto; min-width: 0; display: grid; }
.hist-body small { font-size: 11px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .03em; }
.hist-body strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-del { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; border: none;
    background: none; color: var(--text-soft); cursor: pointer; display: grid; place-items: center; }
.hist-del:hover { color: var(--accent); background: var(--accent-soft); }

/* ---------- Okuyucu (scan.php) ---------- */
.scan-layout { max-width: 560px; margin: 0 auto; padding: clamp(16px, 4vw, 32px); }
.scan-stage { position: relative; aspect-ratio: 1; max-width: 420px; margin: 18px auto 0;
    border-radius: var(--radius-md); overflow: hidden; background: #1a1712;
    box-shadow: var(--shadow); }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 14%; border: 3px solid rgba(255,255,255,.85);
    border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.18); pointer-events: none; }
.scan-status { text-align: center; color: var(--text-soft); font-size: 14px; min-height: 20px; margin: 14px 0 0; }
.scan-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.scan-controls .btn { flex: 1 1 auto; justify-content: center; }
.scan-result { margin-top: 20px; }
.scan-hit { border: 1px solid var(--line); border-radius: var(--radius-md);
    background: var(--surface-2); padding: 18px; }
.scan-kind { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 10px; }
.scan-emoji { font-size: 20px; }
.scan-value { margin: 0 0 14px; padding: 12px; border-radius: 10px; background: var(--surface);
    border: 1px solid var(--line); font-size: 13px; white-space: pre-wrap; word-break: break-all;
    max-height: 180px; overflow-y: auto; font-family: ui-monospace, "Cascadia Code", monospace; }
.scan-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.top-actions{
    display:flex;
    align-items:center;
    gap:8px;
}

.lang-form{
    margin:0;
}

.lang-select{
    height:38px;
    border:1px solid var(--border);
    border-radius:999px;
    background:var(--panel);
    color:var(--text);
    padding:0 10px;
    font:inherit;
    font-size:13px;
    cursor:pointer;
}
