/* tools/qr-maker.css
   QR code maker: the form card (the shared .tool-settings look) beside a
   live preview of the card, which stays in view on wide screens while the
   form scrolls. Phones: preview first, then the form. */

/* One editor row: the album's two fixed rows (culler.css) would leave an
   empty band under it. */
.tool-content.qr-page {
    grid-template-rows: auto auto;
}

.qr-page .qr-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.qr-page .qr-form {
    max-width: none;
    margin: 0;
}

.qr-page .qr-form .settings-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
}

.qr-page .qr-wide {
    grid-column: 1 / -1;
}

/* Text fields: same treatment as the selects in advanced-settings.css. */
.qr-page .qr-form input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: inherit;
    font-size: 0.9rem;
}

.qr-page .qr-form input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.38);
}

.qr-page .qr-form input[type="text"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.08);
}

.qr-page #qr-url {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88rem;
}

.qr-hint {
    margin: 6px 0 0;
    font-size: 0.76rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.6);
    overflow-wrap: anywhere;
}

.qr-hint:empty {
    display: none;
}

.qr-hint--warn {
    color: #fff;
    font-weight: 500;
}

.qr-hint[hidden] {
    display: none;
}

.qr-page .control-help a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Logo row */
.qr-logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.qr-logo-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: none;
}

.qr-logo-thumb[hidden] {
    display: none;
}

.qr-logo-thumb img {
    max-width: 36px;
    max-height: 36px;
    display: block;
}

.qr-page .btn-secondary {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    padding: 10px 16px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.qr-page .btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.5);
}

.qr-page .btn-secondary:disabled {
    opacity: 0.4;
    cursor: default;
}

.qr-page .btn-secondary[hidden],
.qr-text-btn[hidden] {
    display: none;
}

.qr-page .qr-small-btn {
    padding: 8px 14px;
}

.qr-text-btn {
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.75);
    font: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    padding: 4px;
}

/* Colour swatches */
.qr-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.qr-swatches button,
.qr-swatch-custom {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.qr-swatch-custom {
    position: relative;
    overflow: hidden;
    background: conic-gradient(#e5484d, #f5d90a, #30a46c, #0091ff, #8e4ec6, #e5484d);
}

.qr-swatch-custom input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: 0;
    padding: 0;
}

.qr-swatches button:hover,
.qr-swatch-custom:hover {
    transform: scale(1.08);
}

.qr-swatches .is-active {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.qr-swatches button:focus-visible,
.qr-swatch-custom:focus-within {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* Preview and downloads */
.qr-stage {
    position: sticky;
    top: 88px;
    background: var(--tile-fill, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--tile-border, rgba(255, 255, 255, 0.1));
    border-radius: var(--tile-radius, 16px);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
}

.qr-preview {
    position: relative;
    display: grid;
    place-items: center;
    padding: 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    min-height: 320px;
}

.qr-preview img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(62vh, 620px);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    transition: opacity 0.2s ease;
}

.qr-preview.is-example img {
    opacity: 0.55;
}

.qr-example {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-size: 0.78rem;
    font-weight: 600;
}

.qr-example[hidden] {
    display: none;
}

.qr-scan {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.qr-scan:empty {
    display: none;
}

.qr-downloads {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qr-size {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qr-size label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    flex: none;
}

.qr-size select {
    flex: 1;
    min-width: 0;
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 9px 34px 9px 12px;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    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 1.5 6 6.5 11 1.5' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.qr-size select option {
    background: #1D1B20;
    color: #fff;
}

.qr-page .qr-downloads .btn-action--full {
    margin-top: 0;
}

.qr-page .qr-downloads .btn-action:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}

.qr-dl-row {
    display: flex;
    gap: 10px;
}

.qr-dl-row .btn-secondary {
    flex: 1;
    min-width: 0;
}

/* Screenshots in the page copy */
.qr-figures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 8px 0 32px;
}

.qr-figures figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.qr-figures img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.qr-figures figcaption {
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.65);
}

@media (max-width: 900px) {
    .qr-page .qr-editor {
        grid-template-columns: minmax(0, 1fr);
    }

    .qr-stage {
        position: static;
        order: -1;
    }
}

@media (max-width: 560px) {
    .qr-page .qr-form .settings-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .qr-preview {
        min-height: 0;
        padding: 10px;
    }

    .qr-preview img {
        max-height: 56vh;
    }

    .qr-page .btn-action--lg {
        padding: 14px 20px !important;
        font-size: 1.05rem !important;
    }

    .qr-dl-row {
        flex-direction: column;
    }

    .qr-figures {
        grid-template-columns: minmax(0, 1fr);
    }
}
