/* ==========================================================================
   AI QR Code Studio - Dedicated Generator UI & Canvas Workspace
   ========================================================================== */

/* Mobile Segmented View Switcher (Visible on screens < 1024px) */
.mobile-studio-nav {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  position: sticky;
  top: calc(var(--header-height) + 0.5rem);
  z-index: 90;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@media (max-width: 1023px) {
  .mobile-studio-nav {
    display: grid;
  }
}

.mobile-studio-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  min-height: 44px;
}

.mobile-studio-tab-btn.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-subtle);
}

.mobile-tab-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  font-weight: 700;
}

/* Mobile Floating Bottom Action Dock (Instant 1-tap download & preview) */
.mobile-generator-dock {
  display: none;
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 95;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.65rem;
  box-shadow: var(--shadow-xl);
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: slideUpDock 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 1023px) {
  .mobile-generator-dock {
    display: flex;
  }
}

@keyframes slideUpDock {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.mobile-dock-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.mobile-dock-thumb {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-dock-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mobile-dock-status {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-dock-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.mobile-dock-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-emerald);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-dock-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.mobile-dock-btn {
  min-height: 38px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  border-radius: var(--radius-full);
}

.studio-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  margin-bottom: 5rem;
}

@media (min-width: 1024px) {
  .studio-layout {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
    margin-bottom: 4rem;
  }
}

/* Left Column: Configuration Panels */
.studio-controls {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.studio-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .studio-panel {
    padding: 1.25rem;
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Payload Tabs & Category Filters */
.category-filter-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 0.85rem;
  scrollbar-width: none;
}

.category-filter-nav::-webkit-scrollbar {
  display: none;
}

.category-pill {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.category-pill:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.category-pill.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.payload-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.6rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.payload-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.payload-tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.payload-tab-btn.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

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

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .form-row-2 { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Range Sliders */
.slider-group {
  margin-bottom: 1.25rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.slider-val {
  font-family: var(--font-mono);
  color: var(--brand-primary);
}

.slider-input {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-active);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-primary);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
  cursor: pointer;
}

/* Style Selector Carousel / Grid */
.style-select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .style-select-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.style-select-btn {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 0.25rem;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  text-align: left;
  transition: all 0.15s ease;
}

.style-select-btn:hover {
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.style-select-btn.active {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}

.style-select-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.style-select-cat {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Color Picker Inputs */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.color-swatch-input {
  -webkit-appearance: none;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: none;
  padding: 0;
}

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

.color-swatch-input::-webkit-color-swatch {
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
}

/* Right Column: Sticky Live Preview */
.studio-preview-pane {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.canvas-wrapper {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .canvas-wrapper {
    max-width: 280px;
    margin-bottom: 1rem;
  }
  .preview-card {
    padding: 1.25rem;
  }
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr !important;
  }
}

.preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Scannability Gauge Widget */
.scannability-card {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.gauge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.gauge-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gauge-meter-bar {
  width: 100%;
  height: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.gauge-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
}

.gauge-status-text {
  font-size: 0.8rem;
  font-weight: 600;
}

.gauge-diagnostics-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Step Badges */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Export Hub Buttons */
.export-actions-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 420px) {
  .export-actions-grid {
    grid-template-columns: 1fr;
  }
}

.export-res-select {
  grid-column: span 2;
}

.simulator-toggle-btn {
  width: 100%;
  margin-top: 0.75rem;
}

.btn-reset-action {
  grid-column: 1 / -1;
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-medium);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-reset-action:hover {
  background: var(--bg-surface-active);
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}
