/* ============================================
   ReadFP - QR Faktur Pajak Scanner
   Premium Dark Theme with Green Accent
   ============================================ */

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #080c14;
  --bg-secondary: #0d1422;
  --bg-card: #111827;
  --bg-card-hover: #1a2236;
  --surface: #1e2a3a;
  --surface-2: #253043;

  --accent: #00D4AA;
  --accent-2: #00B891;
  --accent-glow: rgba(0, 212, 170, 0.25);
  --accent-dim: rgba(0, 212, 170, 0.1);

  --text-primary: #f0f4ff;
  --text-secondary: #8fa3c0;
  --text-muted: #4a5f7a;

  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(0, 212, 170, 0.3);

  --success: #00D4AA;
  --warning: #f59e0b;
  --danger: #f87171;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-glow: 0 0 40px rgba(0, 212, 170, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-main: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

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

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---- Background Glows ---- */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,212,170,0.08) 0%, transparent 70%);
  top: -150px; left: -100px;
}
.bg-glow-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.07) 0%, transparent 70%);
  bottom: 100px; right: -100px;
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 12, 20, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-text {
  display: flex;
  flex-direction: column;
}
.logo-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1;
}
.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}
.header-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}
.badge-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ---- Main Container ---- */
.main-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  position: relative;
  z-index: 1;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  margin-bottom: 40px;
}
.hero-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.15;
  margin-bottom: 14px;
}
.gradient-text {
  background: linear-gradient(135deg, #00D4AA 0%, #00B5E8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---- Scanner Card ---- */
.scanner-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

/* ---- Tab Switcher ---- */
.tab-switcher {
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 5px;
  gap: 4px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn.active {
  background: var(--accent);
  color: #080c14;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(0, 212, 170, 0.4);
}
.tab-btn:not(.active):hover {
  color: var(--text-secondary);
  background: var(--surface);
}

/* ---- Viewfinder ---- */
.viewfinder-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #050811;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
#videoEl {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- Scan Overlay ---- */
.scan-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 17, 0.3);
}
.scan-overlay.active { display: flex; }

.scan-frame {
  position: relative;
  width: min(240px, 60%);
  height: min(240px, 60%);
}
.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--accent);
  border-style: solid;
}
.corner-tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.corner-tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.corner-bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.corner-br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.scan-line {
  position: absolute;
  left: 6px; right: 6px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 8px var(--accent);
  animation: scanAnim 2s linear infinite;
}
@keyframes scanAnim {
  0% { top: 6px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: calc(100% - 8px); opacity: 0; }
}
.scan-hint {
  margin-top: 28px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  background: rgba(0,0,0,0.5);
  padding: 8px 18px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

/* ---- Idle State ---- */
.idle-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.idle-state.hidden { display: none; }
.idle-icon { opacity: 0.7; }
.idle-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Camera Controls ---- */
.camera-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Scan Status ---- */
.scan-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.status-dot {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}
.status-dot.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 1.5s infinite;
}
.status-dot.success { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.error { background: var(--danger); }

/* ---- Dropzone ---- */
.dropzone {
  border: 2px dashed var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--accent-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.dropzone:hover, .dropzone.drag-over {
  background: rgba(0, 212, 170, 0.15);
  border-color: var(--accent);
  transform: scale(1.01);
}
.dropzone-icon { opacity: 0.8; }
.dropzone-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.dropzone-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Preview ---- */
.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}
#previewImg {
  max-width: 280px;
  max-height: 280px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  object-fit: contain;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #060b14;
  box-shadow: 0 4px 16px rgba(0,212,170,0.35);
}
.btn-primary:hover {
  background: var(--accent-2);
  box-shadow: 0 6px 24px rgba(0,212,170,0.5);
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}
.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}
.btn-danger {
  background: rgba(248,113,113,0.15);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.3);
}
.btn-danger:hover {
  background: rgba(248,113,113,0.25);
  border-color: rgba(248,113,113,0.5);
}
.btn-danger-text {
  color: var(--danger) !important;
}
.btn-danger-text:hover {
  background: rgba(248,113,113,0.1) !important;
  border-color: rgba(248,113,113,0.3) !important;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ---- Hardware Scanner Panel ---- */
.hw-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 4px;
}

.hw-status-indicator {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: var(--transition);
}
.hw-status-indicator.active {
  border-color: rgba(0, 212, 170, 0.4);
  background: rgba(0, 212, 170, 0.03);
  box-shadow: 0 0 16px rgba(0, 212, 170, 0.05);
}

.hw-status-ring {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hw-status-indicator.active .hw-status-ring {
  background: rgba(0, 212, 170, 0.15);
  animation: hwRingPulse 2s infinite;
}
@keyframes hwRingPulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(0, 212, 170, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0); }
}

.hw-status-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--danger);
}
.hw-status-indicator.active .hw-status-dot {
  background: var(--accent);
}

.hw-status-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hw-status-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.hw-status-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hw-input-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  animation: fadeIn 0.3s ease;
}
.hw-hint {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 18px;
}

.hw-field-wrap {
  position: relative;
  width: 100%;
}
.hw-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 16px 20px;
  text-align: center;
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
  caret-color: var(--accent);
}
.hw-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 212, 170, 0.12);
  background: var(--surface-2);
}

.hw-sub-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

.hw-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.hw-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.hw-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px; height: 16px;
  cursor: pointer;
}

.hw-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.btn-block {
  width: 100%;
  justify-content: center;
  padding: 14px;
}

/* ---- HTTPS Warning ---- */
.https-warn {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.https-warn code {
  background: rgba(245,158,11,0.15);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.https-warn svg { flex-shrink: 0; margin-top: 2px; }

/* ---- Overlay Controls (Torch & Flip on viewfinder) ---- */
.overlay-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.overlay-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(8, 12, 20, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.overlay-btn:hover, .overlay-btn:active {
  background: rgba(8, 12, 20, 0.9);
  border-color: rgba(255,255,255,0.25);
  color: #fff;
  transform: scale(1.08);
}
.overlay-btn.active {
  background: rgba(245,158,11,0.25);
  border-color: rgba(245,158,11,0.6);
  color: var(--warning);
  box-shadow: 0 0 16px rgba(245,158,11,0.3);
}

/* ---- Success Flash ---- */
.success-flash {
  position: absolute;
  inset: 0;
  background: rgba(0,212,170,0.25);
  border-radius: inherit;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.success-flash.show {
  opacity: 1;
  animation: flashFade 0.6s ease forwards;
}
@keyframes flashFade {
  0%   { opacity: 0.8; }
  100% { opacity: 0; }
}

/* ---- Scan Frame — Detected State ---- */
.scan-frame.detected .corner {
  border-color: #fff;
  box-shadow: 0 0 12px var(--accent);
}
.scan-frame.detected {
  animation: framePulse 0.4s ease;
}
@keyframes framePulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

/* ---- Zoom Bar ---- */
.zoom-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  margin-top: 8px;
}
.zoom-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface-2);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0,212,170,0.5);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.zoom-slider::-webkit-slider-thumb:active { transform: scale(1.25); }
.zoom-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.zoom-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}

/* ---- Camera Selector ---- */
.camera-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 6px;
}
.cam-select-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.cam-select {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.cam-select:focus { border-color: var(--border-accent); }
.cam-select option { background: var(--bg-card); }

/* ---- Android Tips ---- */
.android-tips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  animation: fadeIn 0.3s ease;
}
.tip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.tip-item svg { flex-shrink: 0; color: var(--accent); }

/* ---- Result Section ---- */
.result-section {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(0,212,170,0.08);
  margin-bottom: 28px;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}
.result-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.result-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-icon.success {
  background: rgba(0,212,170,0.15);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}
.result-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- FP Table ---- */
.fp-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.fp-table {
  width: 100%;
  border-collapse: collapse;
}
.fp-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.fp-table tbody tr:last-child { border-bottom: none; }
.fp-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.field-label {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  width: 280px;
  min-width: 200px;
  white-space: nowrap;
}
.field-sep {
  padding: 14px 8px;
  color: var(--text-muted);
  font-weight: 400;
}
.field-value {
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-all;
}
.field-value.mono {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.5px;
}
.field-value.currency {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 15px;
}

/* Status badge inside table */
.status-row .field-value { padding-top: 10px; padding-bottom: 10px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.status-badge.valid {
  background: rgba(0,212,170,0.15);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}
.status-badge.invalid {
  background: rgba(248,113,113,0.1);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.2);
}
.status-badge.warning {
  background: rgba(245,158,11,0.12);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
}
.status-badge.unknown {
  background: rgba(148,163,184,0.1);
  color: var(--text-muted);
  border: 1px solid rgba(148,163,184,0.2);
}

/* ---- Raw Data ---- */
.raw-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.raw-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  transition: color var(--transition);
}
.raw-toggle:hover { color: var(--text-secondary); }
.raw-content {
  margin-top: 12px;
  animation: fadeIn 0.25s ease;
}
.raw-content pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

/* ---- Error Section ---- */
.error-section {
  background: rgba(248,113,113,0.05);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--danger);
  margin-bottom: 28px;
  animation: fadeIn 0.3s ease;
}
.error-icon { flex-shrink: 0; opacity: 0.9; }
.error-msg { font-size: 15px; font-weight: 500; }

/* ---- History Section ---- */
.history-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.3s ease;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.history-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.history-item:hover {
  background: var(--surface);
  border-color: rgba(255,255,255,0.1);
}
.history-item-info {
  flex: 1;
  min-width: 0;
}
.history-item-fp {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ip-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  text-overflow: clip;
}
.history-item-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 32px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  position: relative;
  z-index: 1;
}
.footer-sub {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.6;
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- Print Styles ---- */
@media print {
  body { background: #fff; color: #000; }
  .header, .scanner-card, .hero, .history-section,
  .footer, .bg-glow, .result-actions, .raw-section { display: none !important; }
  .result-section {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: none;
    padding: 20px;
  }
  .field-label, .field-sep, .field-value { color: #000; }
  .field-value.currency { color: #006644; }
  .fp-table tbody tr { border-bottom: 1px solid #eee; }
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .main-container { padding: 24px 16px 40px; }
  .scanner-card { padding: 20px 16px; }
  .result-section { padding: 20px 16px; }
  .result-header { flex-direction: column; align-items: flex-start; }
  .result-actions { width: 100%; }
  .field-label { width: auto; min-width: 130px; font-size: 12px; padding: 12px 12px; }
  .field-value { padding: 12px 12px; font-size: 13px; }
  .tab-btn { font-size: 13px; padding: 9px 12px; }
}
