/* ==========================================================================
   MultiScan - Mobile Barcode Scanner Stylesheet
   Modern Mobile-First Dark UI with Safe-Area & Glassmorphism
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-surface: #151c2c;
  --bg-surface-elevated: #1e283d;
  --bg-glass: rgba(15, 23, 42, 0.78);
  --bg-glass-heavy: rgba(11, 15, 25, 0.92);
  
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.16);
  --primary-glow: rgba(16, 185, 129, 0.4);

  --accent: #06b6d4;
  --accent-light: rgba(6, 182, 212, 0.16);

  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
}

/* Base App Layout */
.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Camera Viewport & AR Canvas
   ========================================================================== */
.viewport-section {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.camera-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 1;
}

.camera-wrapper canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  pointer-events: auto; /* Allow tapping on detected barcodes */
}

/* Scanning Reticle & Laser */
.scan-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(82vw, 320px);
  height: min(45vh, 260px);
  z-index: 3;
  pointer-events: none;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.32);
}

.reticle-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: var(--primary);
  border-style: solid;
}
.reticle-corner.tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-top-left-radius: 12px; }
.reticle-corner.tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-top-right-radius: 12px; }
.reticle-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-bottom-left-radius: 12px; }
.reticle-corner.br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-bottom-right-radius: 12px; }

.scan-laser-line {
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
  box-shadow: 0 0 12px var(--primary);
  animation: scanMotion 2.4s ease-in-out infinite alternate;
}

@keyframes scanMotion {
  0% { top: 6%; opacity: 0.3; }
  50% { opacity: 0.95; }
  100% { top: 94%; opacity: 0.3; }
}

/* Shutter Flash Animation */
.shutter-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}
.shutter-flash.active {
  animation: flashAnim 0.35s ease-out forwards;
}
@keyframes flashAnim {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* Placeholder when camera is inactive */
.camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}
.placeholder-icon {
  font-size: 56px;
  margin-bottom: 16px;
}
.camera-placeholder h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--text-main);
}
.camera-placeholder p {
  color: var(--text-muted);
  max-width: 300px;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ==========================================================================
   Top Floating Navigation Bar
   ========================================================================== */
.top-nav-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}

.top-nav-bar > * {
  pointer-events: auto;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulseDot 1.8s infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.engine-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(8px);
}

/* Center Counter Pill */
.counter-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.counter-pill:active {
  transform: scale(0.95);
  background: var(--bg-surface-elevated);
}
.counter-label {
  font-size: 12px;
  color: var(--text-muted);
}
.counter-num {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  min-width: 14px;
  text-align: center;
}
.counter-unit {
  font-size: 12px;
  color: var(--text-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Icon Buttons */
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: background 0.2s, transform 0.12s, border-color 0.2s;
}
.icon-btn:active {
  transform: scale(0.92);
  background: var(--bg-surface-elevated);
}
.icon-btn svg.icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  fill: none;
}
.icon-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow);
}

/* On-Screen Barcode Target HUD */
.hud-status {
  position: absolute;
  top: calc(var(--safe-top) + 68px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px 16px;
  backdrop-filter: blur(12px);
  pointer-events: none;
  max-width: 86vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease;
}
.hud-text {
  font-size: 12px;
  color: var(--text-main);
}
.hud-status.highlight {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.25);
}

/* Quick Zoom Controls */
.zoom-controls {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  backdrop-filter: blur(16px);
}
.zoom-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.zoom-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* ==========================================================================
   Camera Bottom Controls (Shutter, Mode, Drawer trigger)
   ========================================================================== */
.camera-bottom-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(0deg, rgba(11, 15, 25, 0.95) 0%, rgba(11, 15, 25, 0.6) 70%, transparent 100%);
  gap: 14px;
  pointer-events: none;
}
.camera-bottom-controls > * {
  pointer-events: auto;
}

/* Mode Tabs */
.mode-selector {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
}
.mode-tab {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}
.mode-tab:active {
  transform: scale(0.96);
}
.mode-tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Shutter Row */
.shutter-row {
  width: 100%;
  max-width: 360px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.sub-action-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: transform 0.12s, color 0.2s;
}
.sub-action-btn:active {
  transform: scale(0.9);
  color: #fff;
}
.sub-action-btn svg.icon {
  width: 26px;
  height: 26px;
}

.badge-dot {
  position: absolute;
  top: 2px;
  right: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 8px var(--primary-glow);
}

/* Camera Shutter Button */
.shutter-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.shutter-btn:active {
  transform: scale(0.93);
}

.shutter-btn-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Frozen state for shutter button */
.shutter-btn.frozen {
  border-color: var(--warning);
}
.shutter-btn.frozen .shutter-btn-inner {
  background: var(--warning);
  border-radius: 12px;
  transform: scale(0.72);
}

/* ==========================================================================
   Bottom Drawer (Scanned Barcodes List Sheet)
   ========================================================================== */
.list-drawer {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  max-height: 85dvh;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.55);
  border-top: 1px solid var(--border-subtle);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(100% - 0px));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: calc(var(--safe-bottom) + 12px);
}

.list-drawer.open {
  transform: translateY(0);
}

.drawer-drag-handle {
  width: 100%;
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
}
.drag-bar {
  width: 44px;
  height: 5px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.25);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 12px;
}
.drawer-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}
.drawer-count-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Quick Action Toolbar */
.drawer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.drawer-toolbar::-webkit-scrollbar {
  display: none;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tool-btn:active {
  transform: scale(0.95);
}
.tool-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tool-btn svg.icon {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  fill: none;
}

/* Search Box */
.search-box-row {
  padding: 0 20px 12px;
}
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 12px;
}
.search-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  margin-right: 8px;
  flex-shrink: 0;
  fill: none;
}
.search-input-wrapper input {
  width: 100%;
  height: 38px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
}
.search-input-wrapper input::placeholder {
  color: var(--text-dim);
}
.clear-search-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

/* Items List Container */
.items-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 16px;
  min-height: 220px;
  max-height: 52dvh;
  -webkit-overflow-scrolling: touch;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}
.empty-subtitle {
  font-size: 0.88rem;
  color: var(--text-dim);
  max-width: 280px;
}

/* Items List */
.items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: transform 0.12s, border-color 0.15s;
}
.item-card:active {
  transform: scale(0.99);
}
.item-card.just-added {
  border-color: var(--primary);
  animation: highlightNew 1.2s ease-out;
}
@keyframes highlightNew {
  0% { background: rgba(16, 185, 129, 0.25); }
  100% { background: var(--bg-surface-elevated); }
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  margin-right: 12px;
}

.item-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-format-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.item-count-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
}

.item-time {
  font-size: 11px;
  color: var(--text-dim);
}

.item-value {
  font-family: var(--font-mono);
  font-size: 14.5px;
  color: var(--text-main);
  word-break: break-all;
  font-weight: 500;
  cursor: pointer;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.item-action-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.item-action-btn:active {
  transform: scale(0.9);
  color: var(--text-main);
}
.item-action-btn.copied {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.item-action-btn.delete:hover,
.item-action-btn.delete:active {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}
.item-action-btn svg.icon {
  width: 16px;
  height: 16px;
  fill: none;
}

/* ==========================================================================
   Modals & Dialogs (<dialog closedby="any">)
   ========================================================================== */
dialog.app-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  padding: 0;
  background: transparent;
  max-width: 90vw;
  width: 440px;
  z-index: 100;
  outline: none;
}

dialog.app-dialog.modal-sm {
  width: 360px;
}

/* Modern backdrop with blur */
dialog.app-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.dialog-content {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 85dvh;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.dialog-title {
  font-size: 1.15rem;
  font-weight: 700;
}
.icon-btn-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.15s;
}
.icon-btn-sm:active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.dialog-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dialog-desc {
  color: var(--text-muted);
  line-height: 1.6;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

/* Form Controls in Dialog */
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setting-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}
.setting-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

.form-select {
  width: 100%;
  height: 42px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}
.form-select:focus {
  border-color: var(--primary);
}

.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toggle-info {
  display: flex;
  flex-direction: column;
}
.toggle-title {
  font-size: 14px;
  font-weight: 600;
}
.toggle-desc {
  font-size: 12px;
  color: var(--text-dim);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: .25s;
  border-radius: 34px;
}
.switch .slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}
.switch input:checked + .slider {
  background-color: var(--primary);
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* Slider Controls */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slider-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}
.form-range {
  width: 100%;
  accent-color: var(--primary);
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

/* Formats Grid */
.formats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  cursor: pointer;
}
.checkbox-chip input {
  accent-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:active {
  transform: scale(0.96);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn svg.icon {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* Detail Modal Box */
.detail-header-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-format-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
}
.detail-value-box {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}
.detail-value-text {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #fff;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
  line-height: 1.5;
}
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-lbl {
  font-size: 11.5px;
  color: var(--text-dim);
}
.meta-val {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
}
.detail-actions {
  flex-wrap: wrap;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 90px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 8px 20px;
  font-size: 13.5px;
  font-weight: 500;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 110;
  pointer-events: none;
  white-space: nowrap;
  animation: toastFade 0.25s ease-out;
}
@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Utility Hidden */
.hidden {
  display: none !important;
}
