/* qr-scanner/style.css — Minimal White Design System */

:root {
  --bg-page: #fafafa;
  --bg-card: #ffffff;
  --bg-sub: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-blue-bg: #eff6ff;
  --accent-green: #059669;
  --accent-green-bg: #ecfdf5;
  --accent-dark: #18181b;
  --accent-dark-hover: #27272a;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Reset & Cursor Hide ─────────────────────────── */
*, *::before, *::after, html, body, button, input, select, textarea, label, a {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: none !important;
}

button { font-family: inherit; border: none; background: none; }
input { font-family: inherit; }

/* ── Custom Cursor (Lag-Free Absolute Matching) ──── */
#shift-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  width: 20px;
  height: 20px;
  transition: width 0.13s, height 0.13s;
  left: -50px;
  top: -50px;
}
#shift-cursor svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 5px rgba(37,99,235,0.5));
  transition: filter 0.13s, transform 0.12s;
}
#shift-cursor.hover { width: 24px; height: 24px; }
#shift-cursor.hover svg { filter: drop-shadow(0 0 10px rgba(59,130,246,0.85)); }
#shift-cursor.click svg { transform: scale(0.85); }

#shift-trail {
  position: fixed;
  pointer-events: none;
  z-index: 99998;
  width: 14px;
  height: 14px;
  opacity: 0.35;
  transition: left 0.18s ease-out, top 0.18s ease-out;
  left: -50px;
  top: -50px;
}
#shift-trail svg { width: 100%; height: 100%; }

/* Hide custom cursor on mobile / touch devices */
@media (hover: none), (pointer: coarse) {
  *, *::before, *::after, html, body, button, input, select, textarea, label, a {
    cursor: auto !important;
  }
  #shift-cursor, #shift-trail {
    display: none !important;
  }
}

/* ── Page Layout Shell ───────────────────────────── */
body {
  background: var(--bg-page);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 60px;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.page-container {
  width: 100%;
  max-width: 940px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── TOP NAVIGATION ───────────────────────────── */
.top-nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 99px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.btn-back:hover {
  color: var(--text-main);
  border-color: var(--text-main);
  transform: translateY(-1px);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
}
.brand-icon {
  width: 28px;
  height: 28px;
  background: var(--text-main);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
}

/* ── TOOL CARD SHELL ───────────────────────────── */
.tool-card {
  width: 100%;
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--border-light);
  box-shadow:
    0 4px 6px rgba(0,0,0,0.02),
    0 12px 32px rgba(0,0,0,0.05);
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  min-height: 520px;
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
}

.app-main {
  display: flex;
  flex-direction: column;
  padding: 34px 38px 30px;
  min-width: 0;
}
@media (max-width: 640px) {
  .app-main { padding: 22px 18px 22px; }
}

/* Header */
.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 600px) {
  .app-header { flex-direction: column; gap: 12px; }
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-blue-bg);
  padding: 4px 11px;
  border-radius: 99px;
  margin-bottom: 8px;
}
.header-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: pulse-blue 2s infinite;
}
@keyframes pulse-blue {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.header-badge span {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  letter-spacing: 0.02em;
}
.app-header h1 {
  font-size: 24px;
  font-weight: 300;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.app-header h1 strong { font-weight: 700; }
.app-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Mode Switcher */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f4f4f5;
  border-radius: 10px;
  padding: 3px;
  flex-shrink: 0;
}
.mode-btn {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  white-space: nowrap;
}
.mode-btn.active {
  background: #fff;
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Source Switcher (Camera vs Upload) */
.source-nav {
  display: flex;
  background: #f4f4f5;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
  width: 100%;
}
.source-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}
.source-tab-btn:hover { color: var(--text-main); }
.source-tab-btn.active {
  background: #fff;
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Scanner Stage */
.scanner-container {
  position: relative;
  background: var(--bg-sub);
  border: 1.5px solid var(--border-light);
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  width: 100%;
  transition: border-color 0.2s;
}
@media (max-width: 600px) {
  .scanner-container { aspect-ratio: 1 / 1; }
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
#scanner-canvas { display: none; }

/* Camera Placeholder */
.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}
.cam-start-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-blue-bg);
  border: 1px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
}
.cam-start-btn {
  background: var(--accent-dark);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 99px;
  transition: all 0.15s;
}
.cam-start-btn:hover {
  background: var(--accent-dark-hover);
  transform: translateY(-1px);
}
.cam-start-sub {
  font-size: 11.5px;
  color: var(--text-sub);
}

/* Overlay & Reticle */
.scanner-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.reticle {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (max-width: 600px) {
  .reticle { width: 160px; height: 160px; }
}
.reticle.barcode-mode {
  width: 260px;
  height: 120px;
}
@media (max-width: 600px) {
  .reticle.barcode-mode { width: 220px; height: 100px; }
}

.reticle-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--accent-blue);
  border-style: solid;
  border-width: 0;
}
.reticle-corner.tl { top: 0; left: 0; border-top-width: 3.5px; border-left-width: 3.5px; border-top-left-radius: 8px; }
.reticle-corner.tr { top: 0; right: 0; border-top-width: 3.5px; border-right-width: 3.5px; border-top-right-radius: 8px; }
.reticle-corner.bl { bottom: 0; left: 0; border-bottom-width: 3.5px; border-left-width: 3.5px; border-bottom-left-radius: 8px; }
.reticle-corner.br { bottom: 0; right: 0; border-bottom-width: 3.5px; border-right-width: 3.5px; border-bottom-right-radius: 8px; }

.laser-line {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 2px;
  background: linear-gradient(90deg, rgba(239,68,68,0) 0%, #ef4444 50%, rgba(239,68,68,0) 100%);
  box-shadow: 0 0 8px #ef4444;
  animation: laser-sweep 2.4s ease-in-out infinite alternate;
}
@keyframes laser-sweep {
  0% { top: 8px; opacity: 0.7; }
  50% { opacity: 1; }
  100% { top: calc(100% - 10px); opacity: 0.7; }
}

.scanner-hint-badge {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  color: #1e293b;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  white-space: nowrap;
}

/* Floating Controls */
.cam-controls-bar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  gap: 6px;
  z-index: 10;
}
.cam-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.cam-action-btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  transform: scale(1.06);
}
.cam-action-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

/* Dropzone */
.dropzone-view {
  display: none;
  width: 100%;
  height: 100%;
  background: #fafafa;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 28px 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.2s;
}
.dropzone-view.dragover {
  border-color: var(--accent-blue);
  background: var(--accent-blue-bg);
}
.drop-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.drop-main-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
}
.drop-sub-text {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.browse-file-btn {
  background: var(--accent-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 99px;
  transition: all 0.15s;
}
.browse-file-btn:hover {
  background: var(--accent-dark-hover);
  transform: translateY(-1px);
}

/* Result Card */
.result-card {
  background: #fafafa;
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  transition: border-color 0.2s;
}
.result-card:hover { border-color: #cbd5e1; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.result-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--accent-green-bg);
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-green);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.result-format-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.result-content-box {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-main);
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.5;
  user-select: all;
  max-height: 110px;
  overflow-y: auto;
  width: 100%;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}
.action-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dark);
  color: #fff;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.action-btn-primary:hover {
  background: var(--accent-dark-hover);
  transform: translateY(-1px);
}
.action-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid var(--border-light);
  color: #334155;
  padding: 7px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.action-btn-secondary:hover {
  border-color: var(--accent-dark);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

/* ── Sidebar ── */
.app-sidebar {
  border-left: 1px solid var(--border-subtle);
  padding: 30px 20px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
@media (max-width: 860px) {
  .app-sidebar { display: none !important; }
}

.sb-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 12px;
}
.sb-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.sb-stat-box {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 10px;
}
.sb-stat-val { font-size: 14px; font-weight: 700; color: var(--text-main); }
.sb-stat-lbl { font-size: 9px; color: var(--text-sub); text-transform: uppercase; font-weight: 600; }

.sb-hr { border: none; border-top: 1px solid var(--border-light); margin: 14px 0; }

.sb-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.history-item {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.15s;
}
.history-item:hover { border-color: var(--accent-dark); }
.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.history-tag {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  padding: 1px 5px;
  border-radius: 4px;
}
.history-time { font-size: 9px; color: var(--text-sub); }
.history-text {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.format-chip {
  font-size: 9px;
  font-weight: 600;
  color: #475569;
  background: #fff;
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ══ SEO & EDUCATIONAL SECTION ════════════════════════ */
.seo-wrapper {
  border-top: 1px solid var(--border-subtle);
  background: #fff;
  padding: 40px 36px 46px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
@media (max-width: 640px) {
  .seo-wrapper { padding: 26px 18px 32px; gap: 24px; }
}

.seo-block-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin-bottom: 6px;
}
.seo-heading {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 10px;
}
@media (max-width: 600px) { .seo-heading { font-size: 18px; } }
.seo-desc { font-size: 13.5px; color: #475569; line-height: 1.65; }

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 860px) { .how-grid { grid-template-columns: 1fr; } }

.how-card {
  background: var(--bg-sub);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.how-step {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  width: fit-content;
  padding: 2px 7px;
  border-radius: 5px;
}
.how-title { font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.how-text { font-size: 12px; color: #475569; line-height: 1.55; }

.terms-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 640px) { .terms-grid { grid-template-columns: 1fr; } }

.term-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.term-header { display: flex; align-items: center; gap: 8px; }
.term-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.term-badge { font-size: 9px; font-weight: 600; text-transform: uppercase; background: #f1f5f9; color: var(--text-muted); padding: 2px 6px; border-radius: 4px; }
.term-desc { font-size: 12px; color: #475569; line-height: 1.55; }

.compare-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-top: 14px;
}
.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.compare-table th { background: var(--bg-sub); padding: 11px 14px; font-weight: 600; color: var(--text-main); border-bottom: 1px solid var(--border-light); white-space: nowrap; }
.compare-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); color: #475569; }
.compare-table tr:last-child td { border-bottom: none; }

.faq-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 14px;
}
.faq-item { border-bottom: 1px solid var(--border-light); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  background: #fff;
  transition: background 0.15s;
}
.faq-q:hover { background: var(--bg-sub); }
.faq-q svg { flex-shrink: 0; color: var(--text-sub); transition: transform 0.2s ease; }
.faq-q.active svg { transform: rotate(180deg); color: var(--text-main); }
.faq-a { display: none; padding: 0 18px 16px; font-size: 12.5px; color: #475569; line-height: 1.6; }
.faq-q.active + .faq-a { display: block; }

/* ── Footer ── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 4px 0;
  font-size: 11.5px;
  color: var(--text-sub);
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 14px;
  transition: color 0.15s;
}
.site-footer a:hover { color: var(--text-main); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--accent-dark);
  color: #fff;
  padding: 9px 18px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 99999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
