/* ============================================================
   style/barcode-scanner.css
   Page-scoped styles for frontend/barcode-scanner.html.

   Prefixed .bcs- or scoped under body.bcs-page, so nothing leaks
   into the tool pages that share main.css. Panels, buttons and
   colours follow the QR Code Generator, which is the closest
   existing tool.
   ============================================================ */

body.bcs-page .pagebox {
    align-items: flex-start;
}

body.bcs-page .backtohome {
    position: relative;
    margin: 0 0 18px;
}

body.bcs-page .tool-area {
    padding-top: 12px;
    min-width: 0;
}

/* ── Page header ───────────────────────────────────────── */
.bcs-header { margin-bottom: 26px; }

.bcs-title {
    font-size: 34px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 10px;
    position: relative;
    padding-bottom: 12px;
}

.bcs-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 62px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #ff7a1a, #ff6600);
}

.bcs-sub {
    font-size: 16px;
    line-height: 1.65;
    color: #475569;
    max-width: 70ch;
}

/* ── Layout ────────────────────────────────────────────── */
.bcs-workspace {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 720px;
}

.bcs-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.05);
}

.bcs-panel-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 12px;
}

.bcs-lead {
    font-size: 14.5px;
    line-height: 1.7;
    color: #475569;
    margin-bottom: 16px;
}

.bcs-start-row {
    display: flex;
    gap: 10px;
}

/* ── Uploading a picture instead ───────────────────────── */

/* A rule with the word sitting on it, so the two ways in read as
   alternatives rather than as a list. */
.bcs-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.bcs-or::before,
.bcs-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.bcs-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 24px 18px;
    text-align: center;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.bcs-drop:hover,
.bcs-drop.is-over {
    background: #fff7ed;
    border-color: #ff7a1a;
}

/* The input inside is hidden, so the box carries the focus ring on its
   behalf when the input is reached by keyboard. */
.bcs-drop:focus-within {
    outline: 2px solid #ff7a1a;
    outline-offset: 2px;
}

.bcs-drop > i {
    font-size: 22px;
    color: #ff7a1a;
    margin-bottom: 2px;
}

.bcs-drop-main {
    font-size: 14.5px;
    font-weight: 700;
    color: #334155;
}

.bcs-drop-sub {
    font-size: 12.5px;
    line-height: 1.5;
    color: #64748b;
}

.bcs-file-busy {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
    padding: 11px 14px;
    border-radius: 9px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #075985;
    font-size: 13.5px;
    font-weight: 600;
}

/* The picture a result was read from, shown so it is obvious which
   image the number came out of. */
.bcs-shot {
    margin: 0 0 16px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-align: center;
}

.bcs-shot img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    margin: 0 auto;
    border-radius: 6px;
}

.bcs-privacy {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 16px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #475569;
}

.bcs-privacy i { color: #15803d; margin-top: 2px; }

/* A permission refusal or a missing camera is explained here, never in
   an alert box and never silently. */
.bcs-notice {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 9px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 13.5px;
    line-height: 1.6;
    font-weight: 600;
}

.bcs-notice.is-info {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #075985;
}

/* ── The live view ─────────────────────────────────────── */
.bcs-live-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.bcs-camera-pick { min-width: 190px; }

.bcs-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}

.bcs-select {
    width: 100%;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13.5px;
    color: #1e293b;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
}

.bcs-select:focus {
    outline: 2px solid #ff7a1a;
    outline-offset: 1px;
}

.bcs-stage {
    position: relative;
    margin-top: 12px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    /* Holds the frame's shape before the stream arrives, so the page
       does not jump when the camera opens. */
    aspect-ratio: 4 / 3;
}

.bcs-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0f172a;
}

/* The guide is decoration over the preview: it must never intercept a
   tap meant for the video beneath it. */
.bcs-guide {
    position: absolute;
    inset: 12% 8%;
    pointer-events: none;
}

.bcs-corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 3px solid #ff7a1a;
}

.bcs-tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.bcs-tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.bcs-bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.bcs-br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

.bcs-scanline {
    position: absolute;
    left: 6%;
    right: 6%;
    top: 50%;
    height: 2px;
    background: linear-gradient(90deg,
        rgba(255, 122, 26, 0), rgba(255, 122, 26, 0.95), rgba(255, 122, 26, 0));
    animation: bcs-sweep 2.4s ease-in-out infinite;
}

@keyframes bcs-sweep {
    0%, 100% { transform: translateY(-42px); }
    50%      { transform: translateY(42px); }
}

/* A sweeping line is decoration; someone who has asked for less motion
   still gets the frame, just still. */
@media (prefers-reduced-motion: reduce) {
    .bcs-scanline { animation: none; }
}

.bcs-hint-line {
    margin-top: 12px;
    font-size: 13.5px;
    line-height: 1.55;
    color: #475569;
    text-align: center;
    min-height: 21px;
}

/* ── A result ──────────────────────────────────────────── */
.bcs-found-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #15803d;
    margin-bottom: 14px;
}

.bcs-fields { margin: 0 0 4px; }

.bcs-fields dt {
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 4px;
}

.bcs-fields dd {
    margin: 0 0 14px;
    font-size: 15px;
    color: #1e293b;
}

.bcs-value {
    margin: 0;
    padding: 12px 14px;
    border-radius: 9px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #0f172a;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ── Buttons ───────────────────────────────────────────── */
.bcs-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.bcs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 18px;
    min-height: 44px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bcs-btn:hover:not(:disabled) {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #0369a1;
}

.bcs-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.bcs-btn-primary {
    color: #fff;
    background: #ff7a1a;
    border-color: #ff7a1a;
}

.bcs-btn-primary:hover:not(:disabled) {
    background: #ea6a0c;
    border-color: #ea6a0c;
    color: #fff;
}

.bcs-btn-reset:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #dc2626;
    color: #b91c1c;
}

.bcs-btn:focus-visible {
    outline: 2px solid #ff7a1a;
    outline-offset: 2px;
}

/* ── About ─────────────────────────────────────────────── */
.bcs-about p {
    font-size: 14.5px;
    line-height: 1.7;
    color: #475569;
    margin-bottom: 12px;
}

.bcs-about p:last-child { margin-bottom: 0; }
.bcs-about a { color: #0369a1; font-weight: 600; }

.bcs-support:empty { display: none; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1200px) {
    body.bcs-page .sidebar-ads { display: none; }
}

@media (max-width: 620px) {
    .bcs-title { font-size: 27px; }
    .bcs-sub { font-size: 15px; }
    .bcs-panel { padding: 18px; }

    /* A phone is the main way this tool gets used: the preview gets the
       taller shape a hand-held camera actually produces, and every
       control goes full width so it can be reached one-handed. */
    .bcs-stage { aspect-ratio: 3 / 4; }

    .bcs-camera-pick { min-width: 0; width: 100%; }
    .bcs-btn { flex: 1 1 100%; }
    .bcs-start-row .bcs-btn { flex: 1 1 100%; }
}
