/*
 * The tool card from the mockup (QRCheck.Client/Tool): Check and Create, built on the design system's tokens and zv-
 * components. Token names only. The one exception is the QR code itself, which is always black on white in both
 * themes: readers need dark modules on a light background, and the downloaded files look the same.
 */

.qc-tool {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    box-shadow: var(--shadow-md);
}

.qc-tool [hidden] {
    display: none !important;
}

.qc-tool button:disabled {
    cursor: default;
}

/* Check / Create: a segmented control (not in the design system yet, same as PasswordGenerator's). */
.qc-segmented {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: var(--space-1);
    border-radius: 10px;
    background: var(--surface-sunken);
    width: fit-content;
    max-width: 100%;
}

.qc-segmented a {
    font: inherit;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.qc-segmented a:hover {
    color: var(--ink);
}

.qc-segmented a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.qc-segmented a[aria-current="page"] {
    background: var(--surface-raised);
    color: var(--ink);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.qc-segmented .icon {
    width: 18px;
    height: 18px;
}

.qc-btn.zv-btn {
    min-height: 50px;
    padding: 0 22px;
    font-size: 16px;
}

.qc-btn.zv-btn-ghost {
    padding: 0 var(--space-3);
}

.qc-textarea.zv-input {
    min-height: 132px;
    line-height: 1.6;
}

.qc-note {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.qc-note .icon {
    margin-top: 3px;
}

.qc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.qc-plain-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--touch-min);
    font-size: 15px;
    cursor: pointer;
    width: fit-content;
}

.qc-plain-check input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--accent);
}

/* Promo: another Zavanto app, with its AppIcon (design: one suggestion in the flow). */
.qc-promo.zv-promo {
    gap: 14px;
    padding: var(--space-4) 18px;
    background: var(--surface-field);
}

.qc-promo-text {
    flex: 1 1 240px;
    font-size: 15px;
    line-height: 1.5;
}

.qc-promo .zv-btn {
    font-size: 15px;
}

/* ---------- Create ---------- */

.qc-create {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: 28px;
    align-items: start;
}

.qc-create-form,
.qc-create-result {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.qc-create-result {
    gap: var(--space-4);
}

/* "More options": a collapsed row that shows the current choices (design: Disclosure). */
.qc-options {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-field);
}

.qc-options summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: var(--touch-min);
    padding: 10px var(--space-4);
    border-radius: var(--radius-md);
}

.qc-options summary::-webkit-details-marker {
    display: none;
}

.qc-options-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.qc-options-title {
    font-size: 15px;
    font-weight: 600;
}

.qc-options-summary {
    font-size: 14px;
    color: var(--ink-muted);
}

.qc-options-chevron.icon {
    color: var(--accent-ink);
    transition: transform .15s;
}

.qc-options[open] .qc-options-chevron {
    transform: rotate(180deg);
}

.qc-options-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-1) var(--space-4) 18px;
}

.qc-options-label {
    font-size: 15px;
    font-weight: 600;
}

.qc-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: var(--space-6);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.qc-qr {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: var(--shadow-sm);
}

.qc-qr svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: black;
}

.qc-qr-meta {
    font-size: 13px;
    color: var(--ink-muted);
}

.qc-qr-empty {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--space-6);
    border: 2px dashed var(--line-control);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.qc-qr-empty .icon {
    width: 32px;
    height: 32px;
}

/* ---------- Check ---------- */

.qc-check,
.qc-check-form,
.qc-result {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.qc-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: var(--space-5);
}

/* Drop zone: a big target that opens the camera on phones (capture) and takes a dropped or pasted picture. */
.qc-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 196px;
    padding: var(--space-6);
    border: 2px dashed var(--line-control);
    border-radius: var(--radius-md);
    background: var(--surface-field);
    text-align: center;
    cursor: pointer;
    transition: background .1s;
}

.qc-drop:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.qc-drop[data-dragging] {
    border-style: solid;
    border-color: var(--accent);
    background: var(--accent-soft);
}

.qc-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.qc-drop-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--on-accent);
}

.qc-drop-icon .icon {
    width: 26px;
    height: 26px;
}

.qc-drop-title {
    font-size: 17px;
    font-weight: 700;
}

.qc-drop-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.qc-drop-over,
.qc-drop[data-dragging] .qc-drop-idle {
    display: none;
}

.qc-drop[data-dragging] .qc-drop-over {
    display: inline;
}

.qc-drop-note {
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.qc-paste {
    min-width: 0;
}

.qc-check-btn {
    align-self: flex-start;
}

.qc-error {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px var(--space-4);
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 15px;
    line-height: 1.5;
}

.qc-error .icon {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.qc-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--ink-muted);
}

.qc-example {
    font: inherit;
    display: flex;
    align-items: center;
    min-height: var(--touch-min);
    padding: 0 14px;
    border: 1px solid var(--line-control);
    border-radius: var(--radius-full);
    background: var(--surface-field);
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
}

.qc-example:not(:disabled):hover {
    border-color: var(--ink-muted);
}

/* Verdict: the worst finding decides the colour (status colours only mean ok, warning and danger). */
.qc-verdict {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px var(--space-5);
    border-radius: var(--radius-md);
}

.qc-verdict:focus {
    outline: none;
}

.qc-verdict:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.qc-verdict-ok { background: var(--success-soft); color: var(--success); }
.qc-verdict-warning { background: var(--warning-soft); color: var(--warning); }
.qc-verdict-danger { background: var(--danger-soft); color: var(--danger); }

.qc-verdict-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 2px solid currentColor;
}

.qc-verdict-icon .icon {
    width: 22px;
    height: 22px;
}

.qc-verdict-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: 15px;
    line-height: 1.5;
}

.qc-verdict-text strong {
    font-size: 21px;
    line-height: 1.3;
}

.qc-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.qc-content-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.qc-content-box {
    padding: 14px var(--space-4);
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* The host: the part of a link that decides where it goes. */
.qc-content-box mark {
    font-weight: 700;
    color: var(--ink);
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 0 3px;
}

.qc-findings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qc-findings li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 15px;
    line-height: 1.5;
}

.qc-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-top: 7px;
    border-radius: var(--radius-full);
}

.qc-dot-ok { background: var(--success); }
.qc-dot-warning { background: var(--warning); }
.qc-dot-danger { background: var(--danger); }

@media (max-width: 600px) {
    .qc-tool {
        padding: var(--space-5);
    }
}

@media (prefers-reduced-motion: reduce) {
    .qc-options-chevron.icon,
    .qc-drop {
        transition: none;
    }
}
