/* QR Code Scanner - Frontend Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Sora:wght@300;400;600&display=swap');

.qr-scanner-wrap * { box-sizing: border-box; }

/* ---- Card ---- */
.qrs-card {
    font-family: 'Sora', sans-serif;
    background: #0d0d0f;
    border: 1px solid #1e1e24;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
}

/* Light theme override */
.qr-scanner-wrap[data-theme="light"] .qrs-card {
    background: #f8f8fc;
    border-color: #e0e0ea;
    box-shadow: 0 8px 40px rgba(0,0,0,.08);
}
.qr-scanner-wrap[data-theme="light"] .qrs-title { color: #0d0d0f; }
.qr-scanner-wrap[data-theme="light"] .qrs-subtitle { color: #555; }
.qr-scanner-wrap[data-theme="light"] .qrs-status { background: rgba(255,255,255,.85); color: #333; }
.qr-scanner-wrap[data-theme="light"] .qrs-history-wrap { border-top-color: #e0e0ea; background: #fff; }
.qr-scanner-wrap[data-theme="light"] .qrs-history-list li { border-bottom-color: #eee; color: #333; }
.qr-scanner-wrap[data-theme="light"] .qrs-result-box { background: #f0faf4; border-color: #34d399; }
.qr-scanner-wrap[data-theme="light"] #qrs-result-text { color: #111; }

/* ---- Header ---- */
.qrs-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid #1e1e24;
}
.qrs-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #6c63ff 0%, #4fd1c5 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.qrs-icon svg { width: 22px; height: 22px; }
.qrs-title {
    margin: 0 0 2px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #f0f0f8;
    letter-spacing: -.01em;
}
.qrs-subtitle { margin: 0; font-size: .8rem; color: #888; }

/* ---- Viewport ---- */
.qrs-viewport {
    position: relative;
    background: #000;
    aspect-ratio: 4/3;
    overflow: hidden;
}
#qrs-video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Overlay ---- */
.qrs-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.qrs-crosshair {
    position: relative;
    width: min(55%, 220px);
    aspect-ratio: 1;
}
.corner {
    position: absolute;
    width: 24px; height: 24px;
    border-color: #6c63ff;
    border-style: solid;
}
.corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 3px 0 0 0; }
.corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 3px 0 0; }
.corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 3px; }
.corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 3px 0; }
.scan-line {
    position: absolute;
    left: 4px; right: 4px; height: 2px;
    background: linear-gradient(90deg, transparent, #6c63ff, #4fd1c5, #6c63ff, transparent);
    top: 0;
    animation: scanline 2s ease-in-out infinite;
    border-radius: 2px;
    opacity: .9;
}
@keyframes scanline {
    0%   { top: 4px; opacity: .6; }
    50%  { opacity: 1; }
    100% { top: calc(100% - 6px); opacity: .6; }
}

/* ---- Status ---- */
.qrs-status {
    position: absolute;
    bottom: 14px; left: 50%; transform: translateX(-50%);
    background: rgba(13,13,15,.75);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px;
    padding: 5px 14px;
    font-family: 'Space Mono', monospace;
    font-size: .7rem;
    color: #ccc;
    display: flex; align-items: center; gap: 7px;
    white-space: nowrap;
}
.qrs-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #888;
    animation: none;
}
.qrs-status.scanning .qrs-dot {
    background: #4fd1c5;
    animation: pulse-dot 1s ease-in-out infinite;
}
.qrs-status.detected .qrs-dot { background: #34d399; }
.qrs-status.error .qrs-dot    { background: #f87171; }
@keyframes pulse-dot {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .4; transform: scale(.7); }
}

/* ---- Camera select ---- */
.qrs-camera-select {
    position: absolute;
    top: 12px; right: 12px;
    background: rgba(13,13,15,.8);
    color: #ccc;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: .75rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

/* ---- Controls ---- */
.qrs-controls {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #1a1a20;
}

/* ---- Buttons ---- */
.qrs-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 20px;
    border: none; border-radius: 9px;
    font-family: 'Sora', sans-serif;
    font-size: .85rem; font-weight: 600;
    cursor: pointer;
    transition: all .18s ease;
}
.qrs-btn-primary {
    background: linear-gradient(135deg, #6c63ff 0%, #4fd1c5 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(108,99,255,.35);
}
.qrs-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,99,255,.45); }
.qrs-btn-secondary { background: #1e1e28; color: #ccc; }
.qrs-btn-secondary:hover { background: #26262f; }
.qrs-btn-icon { background: #1e1e28; color: #ccc; padding: 9px 12px; }
.qrs-btn-icon:hover { background: #26262f; color: #6c63ff; }
.qrs-btn-small { padding: 6px 14px; font-size: .78rem; border-radius: 7px; background: #1e1e28; color: #ccc; }
.qrs-btn-small:hover { background: #26262f; }
.qrs-btn-ghost { background: transparent; color: #888; }
.qrs-btn-ghost:hover { color: #f87171; background: rgba(248,113,113,.08); }

/* ---- Result box ---- */
.qrs-result-box {
    margin: 0 20px 16px;
    background: rgba(52,211,153,.07);
    border: 1px solid rgba(52,211,153,.3);
    border-radius: 10px;
    padding: 14px 16px;
    animation: slideIn .25s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.qrs-result-header {
    display: flex; align-items: center; gap: 8px;
    color: #34d399; margin-bottom: 8px;
    font-size: .85rem; font-weight: 600;
}
.qrs-badge {
    margin-left: auto;
    font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    background: rgba(108,99,255,.2); color: #9c96ff;
    padding: 2px 8px; border-radius: 4px;
}
.qrs-result-content {
    font-family: 'Space Mono', monospace;
    font-size: .82rem;
    word-break: break-all;
}
#qrs-result-text { margin: 0 0 10px; color: #e0e0f0; }
.qrs-result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Error box ---- */
.qrs-error-box {
    margin: 0 20px 16px;
    background: rgba(248,113,113,.08);
    border: 1px solid rgba(248,113,113,.3);
    border-radius: 10px;
    padding: 12px 16px;
    color: #fca5a5;
    font-size: .85rem;
}
.qrs-error-box p { margin: 0; }

/* ---- History ---- */
.qrs-history-wrap {
    border-top: 1px solid #1a1a20;
    padding: 16px 20px;
}
.qrs-history-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.qrs-history-header h3 {
    margin: 0;
    font-size: .85rem; font-weight: 600; color: #888;
    text-transform: uppercase; letter-spacing: .06em;
}
.qrs-history-list {
    list-style: none; margin: 0; padding: 0;
    max-height: 240px; overflow-y: auto;
}
.qrs-history-list li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #1a1a20;
    font-size: .82rem; color: #aaa;
    font-family: 'Space Mono', monospace;
}
.qrs-history-list li:last-child { border-bottom: none; }
.qrs-history-empty { justify-content: center; color: #555; font-family: 'Sora',sans-serif; }
.qr-hist-result { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.qr-hist-type { font-size: .68rem; background: #1e1e28; padding: 2px 6px; border-radius: 4px; color: #777; flex-shrink: 0; }
.qr-hist-time { font-size: .68rem; color: #555; flex-shrink: 0; }
