/* The generator was a standalone light-themed page. Its local variables now
   resolve to the shared tool tokens, so it follows the site palette and this
   tool's own accent (from tools_meta.json) instead of its old blue-on-white. */
:root {
    --primary: var(--sg-accent, #f73bc5);
    --primary-hover: var(--sg-accent-2, #5106fe);
    --bg-start: transparent;
    --bg-end: transparent;
    --card-bg: transparent;
    --text-main: var(--sg-ink, #f4f6fa);
    --text-muted: var(--sg-muted, rgba(230, 234, 245, .62));
    --border-color: var(--sg-border, rgba(255, 255, 255, .10));
    --input-bg: var(--sg-well, rgba(6, 8, 18, .85));
    --tab-bg: var(--sg-track, rgba(0, 0, 0, .28));
    --tab-active: var(--sg-chip-active, rgba(247, 59, 197, .14));
    --active-ring: var(--sg-accent, #f73bc5);
}

/* Scoped to the generator so it cannot restyle the shared header and footer,
   which is what the old bare `*` selector did. */
.qr-split *,
.qr-split *::before,
.qr-split *::after {
    box-sizing: border-box;
}

/* .tool-shell handles page layout and .tool-card draws the panel - the old
   full-viewport flex centring and 480px cap would fight both. */
.qr-split__preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

/* Empty state. The preview column sat blank until a code was generated, which
   read as a broken half of the panel rather than a waiting one. Toggled purely
   off the .show class the script already sets - no JS change. */
.qr-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 280px;
    padding: 2rem 1.5rem;
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    color: var(--text-muted);
    background: radial-gradient(62% 62% at 50% 45%, rgba(var(--sg-accent-rgb, 247, 59, 197), .10), transparent 70%);
}

.qr-empty i {
    font-size: 2.6rem;
    margin-bottom: 0.35rem;
    color: var(--primary);
    opacity: 0.55;
}

.qr-empty strong {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
}

.qr-empty span {
    max-width: 34ch;
    font-size: 0.85rem;
    line-height: 1.55;
}

#qrWrapper.show ~ .qr-empty {
    display: none;
}

.header {
    text-align: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header p {
    color: var(--text-muted);
    font-size: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="search"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 15px;
    /* Explicit line-height so inputs and selects resolve to the same box
       height; their intrinsic line boxes differ otherwise. */
    line-height: 20px;
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="search"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Fields inside a content panel use the same 12px rhythm as .input-group's gap.
   The panels are toggled with an inline display:block by updateInputFields(),
   so spacing is done with margins rather than flex gap. The fields are made
   block-level so no inline-block line-height leading is added to the margin. */
.content-inputs > * {
    display: block;
}

.content-inputs > * + * {
    margin-top: 12px;
}

button#generateBtn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

button#generateBtn:hover {
    background: var(--primary-hover);
}

/* Tabs System */
.tabs-container {
    margin-bottom: 24px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--tab-bg);
}

.tab-btn.active {
    background: var(--tab-active);
    color: var(--text-main);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Option Sections */
.option-section {
    margin-bottom: 20px;
}

.option-section > label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Visual Selectors (Dots, Markers) */
.visual-selectors {
    display: flex;
    gap: 12px;
}

.style-btn {
    background: var(--tab-bg);
    border: 2px solid transparent;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.style-btn:hover {
    background: var(--tab-active);
}

.style-btn.active {
    border-color: var(--text-main);
}

/* Color Swatches */
.color-swatches {
    display: flex;
    gap: 8px;
}

.color-swatch {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s;
}

.color-swatch:hover {
    transform: scale(1.05);
}

.color-swatch.active {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px white inset;
}

/* Custom Color Pickers */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.color-picker-wrapper span {
    font-size: 14px;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* Select Dropdown */
select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 15px;
    line-height: 20px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

/* QR Code Area */
/* The canvas is rendered at QR_RENDER_SIZE (see script.js) and displayed here at
   QR_DISPLAY_SIZE, so the browser always downsamples rather than stretching. */
#qrcode canvas,
#qrcode svg {
    display: block;
    width: 260px;
    max-width: 100%;
    height: auto;
}

.qr-wrapper {
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Stays white on purpose: a QR needs a light quiet zone to scan. */
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    margin: 0 auto;
    width: max-content;
    display: none;
    border: 1px solid var(--border-color);
    position: relative;
}

.qr-wrapper.show {
    display: flex;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 24px; }

/* Actions */
.action-buttons {
    margin-top: 24px;
    display: none;
    justify-content: center;
    gap: 12px;
}

.action-buttons.show {
    display: flex;
}

.secondary-btn {
    /* Was a white pill with dark text - unreadable once the page went dark. */
    background: var(--sg-chip, rgba(255, 255, 255, .03));
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: var(--tab-bg);
    border-color: var(--sg-border-strong, rgba(255, 255, 255, .16));
}

/* Reset carried its light-theme red inline; it is a variant now. */
.secondary-btn[data-role="reset"] {
    color: var(--sg-danger, #ef4444);
    border-color: color-mix(in srgb, var(--sg-danger, #ef4444) 40%, transparent);
}

.secondary-btn[data-role="reset"]:hover {
    border-color: var(--sg-danger, #ef4444);
}

/* Shake Animation */
.error-shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Frames */
.qr-wrapper.frame-bottom {
    padding-bottom: 60px;
}

.qr-wrapper.frame-bottom::after {
    content: "SCAN ME";
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    font-weight: bold;
    font-size: 24px;
    color: #000;
}

.qr-wrapper.frame-top {
    padding-top: 60px;
}

.qr-wrapper.frame-top::before {
    content: "CONNECT";
    position: absolute;
    top: 24px;
    left: 0;
    width: 100%;
    text-align: center;
    font-weight: bold;
    font-size: 24px;
    color: #000;
}

/* Mobile */
@media (max-width: 480px) {
    /* No body padding or .card rule here any more - .tool-shell sets the page
       gutter and .tool-card draws the panel, same as every other tool. Leaving
       them in inset this page 12px further than the rest of the suite. */

    /* The five tabs need more width than a phone gives them, so let them
       wrap instead of spilling outside the card. */
    .tabs {
        flex-wrap: wrap;
        gap: 6px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    .qr-wrapper {
        padding: 16px;
    }

    .action-buttons {
        flex-wrap: wrap;
        gap: 12px;
    }

    .secondary-btn {
        padding: 12px 18px;
    }
}
