/* ============================================================================
 * QR Tools — styles.css
 * ==========================================================================*/
:root {
    --brand: #4f46e5;
    --brand-2: #818cf8;
    --brand-dark: #3730a3;
    --ink-1: #1b1d28;
    --ink-2: #5b6072;
    --line: #e7e9f0;
    --bg: #f6f7fb;
    --card: #ffffff;
    --ok: #18a058;
    --radius: 14px;
    --shadow-sm: 0 1px 3px rgba(20, 22, 40, .08);
    --shadow-md: 0 10px 30px rgba(20, 22, 40, .10);
    --maxw: 1120px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--ink-1);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
body.no-translate { visibility: hidden; opacity: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    font: inherit; font-weight: 600; cursor: pointer;
    padding: .7em 1.25em; border-radius: 10px; border: 1px solid transparent;
    background: #eef0f6; color: var(--ink-1); transition: .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--small { padding: .45em .85em; font-size: .9rem; border-radius: 9px; }
.btn--block { width: 100%; }
.btn--lg { padding: .9em 1.8em; font-size: 1.05rem; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* --- Header --- */
.sticky-header { position: sticky; top: 0; z-index: 50; }
.topbar { background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar__inner { max-width: var(--maxw); margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 9px; color: var(--brand); font-weight: 800; font-size: 1.2rem; }
.logo-text { color: var(--ink-1); }
.logo-text__accent { color: var(--brand); }
.nav { display: flex; gap: 4px; margin-left: 10px; flex: 1; }
.nav-link { padding: .5em .7em; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: .95rem; }
.nav-link:hover { background: #f1f2f7; color: var(--ink-1); }
.topbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.premium-badge { background: linear-gradient(120deg, #ffd56a, #ffb020); color: #5a3b00; font-weight: 700; font-size: .8rem; padding: .3em .7em; border-radius: 20px; }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--ink-1); }
.nav-drawer { display: none; flex-direction: column; gap: 6px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.nav-drawer.is-open { display: flex; }

/* --- Hero --- */
.hero { padding-top: 64px; padding-bottom: 40px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); }
.hero .lead { color: var(--ink-2); font-size: 1.15rem; max-width: 640px; margin: 0 auto 8px; }
.hero__trust { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; color: var(--ink-2); font-size: .95rem; margin-top: 14px; }

/* --- Tool grid --- */
.section { padding-top: 40px; padding-bottom: 40px; }
.section__title { text-align: center; font-size: 1.8rem; }
.section__subtitle { text-align: center; color: var(--ink-2); max-width: 600px; margin: 0 auto 28px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tool-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow-sm); transition: .2s; display: flex; flex-direction: column; gap: 8px;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #c7d2fe; }
.tool-card__icon { width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; color: var(--brand); background: #eef2ff; }
.tool-card__title { font-weight: 700; font-size: 1.1rem; }
.tool-card__desc { color: var(--ink-2); font-size: .92rem; }

/* --- Tool page --- */
.tool-hero { padding-top: 48px; padding-bottom: 18px; text-align: center; }
.tool-hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.tool-hero p { color: var(--ink-2); max-width: 560px; margin: 0 auto; }
.workspace { max-width: 760px; margin: 0 auto 50px; padding: 0 20px; }

.dropzone {
    background: var(--card); border: 2px dashed #d4d8e6; border-radius: var(--radius);
    padding: 48px 24px; text-align: center; cursor: pointer; transition: .18s; margin-top: 20px;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand); background: #f5f7ff; }
.dropzone__icon { font-size: 2.4rem; }
.dropzone__title { font-weight: 700; font-size: 1.15rem; margin-top: 8px; }
.dropzone__hint { color: var(--ink-2); font-size: .92rem; }
.dropzone input[type=file] { display: none; }

.filelist { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 8px; }
.fileitem {
    display: flex; align-items: center; gap: 12px; background: var(--card);
    border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow-sm);
}
.fileitem__handle { cursor: grab; color: var(--ink-2); font-size: 1.1rem; }
.fileitem.dragging { opacity: .5; }
.fileitem__name { flex: 1; font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileitem__size { color: var(--ink-2); font-size: .85rem; }
.fileitem__remove { background: none; border: 0; cursor: pointer; color: var(--ink-2); font-size: 1.2rem; line-height: 1; }
.fileitem__remove:hover { color: var(--brand); }

.options { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 18px; box-shadow: var(--shadow-sm); }
.options h3 { font-size: 1.05rem; }
.field { margin-top: 12px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.field input[type=text], .field input[type=number], .field select {
    width: 100%; padding: .65em .8em; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: #fff;
}
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 6px; padding: .5em .8em; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-weight: 500; }
.radio-row input { accent-color: var(--brand); }

.action-bar { display: flex; justify-content: center; margin-top: 22px; }
.warn { background: #fff7ec; border: 1px solid #ffd98a; color: #8a5a00; padding: 10px 14px; border-radius: 10px; font-size: .9rem; margin-top: 14px; }
.progress { height: 8px; background: #eef0f6; border-radius: 6px; overflow: hidden; margin-top: 16px; }
.progress__bar { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.result { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center; margin-top: 22px; box-shadow: var(--shadow-sm); }
.result h3 { font-size: 1.3rem; }
.result .stat { color: var(--ink-2); margin: 6px 0 16px; }
.result .stat strong { color: var(--ok); }
.hidden { display: none !important; }

/* --- Modal / paywall --- */
.modal { position: fixed; inset: 0; background: rgba(20,22,40,.55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal.show { display: flex; }
.modal-content { background: #fff; border-radius: 18px; max-width: 440px; width: 100%; padding: 30px; position: relative; box-shadow: var(--shadow-md); }
.modal-content h2 { font-size: 1.5rem; }
.modal-desc { color: var(--ink-2); }
.close { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--ink-2); }
.paywall-bullets { list-style: none; padding: 0; margin: 16px 0; }
.paywall-bullets li { padding: 7px 0 7px 28px; position: relative; }
.paywall-bullets li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.payment-link-button {
    display: flex; align-items: center; justify-content: center; gap: .5em; width: 100%;
    background: var(--brand); color: #fff; font-weight: 700; padding: .9em; border-radius: 12px; margin-top: 8px;
    box-shadow: 0 6px 16px rgba(79,70,229,.3); transition: .18s;
}
.payment-link-button:hover { background: var(--brand-dark); }
.lock-icon { width: 18px; height: 18px; }
.payment-secure-note { text-align: center; color: var(--ink-2); font-size: .82rem; margin-top: 10px; }

/* --- Lead form --- */
.lead-offer { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 30px auto 0; max-width: 560px; text-align: center; box-shadow: var(--shadow-sm); }
.lead-form__row { display: flex; gap: 8px; margin-top: 10px; }
.lead-form__row input { flex: 1; padding: .7em .9em; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.lead-form__help { color: var(--ink-2); font-size: .82rem; margin-top: 8px; }
.lead-form__error { color: var(--brand); font-size: .85rem; }
.lead-form__success { color: var(--ok); font-size: .85rem; }

/* --- FAQ --- */
.faq { max-width: 760px; margin: 0 auto; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { color: var(--ink-2); margin: 10px 0 0; }

/* --- Footer --- */
.footer { background: #fff; border-top: 1px solid var(--line); margin-top: 40px; padding: 40px 20px 24px; }
.footer__tools { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px; }
.footer__col h4 { font-size: .95rem; }
.footer__col a { display: block; color: var(--ink-2); font-size: .9rem; padding: 3px 0; }
.footer__col a:hover { color: var(--brand); }
.footer__col--about p { color: var(--ink-2); font-size: .9rem; }
.footer__note { text-align: center; color: var(--ink-2); font-size: .85rem; margin-top: 28px; }

/* --- Responsive --- */
@media (max-width: 860px) {
    .nav { display: none; }
    .nav-toggle { display: block; }
    .nav-drawer.is-open { display: flex; }
}

@media (max-width: 600px) {
    .container { padding: 0 20px; }

    /* Header: tighter, declutter (Premium lives in the drawer on mobile) */
    .topbar__inner { padding: 10px 16px; gap: 10px; }
    .logo { font-size: 1.1rem; }
    .logo-icon svg { width: 26px; height: 26px; }
    #openPaywallFromHeader { display: none; }

    /* Hero / sections */
    .hero { padding-top: 36px; padding-bottom: 22px; }
    .hero .lead { font-size: 1.02rem; }
    .hero__trust { gap: 6px 16px; font-size: .9rem; }
    .section { padding-top: 30px; padding-bottom: 30px; }
    .section__title { font-size: 1.45rem; }
    .section__subtitle { font-size: .95rem; }
    .tool-hero { padding-top: 32px; padding-bottom: 12px; }

    /* Cards a touch tighter */
    .tool-grid { gap: 14px; }
    .tool-card { padding: 18px; }

    /* Tool workspace */
    .workspace { padding: 0 20px; }
    .dropzone { padding: 34px 16px; }
    .dropzone__icon { font-size: 2rem; }
    .dropzone__title { font-size: 1.05rem; }
    .options, .result { padding: 18px; }

    /* Radio groups stack vertically so long labels read well */
    .radio-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .radio-row label { justify-content: flex-start; }

    /* Modal / paywall */
    .modal { padding: 12px; }
    .modal-content { padding: 24px 18px; border-radius: 14px; }
    .modal-content h2 { font-size: 1.3rem; }

    /* Lead form: stacked, full-width button */
    .lead-offer { padding: 18px; }
    .lead-form__row { flex-direction: column; }
    .lead-form__row .btn { width: 100%; }

    /* Footer */
    .footer { padding: 30px 20px 22px; }
    .footer__tools { gap: 22px; }
}

@media (max-width: 400px) {
    .hero h1 { font-size: 1.7rem; }
    .section__title { font-size: 1.3rem; }
    .btn--lg { padding: .85em 1.2em; font-size: 1rem; }
    .logo-text { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ============================================================================
 * QR Tools — generator/reader specific
 * ==========================================================================*/
.gen-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; margin-top: 22px; }
.gen-controls { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.gen-preview {
    position: sticky; top: 86px; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); text-align: center;
}
.preview-stage {
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px;
    display: grid; place-items: center; min-height: 240px; overflow: hidden;
}
.preview-stage canvas, .preview-stage svg, .preview-stage img { max-width: 100%; height: auto; }
.preview-empty { color: var(--ink-2); font-size: .92rem; }
.download-row { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.field textarea {
    width: 100%; padding: .7em .8em; border: 1px solid var(--line); border-radius: 9px;
    font: inherit; background: #fff; resize: vertical; min-height: 96px;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; margin-top: 0; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type=color] { width: 44px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }

.premium-tag {
    display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .02em;
    background: linear-gradient(120deg, #ffd56a, #ffb020); color: #5a3b00;
    padding: .12em .5em; border-radius: 20px; margin-left: 6px; vertical-align: middle;
}

.result-text {
    width: 100%; box-sizing: border-box; padding: 14px; border: 1px solid var(--line);
    border-radius: 10px; background: #f8f9fc; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .92rem; white-space: pre-wrap; word-break: break-word; text-align: left; min-height: 60px;
}
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

.scanner { width: 100%; max-width: 360px; margin: 0 auto; border-radius: 12px; background: #000; display: none; }
.scanner.is-on { display: block; }

@media (max-width: 760px) {
    .gen-layout { grid-template-columns: 1fr; }
    .gen-preview { position: static; order: -1; }
}
