﻿/* ==========================================================================
   QR Studio & Live Scan Tracker - Modern Design System
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1e293b;
  --bg-card: rgba(19, 27, 46, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #4f46e5;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(236, 72, 153, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

.app-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(11, 15, 25, 0.8);
  border-bottom: 1px solid var(--border-color);
  margin: 0 -1.5rem 2rem;
  padding: 1rem 1.5rem;
}

body.light-theme .app-header {
  background: rgba(241, 245, 249, 0.85);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.3rem;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.brand-info h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-pro {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--accent-gradient);
  color: white;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.brand-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}
/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-secondary);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

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

.tab-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.live-pulse-badge {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  animation: pulse-danger 1.5s infinite;
}

.count-pill {
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.server-status-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  transition: var(--transition);
}

.server-status-badge.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.server-status-badge.offline .status-dot {
  background: var(--text-muted);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

/* Tab Views */
.tab-view {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-view.active {
  display: block;
}

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

/* Generator Layout */
.generator-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.75rem;
  align-items: start;
}

.controls-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tracking Mode Card */
.tracking-mode-card {
  border-left: 4px solid var(--accent-primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(19, 27, 46, 0.8) 100%);
}

.tracking-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tracking-mode-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.tracking-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.tracking-mode-info h3 {
  font-size: 1rem;
  font-weight: 700;
}

.tracking-mode-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dynamic-extra-fields {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}
/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-tertiary);
  transition: var(--transition);
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: var(--transition);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--accent-gradient);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}

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

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 2.5rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  height: 100%;
  padding-top: 1.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Type Buttons Grid */
.type-buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.75rem;
  font-weight: 600;
}

.type-btn i {
  font-size: 1.15rem;
}

.type-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.type-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.type-subform {
  display: none;
}

.type-subform.active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

/* Accordions */
.custom-accordion {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  background: var(--bg-secondary);
  overflow: hidden;
  transition: var(--transition);
}

.custom-accordion[open] {
  border-color: rgba(99, 102, 241, 0.3);
}

.custom-accordion summary {
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  user-select: none;
  list-style: none;
}

.custom-accordion summary::-webkit-details-marker {
  display: none;
}

.custom-accordion summary .toggle-icon {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.custom-accordion[open] summary .toggle-icon {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 1.1rem;
  border-top: 1px solid var(--border-color);
}
/* Radio Pill Group */
.radio-pill-group {
  display: flex;
  background: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  gap: 0.25rem;
}

.radio-pill {
  flex: 1;
  text-align: center;
  position: relative;
  cursor: pointer;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
}

.radio-pill span {
  display: block;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: var(--transition);
}

.radio-pill input:checked + span {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 6px var(--accent-glow);
}

/* Color Controls */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.color-control label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.35rem;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

.color-hex {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-primary);
}

.preset-palettes label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.4rem;
}

.palette-chips {
  display: flex;
  gap: 0.5rem;
}

.palette-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.palette-chip:hover {
  transform: scale(1.15);
}

.palette-chip:nth-child(1) { background: linear-gradient(135deg, #0f172a 50%, #ffffff 50%); }
.palette-chip:nth-child(2) { background: linear-gradient(135deg, #4f46e5 50%, #06b6d4 50%); }
.palette-chip:nth-child(3) { background: linear-gradient(135deg, #ec4899 50%, #8b5cf6 50%); }
.palette-chip:nth-child(4) { background: linear-gradient(135deg, #10b981 50%, #047857 50%); }
.palette-chip:nth-child(5) { background: linear-gradient(135deg, #f59e0b 50%, #ef4444 50%); }
.palette-chip:nth-child(6) { background: linear-gradient(135deg, #ffffff 50%, #0f172a 50%); }

/* Shape Buttons Grid */
.shape-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.shape-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.shape-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.shape-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* File Dropzones */
.file-dropzone {
  display: block;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-tertiary);
  transition: var(--transition);
}

.file-dropzone:hover,
.file-dropzone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

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

.dropzone-content i {
  font-size: 1.5rem;
  color: var(--accent-primary);
}

.dropzone-content span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-content small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Preset Icons */
.preset-icons-section {
  margin-top: 1rem;
}

.preset-icons-section label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.4rem;
}

.icon-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.icon-chip {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}

.icon-chip:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.icon-chip.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}
/* Preview Sticky Column */
.sticky-card {
  position: sticky;
  top: 6.5rem;
}

.preview-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.preview-title {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.live-status-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.live-status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: pulse-dot 1.5s infinite;
}

.live-status-pill.static {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.live-status-pill.static .dot {
  background: var(--text-muted);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.qr-canvas-wrapper {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
  min-height: 290px;
  margin-bottom: 1.25rem;
}

#qrCanvasContainer svg,
#qrCanvasContainer canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.qr-meta-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
  gap: 0.5rem;
}

.meta-row:last-child {
  margin-bottom: 0;
}

.meta-label {
  color: var(--text-muted);
  flex-shrink: 0;
}

.meta-value {
  color: var(--text-primary);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
}

/* Resolution & Buttons */
.resolution-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.resolution-selector label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.resolution-selector select {
  width: auto;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
}

.export-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
}

.btn-accent {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-accent:hover {
  filter: brightness(1.1);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
}

.full-width {
  width: 100%;
}
/* ==========================================================================
   LIVE TRACKER RADAR & METRICS
   ========================================================================== */
.tracker-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.live-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(236, 72, 153, 0.08) 100%);
  border-color: rgba(99, 102, 241, 0.25);
}

.live-banner-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.live-radar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
}

.radar-ping {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  animation: radar-wave 2s infinite;
}

@keyframes radar-wave {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.live-banner h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.live-banner p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 650px;
}

.network-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  margin-top: 0.5rem;
  border: 1px solid var(--border-color);
}

.network-info-pill strong {
  color: var(--accent-primary);
}

.live-banner-actions {
  display: flex;
  gap: 0.5rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.metric-card {
  padding: 1.25rem;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.metric-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.icon-blue { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.icon-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-orange { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.metric-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Scan Feed Table */
.scan-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.feed-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feed-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.live-badge-stream {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 1.2s infinite;
}

.feed-filters input {
  max-width: 320px;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
}

.scans-table-container {
  overflow-x: auto;
}

.scans-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.scans-table th {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.scans-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.scans-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.scans-table tr.scan-highlight {
  animation: row-flash 2.5s ease-out;
}

@keyframes row-flash {
  0% { background: rgba(99, 102, 241, 0.3); }
  100% { background: transparent; }
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-new {
  background: var(--success);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* Scanner Tab */
.scanner-methods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.scanner-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.scanner-box h3 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.camera-reader-viewport {
  width: 100%;
  min-height: 250px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-controls {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.scan-result-card {
  margin-top: 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--success);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.result-payload {
  background: var(--bg-primary);
  padding: 0.75rem;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow-y: auto;
  margin: 0.5rem 0;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Library Grid */
.library-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.qr-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.qr-lib-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qr-lib-thumb {
  background: white;
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 180px;
}

.qr-lib-thumb img, .qr-lib-thumb svg {
  max-width: 140px;
  max-height: 140px;
}

.qr-lib-meta h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.qr-lib-meta p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.qr-lib-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
}

/* Toast Notifications */
.scan-toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scan-toast {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 320px;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
}

.toast-body h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.toast-body p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Print Only */
@media print {
  body * { visibility: hidden; }
  #printTemplate, #printTemplate * { visibility: visible; }
  #printTemplate {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
  }
  .print-card {
    text-align: center;
    border: 2px solid #000;
    padding: 3rem;
    border-radius: 12px;
  }
}

.print-only { display: none; }

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .scanner-methods-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-tabs {
    width: 100%;
    overflow-x: auto;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .type-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
