/* QRCode Generator – Tailwind enhancements and bespoke styling */
:root {
  color-scheme: light dark;
  --surface-bg: rgba(255, 255, 255, 0.92);
  --surface-border: rgba(226, 232, 240, 0.8);
  --surface-shadow: 0 12px 32px -18px rgba(15, 23, 42, 0.35);
  --surface-bg-dark: rgba(15, 23, 42, 0.92);
  --surface-border-dark: rgba(71, 85, 105, 0.55);
  --surface-shadow-dark: 0 18px 40px -24px rgba(2, 6, 23, 0.75);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  min-height: 100vh;
  background: radial-gradient(circle at top, #eef2ff 0%, #f8fafc 55%, #f1f5f9 100%);
  color: #0f172a;
}

.dark body {
  background: radial-gradient(
    circle at top,
    rgba(51, 65, 85, 0.75) 0%,
    rgba(15, 23, 42, 0.95) 58%,
    rgba(13, 19, 33, 1) 100%
  );
  color: #e2e8f0;
}

.app-header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(226, 232, 240, 0.65);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background 0.35s ease, border-color 0.35s ease;
}

.dark .app-header {
  background: rgba(15, 23, 42, 0.9);
  border-bottom-color: rgba(71, 85, 105, 0.55);
}

.surface-card {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: 1.35rem;
  box-shadow: var(--surface-shadow);
  backdrop-filter: blur(12px);
  padding: 1.9rem;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.surface-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px -24px rgba(15, 23, 42, 0.45);
  border-color: rgba(148, 163, 184, 0.55);
}

.dark .surface-card {
  background: var(--surface-bg-dark);
  border-color: var(--surface-border-dark);
  box-shadow: var(--surface-shadow-dark);
}

.surface-card h2 {
  font-size: 0.98rem;
  font-weight: 600;
  text-transform: none !important;
  letter-spacing: 0.01em;
  color: inherit;
}

form label > span:first-child {
  text-transform: none !important;
  letter-spacing: 0.015em !important;
  color: rgba(71, 85, 105, 0.85);
  font-weight: 600;
}

.dark form label > span:first-child {
  color: rgba(203, 213, 225, 0.85);
}

.surface-card fieldset {
  border: 1px solid rgba(226, 232, 240, 0.6);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.6);
  padding: 1.35rem;
}

.surface-card fieldset + fieldset {
  margin-top: 1.25rem;
}

.dark .surface-card fieldset {
  border-color: rgba(71, 85, 105, 0.5);
  background: rgba(15, 23, 42, 0.75);
}

.surface-card legend {
  padding: 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(71, 85, 105, 0.7);
}

.dark .surface-card legend {
  color: rgba(148, 163, 184, 0.65);
}

.range-input {
  width: 100%;
  height: 0.5rem;
  appearance: none;
  border-radius: 9999px;
  background-color: #e2e8f0;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.range-input:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.dark .range-input {
  background-color: rgba(148, 163, 184, 0.35);
}

.range-input::-webkit-slider-runnable-track,
.range-input::-moz-range-track {
  height: 0.5rem;
  border-radius: 9999px;
  background-color: inherit;
}

.range-input::-webkit-slider-thumb,
.range-input::-moz-range-thumb {
  height: 1rem;
  width: 1rem;
  cursor: pointer;
  border-radius: 9999px;
  border: 1px solid #ffffff;
  background-color: #2563eb;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.18);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.range-input:hover::-webkit-slider-thumb,
.range-input:hover::-moz-range-thumb,
.range-input:focus::-webkit-slider-thumb,
.range-input:focus::-moz-range-thumb {
  background-color: #60a5fa;
  transform: translateY(-1px);
}

.interaction-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background-color 0.2s ease,
    color 0.2s ease, border-color 0.2s ease;
}

.interaction-button {
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.interaction-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -14px rgba(29, 78, 216, 0.4);
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.38);
  color: #1e3a8a;
}

.dark .interaction-button {
  border-color: rgba(147, 197, 253, 0.28);
  background: rgba(37, 99, 235, 0.25);
  color: #bfdbfe;
}

.dark .interaction-button:hover {
  background: rgba(37, 99, 235, 0.32);
  border-color: rgba(147, 197, 253, 0.45);
  color: #e0f2fe;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.18);
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(51, 65, 85, 0.85);
  transition: transform 0.2s ease, box-shadow 0.25s ease, background-color 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
}

.view-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -22px rgba(37, 99, 235, 0.45);
  border-color: rgba(37, 99, 235, 0.35);
  color: #1d4ed8;
}

.view-toggle--active {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
  box-shadow: 0 16px 36px -24px rgba(37, 99, 235, 0.55);
}

.dark .view-toggle {
  border-color: rgba(71, 85, 105, 0.6);
  background: rgba(51, 65, 85, 0.35);
  color: rgba(203, 213, 225, 0.88);
}

.dark .view-toggle:hover {
  border-color: rgba(147, 197, 253, 0.35);
  color: #93c5fd;
}

.dark .view-toggle--active {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(147, 197, 253, 0.45);
  color: #bfdbfe;
  box-shadow: 0 18px 40px -24px rgba(37, 99, 235, 0.6);
}

.view-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.dark .view-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

.secondary-button {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.96);
  color: #1e293b;
}

.secondary-button:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.5);
  color: #1d4ed8;
  box-shadow: 0 12px 28px -18px rgba(37, 99, 235, 0.32);
}

.dark .secondary-button {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
}

.dark .secondary-button:hover {
  border-color: rgba(147, 197, 253, 0.45);
  color: #93c5fd;
  box-shadow: 0 14px 32px -18px rgba(37, 99, 235, 0.48);
}

.interaction-button:disabled,
.secondary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.scan-feedback[data-tone="success"] {
  color: #047857 !important;
}

.dark .scan-feedback[data-tone="success"] {
  color: #34d399 !important;
}

.scan-feedback[data-tone="error"] {
  color: #dc2626 !important;
}

.dark .scan-feedback[data-tone="error"] {
  color: #f87171 !important;
}

.scan-feedback[data-tone="warning"] {
  color: #b45309 !important;
}

.dark .scan-feedback[data-tone="warning"] {
  color: #facc15 !important;
}

.scan-feedback[data-tone="info"] {
  color: #2563eb !important;
}

.dark .scan-feedback[data-tone="info"] {
  color: #60a5fa !important;
}

.text-2xs {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

#qrPreview {
  border-radius: 1.35rem;
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.55), rgba(248, 250, 252, 0.96));
  padding: 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.65);
  overflow: hidden;
}

.dark #qrPreview {
  background: linear-gradient(135deg, rgba(37, 47, 65, 0.75), rgba(15, 23, 42, 0.95));
  border-color: rgba(71, 85, 105, 0.6);
}

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

#toast.show {
  display: block;
  animation: toast-fade 4s ease forwards;
}

@keyframes toast-fade {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  10% {
    opacity: 1;
    transform: translateY(0);
  }
  80% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1023px) {
  #qrPreview {
    min-height: 18rem;
  }
}
