/* ==========================================================================
   QR Code Generator — Modern, Minimalist & Responsive Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Brand & Accent Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-subtle: #eff6ff;
  --primary-border: #bfdbfe;

  /* Neutral Surface & Background Colors */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-panel: #f8fafc;
  --bg-muted: #f1f5f9;

  /* Text & Content Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  /* Borders & Dividers */
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #3b82f6;

  /* Feedback Colors */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --error: #ef4444;
  --error-bg: #fef2f2;

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

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 20px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04), 0 0 1px 1px rgba(15, 23, 42, 0.04);

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  padding: 1.5rem 1rem;
}

/* Subtle background glowing aura */
.bg-decoration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(147, 51, 234, 0.05) 0%, transparent 45%);
}

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

/* --------------------------------------------------------------------------
   3. Layout Container & Header
   -------------------------------------------------------------------------- */
.app-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-width: 600px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.25rem;
}

.logo-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.logo-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.app-title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.2;
}

.app-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 480px;
}

/* --------------------------------------------------------------------------
   4. Main Generator Card
   -------------------------------------------------------------------------- */
.generator-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}

.panel {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Input Panel (Left) */
.input-panel {
  border-right: 1px solid var(--border-subtle);
}

/* Preview Panel (Right) */
.preview-panel {
  background-color: var(--bg-panel);
  justify-content: space-between;
  align-items: center;
}

/* --------------------------------------------------------------------------
   5. Form Controls & UI Components
   -------------------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.form-row {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.section-label {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.text-center {
  text-align: center;
}

/* Content Type Tabs */
.type-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  background: var(--bg-muted);
  padding: 0.3rem;
  border-radius: var(--radius-md);
}

.type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.type-pill:hover {
  color: var(--text-main);
}

.type-pill.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.type-pill:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Text Area & Input Fields */
.input-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.char-count {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.form-control {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.925rem;
  color: var(--text-main);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-control:hover {
  border-color: var(--border-strong);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.text-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.45;
  padding-right: 2.25rem;
}

.btn-clear {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-clear:hover {
  color: var(--text-main);
  background: var(--bg-muted);
}

.btn-clear:focus-visible {
  outline: 2px solid var(--primary);
}

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

/* Wi-Fi Inputs Container */
.wifi-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-muted);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.hidden {
  display: none !important;
}

.select-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   6. Customization Section (Colors, Resolution, Presets)
   -------------------------------------------------------------------------- */
.customization-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.section-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-light);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.section-divider span {
  padding: 0 0.75rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.6rem;
  height: 42px;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.color-picker-wrap:hover {
  border-color: var(--border-strong);
}

.color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  overflow: hidden;
  padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-xs);
}

.color-hex {
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
}

/* Color Presets */
.presets-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

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

.preset-buttons {
  display: flex;
  gap: 0.4rem;
}

.preset-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.preset-btn:hover {
  transform: scale(1.15);
}

.preset-btn.active {
  border-color: var(--primary);
  transform: scale(1.1);
}

.swatch-split {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* --------------------------------------------------------------------------
   7. Action Buttons
   -------------------------------------------------------------------------- */
.action-row {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.925rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
  line-height: 1.2;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-white);
  flex: 1;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-muted);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   8. QR Code Display & Frame
   -------------------------------------------------------------------------- */
.qr-display-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.qr-canvas-frame {
  width: 240px;
  height: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.qr-canvas-frame:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.qrcode-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.35s ease forwards;
}

.qrcode-wrapper canvas,
.qrcode-wrapper img {
  max-width: 100% !important;
  max-height: 100% !important;
  height: auto !important;
  width: auto !important;
  display: block;
  border-radius: 4px;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-light);
  text-align: center;
  padding: 1rem;
  font-size: 0.82rem;
}

.placeholder-icon {
  stroke: var(--text-light);
  opacity: 0.6;
}

/* Meta Badges */
.meta-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.meta-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

/* Download Actions */
.download-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.btn-download {
  background-color: var(--primary);
  color: var(--text-white);
  width: 100%;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-download:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
  transform: translateY(-1px);
}

.btn-copy {
  width: 100%;
}

/* --------------------------------------------------------------------------
   9. Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.15rem;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 320px;
}

.toast.toast-error {
  background: #dc2626;
}

.toast.toast-success {
  background: #0f172a;
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   10. Footer & Privacy Badge
   -------------------------------------------------------------------------- */
.app-footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.5rem 0;
}

.footer-privacy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #059669;
  font-weight: 600;
  font-size: 0.78rem;
  background: #ecfdf5;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid #a7f3d0;
}

.footer-copy {
  color: var(--text-light);
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   11. Micro-animations & Keyframes
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* --------------------------------------------------------------------------
   11b. Informational SEO & FAQ Section
   -------------------------------------------------------------------------- */
.seo-section {
  width: 100%;
  max-width: 960px;
}

.seo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.seo-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  max-width: 680px;
  margin: 0 auto;
}

.seo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}

.seo-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.seo-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.seo-grid-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.seo-grid-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.seo-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.seo-grid-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.seo-grid-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.faq-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.75rem;
}

.faq-main-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  overflow: hidden;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.faq-item[open] {
  background: var(--bg-card);
  border-color: var(--primary-border);
}

.faq-question {
  padding: 1rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  color: var(--text-light);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-answer {
  padding: 0 1.25rem 1.15rem 1.25rem;
  font-size: 0.885rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   12. Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .generator-card {
    grid-template-columns: 1fr;
    max-width: 520px;
  }

  .input-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 1.5rem;
  }

  .preview-panel {
    padding: 1.5rem;
    gap: 1.5rem;
  }

  .app-title {
    font-size: 1.85rem;
  }

  .seo-grid {
    grid-template-columns: 1fr;
  }

  .seo-card {
    padding: 1.5rem;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    align-items: center;
  }

  .toast {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem;
  }

  .panel {
    padding: 1.25rem 1rem;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .type-selector {
    grid-template-columns: repeat(2, 1fr);
  }

  .action-row {
    flex-direction: column;
  }

  .qr-canvas-frame {
    width: 210px;
    height: 210px;
  }

  .seo-card {
    padding: 1.25rem 1rem;
  }
}
