/* ═══════════════════════════════════════════════════════════
   QR TOOLBOX — Main Stylesheet
   Aesthetic: Industrial precision + modern dark theme
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ─── CSS Variables ──────────────────────────────────────── */
:root {
    --bg:        #f4f5f7;
    --bg2:       #ffffff;
    --bg3:       #f0f1f4;
    --bg4:       #e4e6eb;
    --border:    #d0d4dd;
    --border2:   #b8bcc8;
    --text:      #1a1d24;
    --text2:     #4a5068;
    --text3:     #8a90a4;
    --accent:    #1a56db;
    --accent2:   #1345b7;
    --accent-dim: rgba(26,86,219,.10);
    --secondary: #7c3aed;
    --success:   #0e9f6e;
    --danger:    #e02424;
    --mono:      'Space Mono', monospace;
    --display:   'Bebas Neue', sans-serif;
    --body:      'DM Sans', sans-serif;
    --radius:    6px;
    --radius2:   10px;
    --shadow:    0 4px 24px rgba(0,0,0,.10);
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Header ─────────────────────────────────────────────── */
.site-header {
    background: var(--bg2);
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.logo {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.logo-qr {
    font-family: var(--display);
    font-size: 2rem;
    color: var(--accent);
    letter-spacing: 2px;
    line-height: 1;
}
.logo-toolbox {
    font-family: var(--display);
    font-size: 1.6rem;
    color: var(--text);
    letter-spacing: 4px;
}
.logo-tag {
    font-family: var(--mono);
    font-size: .65rem;
    color: var(--text3);
    border: 1px solid var(--border2);
    padding: 1px 5px;
    border-radius: 3px;
}
.main-nav {
    display: flex;
    gap: 4px;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text2);
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all .2s;
}
.nav-btn svg { width: 15px; height: 15px; }
.nav-btn:hover { color: var(--text); border-color: var(--border2); background: var(--bg3); }
.nav-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* ─── Ticker ─────────────────────────────────────────────── */
.ticker {
    background: var(--accent);
    color: #ffffff;
    overflow: hidden;
    height: 32px;
    display: flex;
    align-items: center;
}
.ticker-track {
    display: flex;
    gap: 32px;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
    font-family: var(--mono);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}
.ticker .sep { opacity: .5; }
@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ─── Main Layout ────────────────────────────────────────── */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* ─── Tab system ─────────────────────────────────────────── */
.tab-panel { display: none; animation: fadeIn .3s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── Panel Grid ─────────────────────────────────────────── */
.panel-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }

/* ─── Panel boxes ────────────────────────────────────────── */
.config-panel, .preview-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 24px;
}
.panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text2);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.panel-num {
    background: var(--accent);
    color: #ffffff;
    width: 22px; height: 22px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ─── Type Grid ──────────────────────────────────────────── */
.type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text2);
    font-family: var(--mono);
    font-size: .62rem;
    letter-spacing: .5px;
    cursor: pointer;
    transition: all .18s;
}
.type-btn svg { width: 18px; height: 18px; }
.type-btn:hover { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }
.type-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ─── Form Fields ────────────────────────────────────────── */
.field-group { margin-bottom: 14px; }
.field-label {
    display: block;
    font-family: var(--mono);
    font-size: .65rem;
    letter-spacing: 1.5px;
    color: var(--text3);
    margin-bottom: 6px;
    text-transform: uppercase;
}
.field-input, .field-select {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--body);
    font-size: .88rem;
    padding: 9px 12px;
    outline: none;
    transition: border-color .18s;
    appearance: none;
}
.field-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235f6470'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}
.field-input:focus, .field-select:focus { border-color: var(--accent); }
.field-textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.content-form { animation: fadeIn .2s ease; }

/* ─── Options Grid ───────────────────────────────────────── */
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─── Color Pickers ──────────────────────────────────────── */
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.color-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 10px;
}
.color-input {
    width: 32px; height: 32px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
    padding: 0;
}
.color-val { font-family: var(--mono); font-size: .72rem; color: var(--text2); }

/* ─── Generate Button ────────────────────────────────────── */
.btn-generate {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #ffffff;
    font-family: var(--display);
    font-size: 1.1rem;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all .2s;
    margin-top: 20px;
}
.btn-generate:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,86,219,.3); }
.btn-generate:active { transform: none; }

/* ─── QR Preview ─────────────────────────────────────────── */
.qr-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 320px;
    justify-content: center;
    padding: 20px;
}
.qr-frame {
    background: white;
    border-radius: var(--radius2);
    padding: 16px;
    box-shadow: var(--shadow), 0 0 0 4px var(--accent);
    animation: qrAppear .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes qrAppear {
    from { transform: scale(.8) rotate(-3deg); opacity: 0; }
    to   { transform: scale(1) rotate(0); opacity: 1; }
}
.qr-img { display: block; max-width: 280px; height: auto; }
.qr-label-display {
    display: block;
    margin-top: 14px;
    font-family: var(--mono);
    font-size: .8rem;
    color: var(--text2);
    letter-spacing: 1px;
}
.qr-meta {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}
.meta-item {
    font-family: var(--mono);
    font-size: .62rem;
    letter-spacing: 1px;
    color: var(--text3);
    background: var(--bg3);
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid var(--border);
}
.qr-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    flex-wrap: wrap;
    justify-content: center;
}
.btn-action {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg3);
    color: var(--text2);
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all .18s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.btn-action:hover { color: var(--text); border-color: var(--border2); background: var(--bg4); }
.btn-dl { border-color: var(--success); color: var(--success); }
.btn-dl:hover { background: rgba(45,206,111,.1); }
.btn-save { border-color: var(--accent); color: var(--accent); }
.btn-save:hover { background: var(--accent-dim); }
.btn-copy { border-color: var(--secondary); color: var(--secondary); }
.btn-copy:hover { background: rgba(61,126,255,.1); }

/* ─── Placeholder ────────────────────────────────────────── */
.placeholder-inner {
    text-align: center;
    color: var(--text3);
}
.placeholder-icon { width: 80px; height: 80px; margin: 0 auto 16px; opacity: .3; }
.placeholder-inner p { font-family: var(--mono); font-size: .78rem; letter-spacing: 1px; line-height: 1.8; }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert-success, .alert-error {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: .5px;
}
.alert-success { background: rgba(45,206,111,.1); border: 1px solid var(--success); color: var(--success); }
.alert-error   { background: rgba(255,75,110,.1); border: 1px solid var(--danger); color: var(--danger); }

/* ─── Decode Tab ─────────────────────────────────────────── */
.decode-drop {
    border: 2px dashed var(--border2);
    border-radius: var(--radius2);
    padding: 40px 20px;
    text-align: center;
    color: var(--text2);
    transition: border-color .2s;
    position: relative;
}
.decode-drop:hover, .decode-drop.over { border-color: var(--accent); background: var(--accent-dim); }
.decode-drop svg { width: 48px; height: 48px; margin: 0 auto 12px; stroke: var(--text3); }
.decode-drop p { font-family: var(--mono); font-size: .78rem; margin-bottom: 8px; }
.decode-drop span { font-size: .72rem; color: var(--text3); }
.decode-drop input[type="file"] { position: absolute; opacity: 0; width: 0; height: 0; }
.btn-file {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all .18s;
}
.btn-file:hover { border-color: var(--accent); color: var(--accent); }
.input-btn-row { display: flex; gap: 8px; }
.input-btn-row .field-input { flex: 1; }
.btn-inline {
    padding: 9px 16px;
    background: var(--secondary);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: opacity .18s;
    white-space: nowrap;
}
.btn-inline:hover { opacity: .85; }
.btn-camera {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: .72rem;
    cursor: pointer;
    transition: all .18s;
}
.btn-camera svg { width: 16px; height: 16px; }
.btn-camera:hover { border-color: var(--secondary); color: var(--secondary); }
.decode-result {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 20px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.decode-placeholder { color: var(--text3); font-family: var(--mono); font-size: .78rem; text-align: center; }
.decode-content {
    width: 100%;
    font-family: var(--mono);
    font-size: .8rem;
    word-break: break-all;
    line-height: 1.8;
}
.decode-type-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent);
    color: var(--bg);
    border-radius: 3px;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

/* ─── Batch ──────────────────────────────────────────────── */
.batch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.batch-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    transition: border-color .18s;
}
.batch-card:hover { border-color: var(--accent); }
.batch-num { font-family: var(--mono); font-size: .62rem; color: var(--text3); margin-bottom: 6px; }
.batch-img { width: 100%; height: auto; border-radius: 4px; margin-bottom: 6px; }
.batch-content { font-family: var(--mono); font-size: .58rem; color: var(--text2); word-break: break-all; margin-bottom: 8px; }
.batch-error { border-color: var(--danger); }
.progress-bar { background: var(--bg4); border-radius: 999px; height: 6px; margin-bottom: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.batch-progress { text-align: center; font-family: var(--mono); font-size: .72rem; color: var(--text2); margin-bottom: 16px; }

/* ─── History ────────────────────────────────────────────── */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.btn-danger {
    padding: 7px 14px;
    background: transparent;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-family: var(--mono);
    font-size: .68rem;
    cursor: pointer;
    transition: all .18s;
}
.btn-danger:hover { background: rgba(255,75,110,.1); }
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}
.history-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 16px;
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 14px;
    align-items: center;
    transition: border-color .18s;
}
.history-card:hover { border-color: var(--border2); }
.hcard-img img { width: 80px; height: 80px; object-fit: contain; background: white; border-radius: 6px; padding: 4px; }
.hcard-type { font-family: var(--mono); font-size: .65rem; color: var(--accent); margin-bottom: 4px; }
.hcard-content { font-size: .8rem; color: var(--text2); word-break: break-all; margin-bottom: 6px; }
.hcard-label { font-family: var(--mono); font-size: .65rem; color: var(--text3); margin-bottom: 4px; }
.hcard-meta { display: flex; gap: 8px; }
.hcard-meta span { font-family: var(--mono); font-size: .6rem; color: var(--text3); }
.hcard-actions { display: flex; flex-direction: column; gap: 6px; }
.no-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--text3);
    font-family: var(--mono);
    font-size: .78rem;
}
.no-history small { display: block; margin-top: 8px; font-size: .7rem; }

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border);
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--text3);
    letter-spacing: 1.5px;
}
.site-footer .sep { color: var(--accent); margin: 0 8px; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg3); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── Hidden helpers ─────────────────────────────────────── */
.hidden-type { display: none; }
