/* ==========================================================================
   Geo QR Maps - Unified Design System & Styles
   ========================================================================== */

:root {
  /* Color Palette - Light Mode */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-surface-glass: rgba(255, 255, 255, 0.88);
  --bg-muted: #f1f5f9;
  --bg-hover: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: #e8f0fe;
  --primary-glow: rgba(26, 115, 232, 0.28);

  --accent-emerald: #10b981;
  --accent-emerald-light: #d1fae5;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  --border-subtle: #e2e8f0;
  --border-focus: #3b82f6;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 25px rgba(26, 115, 232, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 9999px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-surface-glass: rgba(17, 24, 39, 0.9);
  --bg-muted: #1e293b;
  --bg-hover: #334155;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-glow: rgba(59, 130, 246, 0.35);

  --accent-emerald: #10b981;
  --accent-emerald-light: rgba(16, 185, 129, 0.15);
  --accent-amber: #fbbf24;
  --accent-amber-light: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.15);

  --border-subtle: #243044;
  --border-focus: #60a5fa;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.3);
}

/* Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* Ambient glow blobs */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #3b82f6 0%, rgba(59, 130, 246, 0) 70%);
  top: -150px;
  left: -150px;
}

.bg-glow-2 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #10b981 0%, rgba(16, 185, 129, 0) 70%);
  bottom: -100px;
  right: -100px;
}

/* App Wrapper */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 18px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  position: relative;
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #1a73e8, #4285f4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.icon-map-pin {
  width: 26px;
  height: 26px;
}

.brand-badge-qr {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #10b981;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 4px;
  border: 2px solid var(--bg-surface);
  line-height: 1;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.btn-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon svg {
  width: 19px;
  height: 19px;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
}

/* ==========================================================================
   Master Mode Switcher (Scan & Find vs Pin & Create QR)
   ========================================================================== */

.master-mode-switcher {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 5px;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.master-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.master-tab svg {
  width: 18px;
  height: 18px;
}

.master-tab:hover {
  color: var(--text-primary);
  background: var(--bg-muted);
}

.master-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  box-shadow: 0 3px 10px var(--primary-glow);
}

/* ==========================================================================
   Main Cards & Common Panels
   ========================================================================== */

.main-card {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

/* Tabs */
.nav-tabs {
  display: flex;
  background: var(--bg-muted);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tab-icon {
  width: 17px;
  height: 17px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.upload-illustration {
  position: relative;
  width: 60px;
  height: 60px;
}

.illustration-circle {
  width: 100%;
  height: 100%;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.icon-upload {
  width: 28px;
  height: 28px;
}

.illustration-badge {
  position: absolute;
  bottom: 0;
  right: -2px;
  width: 22px;
  height: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.illustration-badge svg {
  width: 12px;
  height: 12px;
}

.dropzone-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dropzone-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.paste-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.key-shortcut {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Quick Bar */
.quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  justify-content: center;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-pill svg {
  width: 15px;
  height: 15px;
}

.btn-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-pill-accent {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.25);
}

.btn-pill-accent:hover {
  background: var(--primary);
  color: #fff;
}

/* Text Input Panel */
.text-input-group {
  margin-bottom: 12px;
}

.input-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.textarea-wrapper {
  position: relative;
}

textarea#text-input {
  width: 100%;
  padding: 12px 36px 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
}

textarea#text-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-clear-input {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.text-actions-bar {
  display: flex;
  gap: 10px;
}

.sample-pills-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-subtle);
}

.sample-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pill-sample {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-sample:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #1a73e8, #2563eb);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--primary-glow);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1557b0, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary.btn-lg {
  padding: 13px 24px;
  font-size: 1rem;
  font-weight: 700;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-secondary.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-secondary.btn-lg {
  padding: 12px 20px;
  font-size: 0.95rem;
}

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-ghost-sm svg { width: 14px; height: 14px; }

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger-outline:hover { background: var(--danger-light); }

.w-full { width: 100%; }
.flex-between { display: flex; justify-content: space-between; width: 100%; }

/* Loading State */
.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 34px 16px;
  gap: 12px;
}

.scanner-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-text {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================================================
   Result Card (Section 1)
   ========================================================================== */

.result-section {
  margin-top: 22px;
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.countdown-card {
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.countdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
}

.countdown-info { display: flex; align-items: center; gap: 8px; }

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-cancel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-cancel:hover { color: var(--danger); }

.countdown-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.countdown-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-radius: var(--radius-pill);
  transition: width linear;
}

.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.result-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: var(--accent-emerald-light);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.result-status-chip svg { width: 13px; height: 13px; }

.result-main-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-hero-gmaps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 50%, #0d47a1 100%);
  color: #ffffff;
  text-decoration: none;
  padding: 16px 22px;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px var(--primary-glow);
  transition: all var(--transition-normal);
}

.btn-hero-gmaps:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(26, 115, 232, 0.45);
}

.cta-inner { display: flex; align-items: center; gap: 14px; }
.cta-icon { width: 28px; height: 28px; flex-shrink: 0; }
.cta-text { display: flex; flex-direction: column; }
.cta-primary-label { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.5px; }
.cta-sub-label { font-size: 0.8rem; opacity: 0.9; }
.cta-arrow { width: 22px; height: 22px; }

/* Bridge card between Scan & Create */
.bridge-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  gap: 12px;
}

.bridge-text strong {
  font-size: 0.9rem;
  color: var(--text-primary);
  display: block;
}

.bridge-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.coords-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .coords-grid { grid-template-columns: 1fr; }
  .bridge-action-card { flex-direction: column; align-items: flex-start; }
}

.coord-item {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.coord-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.coord-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.coord-number {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 600;
}

.btn-copy-chip {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.btn-copy-chip:hover { color: var(--primary); }
.btn-copy-chip svg { width: 15px; height: 15px; }

.action-buttons-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.btn-subaction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-subaction svg { width: 16px; height: 16px; }

.btn-subaction:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.map-preview-container {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.map-preview-header {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.78rem;
}

.preview-tag { font-weight: 700; text-transform: uppercase; color: var(--text-secondary); }
.preview-hint { color: var(--text-muted); }
.map-frame { width: 100%; height: 230px; z-index: 2; }

/* Details Accordion */
.details-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
}

.details-summary {
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.accordion-arrow { width: 16px; height: 16px; transition: transform 0.2s; }
.details-accordion[open] .accordion-arrow { transform: rotate(180deg); }

.details-body {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.raw-content-box {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 36px 10px 12px;
}

.raw-content-box pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.btn-copy-raw {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.image-preview-box {
  max-width: 180px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.image-preview-box img { width: 100%; height: auto; display: block; }

/* ==========================================================================
   SECTION 2: PIN & CREATE QR (Bản đồ đa lớp & Tạo mã QR)
   ========================================================================== */

.section-intro {
  margin-bottom: 18px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* Search Bar Row */
.search-bar-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

#generator-address-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

#generator-address-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Manual Coords Row */
.manual-coords-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
  background: var(--bg-muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.input-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-col label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-col input {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.btn-col {
  padding-bottom: 1px;
}

/* Interactive Generator Map Frame */
.map-generator-container {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.map-generator-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.generator-map-hint {
  color: var(--text-secondary);
  font-weight: 600;
}

.current-pin-coords {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
}

.interactive-map-frame {
  width: 100%;
  height: 420px;
  z-index: 2;
}

.generator-actions-row {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

/* QR Output Grid */
.qr-output-section {
  padding-top: 20px;
  border-top: 2px dashed var(--border-subtle);
  animation: fadeIn 0.3s ease-out;
}

.qr-output-header {
  margin-bottom: 16px;
  text-align: center;
}

.output-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.output-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.qr-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.qr-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.qr-card-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.qr-card-item h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.qr-render-box {
  width: 170px;
  height: 170px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}

.qr-render-box canvas,
.qr-render-box svg {
  max-width: 100% !important;
  max-height: 100% !important;
  height: auto !important;
}

.qr-card-actions {
  display: flex;
  gap: 6px;
  width: 100%;
}

.btn-qr-download {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-qr-download:hover { background: var(--primary-hover); }

.btn-qr-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-qr-open:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ==========================================================================
   Modals & Extras
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-group { display: flex; align-items: center; gap: 10px; }
.modal-icon { width: 20px; height: 20px; color: var(--primary); }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border-subtle); background: var(--bg-muted); }

/* Camera Modal */
.camera-modal-card { max-width: 520px; }
.camera-stream-wrapper {
  position: relative;
  width: 100%;
  height: 340px;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#camera-video { width: 100%; height: 100%; object-fit: cover; }
.scanner-guide { position: absolute; width: 220px; height: 220px; pointer-events: none; }
.guide-corner { position: absolute; width: 24px; height: 24px; border-color: #3b82f6; border-style: solid; }
.guide-corner.top-left { top: 0; left: 0; border-width: 4px 0 0 4px; }
.guide-corner.top-right { top: 0; right: 0; border-width: 4px 4px 0 0; }
.guide-corner.bottom-left { bottom: 0; left: 0; border-width: 0 0 4px 4px; }
.guide-corner.bottom-right { bottom: 0; right: 0; border-width: 0 4px 4px 0; }
.laser-scanner {
  position: absolute;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ef4444, #3b82f6, transparent);
  box-shadow: 0 0 8px #3b82f6;
  animation: scanLaser 2s linear infinite alternate;
}
@keyframes scanLaser { 0% { top: 5%; } 100% { top: 95%; } }
.camera-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.camera-controls { padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; }
.camera-hint { font-size: 0.8rem; color: var(--text-muted); }

/* Settings */
.settings-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.setting-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-label { font-size: 0.92rem; font-weight: 600; display: block; }
.setting-desc { font-size: 0.8rem; color: var(--text-muted); }
.setting-select {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

/* Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #fff;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary); border-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* History */
.history-content { padding: 16px 20px; max-height: 380px; overflow-y: auto; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.history-item:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.history-meta { display: flex; flex-direction: column; gap: 2px; }
.history-coords { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600; }
.history-time { font-size: 0.76rem; color: var(--text-muted); }
.btn-history-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  cursor: pointer;
}
.btn-history-del:hover { color: var(--danger); }
.btn-history-del svg { width: 15px; height: 15px; }
.history-empty { text-align: center; padding: 36px 0; color: var(--text-muted); }
.empty-icon { width: 40px; height: 40px; stroke: var(--text-muted); opacity: 0.5; margin-bottom: 8px; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #111827;
  color: #f9fafb;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.toast.toast-success svg { color: #10b981; }
.toast.toast-error svg { color: #ef4444; }
.toast.toast-info svg { color: #3b82f6; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 16px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.footer-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.footer-badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tech-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
}
