/* ==========================================================================
   AI QR Code Generator - Global Design System & Theme Engine
   Clean, modern, professional SaaS aesthetic (Light-first default)
   ========================================================================== */

:root {
  /* Color Palette - Light SaaS Theme (Default) */
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-active: #e2e8f0;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  --border-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Brand & Accents */
  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-secondary: #4f46e5;
  --accent-cyan: #0284c7;
  --accent-magenta: #db2777;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;
  --accent-indigo: #4f46e5;
  --accent-violet: #7c3aed;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --grad-glow: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(79, 70, 229, 0.08) 100%);
  --grad-surface: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);

  /* Elevation & Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-glow-cyan: 0 0 20px rgba(37, 99, 235, 0.15);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout */
  --max-w-content: 1240px;
  --header-height: 72px;
}

[data-theme="dark"] {
  --bg-base: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-surface-active: #334155;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.28);
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #030712;

  --brand-primary: #3b82f6;
  --brand-primary-hover: #2563eb;
  --brand-secondary: #6366f1;
  --accent-cyan: #38bdf8;
  --accent-magenta: #f472b6;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;

  --grad-primary: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --grad-glow: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.12) 100%);
  --grad-surface: linear-gradient(180deg, #111827 0%, #0b0f19 100%);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 24px 50px rgba(0, 0, 0, 0.65);
  --shadow-glow-cyan: 0 0 25px rgba(59, 130, 246, 0.25);
}

/* ==========================================================================
   Base Resets & Global Styles
   ========================================================================== */

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-base);
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* Prevent disruptive iOS Safari auto-zoom on form inputs */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

button {
  cursor: pointer;
  background: none;
  border: none;
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Typography Scale */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  overflow-wrap: break-word;
}

h1 { font-size: clamp(1.75rem, 3.5vw + 0.8rem, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.5vw + 0.5rem, 2.25rem); }
h3 { font-size: clamp(1.15rem, 1.5vw + 0.3rem, 1.6rem); }
h4 { font-size: 1.15rem; }

p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

/* Containers & Grid Layouts */
.container {
  width: 100%;
  max-width: var(--max-w-content);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 380px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

.section {
  padding-top: 4.5rem;
  padding-bottom: 4.5rem;
}

.section-tight {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

@media (max-width: 640px) {
  .section {
    padding-top: 2.75rem;
    padding-bottom: 2.75rem;
  }
  .section-tight {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
}

.text-center { text-align: center; }
.text-cyan { color: var(--accent-cyan); }
.text-emerald { color: var(--accent-emerald); }
.text-amber { color: var(--accent-amber); }
.text-brand { color: var(--brand-primary); }

/* Gradient & Brand Text Effect */
.grad-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Utility Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--grad-glow);
  color: var(--brand-primary);
  border: 1px solid var(--border-subtle);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.25);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.25);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  min-height: 44px;
}

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-1px);
}

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

.btn-outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--bg-surface);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  min-height: 38px;
}

.btn-lg {
  padding: 0.9rem 1.8rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
  min-height: 48px;
}

@media (max-width: 640px) {
  .btn-sm {
    min-height: 42px;
    padding: 0.5rem 0.85rem;
  }
  .btn-lg {
    min-height: 50px;
    padding: 0.85rem 1.4rem;
  }
}

/* Cards & Surface Panels */
.glass-panel, .surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .glass-panel, .surface-card {
    border-radius: var(--radius-md);
  }
}
