/* ==========================================================================
   QR Studio - Ultra Clean & Professional Stylesheet
   Design System: Glassmorphism, Dark/Light Themes, Modern Micro-interactions
   ========================================================================== */

:root {
  /* Color Palette - Light Mode */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);

  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-sans: Arial, Helvetica, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --bg-subtle: #131d33;
  --bg-glass: rgba(15, 23, 42, 0.85);
  --border-color: #24344d;
  --border-focus: #60a5fa;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.25);
}

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

html {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  transition: var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.25rem;
}

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

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.nav-btn:hover {
  color: var(--text-primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--primary);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-banner {
  text-align: center;
  padding: 2.25rem 1rem 1.25rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.2);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.hero-title span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Main App Workspace Layout
   ========================================================================== */
.app-workspace {
  max-width: 1400px;
  margin: 0 auto 3rem;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 1.75rem;
  align-items: start;
  width: 100%;
}

.generator-left-col {
  min-width: 0;
}

/* ==========================================================================
   Data Type Selector Tabs
   ========================================================================== */
.type-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.6rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.type-selector-bar::-webkit-scrollbar {
  height: 4px;
}

.type-selector-bar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.type-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.type-tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.type-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.type-tab-btn.active i, .type-tab-btn.active svg {
  stroke: #ffffff;
}

/* ==========================================================================
   Input Section Panels
   ========================================================================== */
.content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

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

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

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

.radio-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.radio-pill-item {
  position: relative;
}

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

.radio-pill-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.radio-pill-item input:checked + .radio-pill-label {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

/* Accordion sections for customization */
.accordion-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.accordion-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

.accordion-header {
  width: 100%;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: left;
}

.accordion-header-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.accordion-header-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.accordion-chevron {
  transition: transform 0.25s ease;
  color: var(--text-muted);
}

.accordion-item.active .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0 1.25rem 1.25rem;
  display: none;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.accordion-item.active .accordion-body {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* Style Option Grids */
.style-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.style-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  cursor: pointer;
  gap: 0.4rem;
  transition: var(--transition);
}

.style-tile:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.style-tile.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.style-tile-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-tile-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

/* Color Controls */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.color-input-wrapper {
  position: relative;
  width: 44px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
}

.color-input-wrapper input[type="color"] {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 64px;
  height: 60px;
  border: none;
  cursor: pointer;
}

.color-hex-input {
  flex: 1;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* Logo Preset Icons */
.logo-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.logo-preset-btn {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.logo-preset-btn:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.logo-preset-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* ==========================================================================
   Preview Card & Action Panel (Sticky Right)
   ========================================================================== */
.preview-sticky-container {
  position: sticky;
  top: 5rem;
}

.preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.preview-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.12);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.qr-canvas-holder {
  width: 100%;
  min-height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.qr-canvas-holder canvas, .qr-canvas-holder svg {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.preview-info-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.export-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--primary-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.btn-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: 100%;
}

.btn-secondary {
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

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

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-window {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.modal-close-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

/* Scanner viewport inside modal */
.scanner-viewport {
  width: 100%;
  height: 280px;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-guide {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 2px dashed #38bdf8;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.scanner-guide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: scanLaser 2s linear infinite alternate;
}

@keyframes scanLaser {
  0% { top: 0; }
  100% { top: 100%; }
}

.scanner-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-subtle);
}

.scanner-dropzone:hover, .scanner-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Preset Categories Filter Bar */
.preset-categories-bar {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.preset-categories-bar::-webkit-scrollbar {
  height: 4px;
}

.preset-categories-bar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.category-btn {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: var(--transition);
}

.category-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.category-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Preset Cards Grid */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.preset-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  contain: content;
  content-visibility: auto;
  contain-intrinsic-size: 240px 180px;
}

.preset-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.preset-preview-thumb {
  width: 100%;
  height: 110px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preset-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.preset-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* History Cards */
.history-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.history-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.6rem;
  gap: 1rem;
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}

.history-item-title {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.toast {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
  border-left: 4px solid var(--accent-emerald);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

.toast.error {
  border-left: 4px solid var(--accent-rose);
}

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

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-surface);
}

/* ==========================================================================
   Responsive & Device Compatibility Adjustments
   ========================================================================== */

/* Tablet & Mobile Layout Adjustments (Laptops to Phones) */
@media (max-width: 1080px) {
  .app-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }
  
  /* display: contents allows tabs and inputs to act as direct children of the flex workspace container */
  .generator-left-col {
    display: contents;
  }

  .type-selector-bar {
    order: 1; /* Tabs at the very top */
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .generator-right-col {
    order: 2; /* QR Code Live Preview card directly below tabs */
    width: 100%;
  }

  .content-card {
    order: 3; /* Form Inputs Card below QR Preview */
    width: 100%;
    margin-bottom: 0;
  }

  .accordion-wrapper {
    order: 4; /* Design Accordions at the bottom */
    width: 100%;
  }
  
  .preview-sticky-container {
    position: static; /* Unstick preview on tablet/mobile so it flows in flex order */
  }

  .preview-card {
    margin-bottom: 0;
  }
}

/* Mobile Screen Specific Tweaks (Phones & Small Devices) */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .header {
    padding: 0.6rem 1rem;
  }

  .brand span {
    font-size: 1.1rem;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .hero-banner {
    padding: 1.5rem 1rem 0.75rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-desc {
    font-size: 0.85rem;
  }

  .qr-canvas-holder {
    min-height: 260px;
    padding: 0.75rem;
  }

  .btn-row {
    grid-template-columns: 1fr; /* Stack SVG, PDF, JPEG buttons vertically on narrow screens */
    gap: 0.4rem;
  }

  .btn-row[style*="grid-template-columns: 1fr 1fr;"] {
    grid-template-columns: 1fr !important;
  }

  /* Style Tiles sizing on mobile */
  .style-tiles-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 0.4rem;
  }

  .style-tile {
    padding: 0.6rem 0.4rem;
  }

  .style-tile-icon {
    width: 28px;
    height: 28px;
  }

  .logo-presets-grid {
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 0.4rem;
  }

  .logo-preset-btn {
    width: 38px;
    height: 38px;
  }

  /* Form Layout */
  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Modals on Mobile - Sheet style */
  .modal-window {
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .modal-overlay.active .modal-window {
    transform: translateY(0);
  }

  .scanner-viewport {
    height: 200px;
  }

  .presets-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .preset-card {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
  }

  .preset-preview-thumb {
    width: 70px;
    height: 70px;
  }
}

/* Very Small Phones & Wearables (max-width: 480px) */
@media (max-width: 480px) {
  .header-actions {
    gap: 0.4rem;
  }

  /* Hide texts for navigation buttons on tiny mobile to avoid overlap */
  .nav-btn span {
    display: none;
  }

  .nav-btn {
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    justify-content: center;
  }

  .brand span {
    display: none; /* Hide 'QR Studio PRO' on tiny headers to fit icon-only buttons */
  }

  .type-tab-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}


