/* ==========================================================================
   BLUEVOLT QR STUDIO - COMPONENTS & CONTROLS
   Clean, Easy-to-Use, Modern Interface Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. QR Type Selector Pills
   -------------------------------------------------------------------------- */
.type-selector-container {
  margin-bottom: 1.25rem;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.type-tabs-scroll {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  width: 100%;
  min-width: 0;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: #334155 #0F172A;
  -webkit-overflow-scrolling: touch;
}

.type-tabs-scroll::-webkit-scrollbar {
  height: 4px;
}

.type-tabs-scroll::-webkit-scrollbar-thumb {
  background: #1E293B;
  border-radius: 4px;
}

.type-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.type-tab-btn:hover {
  background: #1E293B;
  color: var(--text-main);
  border-color: #334155;
}

.type-tab-btn.active {
  background: #1E293B;
  border-color: #3B82F6;
  color: #FFFFFF;
}

.type-tab-icon {
  width: 15px;
  height: 15px;
  display: inline-block;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   2. Input Forms Card & Fields
   -------------------------------------------------------------------------- */
.form-card {
  background: #080C18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

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

.form-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #FFFFFF;
}

.form-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mini-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-xs);
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-tool-btn:hover {
  color: #FFFFFF;
  background: #1E293B;
  border-color: #334155;
}

.form-group {
  margin-bottom: 1rem;
}

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

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

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-label .required {
  color: var(--rose-accent);
  margin-left: 2px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  transition: all 0.15s ease;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue-bright);
  background: #131D33;
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-dim);
}

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

.form-select {
  cursor: pointer;
}

.form-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.form-toggle-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #0F172A;
  cursor: pointer;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  transition: all 0.15s ease;
}

.form-toggle-checkbox:checked {
  background: var(--blue-primary);
  border-color: var(--blue-bright);
}

.form-toggle-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
}

.form-helper {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* --------------------------------------------------------------------------
   3. Customizer Subnav Bar & Content Card
   -------------------------------------------------------------------------- */
.studio-subnav {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
  width: 100%;
  min-width: 0;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: #334155 #0F172A;
  -webkit-overflow-scrolling: touch;
}

.subnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.subnav-pill:hover {
  color: #FFFFFF;
  background: #1E293B;
  border-color: #334155;
}

.subnav-pill.active {
  background: #1E293B;
  border-color: #3B82F6;
  color: #FFFFFF;
}

.customizer-card {
  background: #080C18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

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

.subtab-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFFFFF;
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: #0F172A;
  border: 1px solid #1E293B;
  border-radius: var(--radius-xs);
  padding: 2px;
}

.seg-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-btn.active {
  background: #2563EB;
  color: #FFFFFF;
}

/* Quick Palette Swatches Grid */
.palette-swatches-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
}

.palette-chip {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.palette-chip:hover {
  transform: scale(1.08);
}

.palette-chip.active {
  border-color: #FFFFFF;
}

.palette-chip.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Color Pickers */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  background: #0F172A;
  border: 1px solid #1E293B;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
}

.native-color-picker {
  -webkit-appearance: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

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

.native-color-picker::-webkit-color-swatch {
  border: 1px solid #334155;
  border-radius: 4px;
}

.color-hex-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-main);
  background: transparent;
  border: none;
  outline: none;
  width: 75px;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   4. Shape & Pattern Grids
   -------------------------------------------------------------------------- */
.shape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 0.5rem;
}

.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius-sm);
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.shape-btn:hover {
  background: #1E293B;
  border-color: #334155;
  color: var(--text-main);
}

.shape-btn.active {
  background: #1E293B;
  border-color: #3B82F6;
  color: #FFFFFF;
}

.shape-preview-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.shape-btn-name {
  font-size: 0.72rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   5. Logo & Branding Preset Grid
   -------------------------------------------------------------------------- */
.logo-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.logo-preset-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: #0F172A;
  border: 1px solid #1E293B;
  cursor: pointer;
  padding: 7px;
  transition: all 0.15s ease;
}

.logo-preset-btn:hover {
  background: #1E293B;
  border-color: #334155;
}

.logo-preset-btn.active {
  background: #1E293B;
  border-color: #3B82F6;
}

.logo-preset-btn img, .logo-preset-btn svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-upload-box {
  border: 1px dashed #334155;
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  text-align: center;
  cursor: pointer;
  background: #0F172A;
  transition: all 0.15s ease;
  position: relative;
}

.file-upload-box:hover {
  border-color: #3B82F6;
  background: #131D33;
}

.file-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  width: 24px;
  height: 24px;
  color: var(--blue-bright);
  margin-bottom: 0.35rem;
}

/* --------------------------------------------------------------------------
   6. "Scan Me" Frames Grid
   -------------------------------------------------------------------------- */
.frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.frame-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.45rem;
  border-radius: var(--radius-sm);
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.frame-btn:hover {
  background: #1E293B;
  border-color: #334155;
  color: var(--text-main);
}

.frame-btn.active {
  background: #1E293B;
  border-color: #3B82F6;
  color: #FFFFFF;
}

.frame-preview-box {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #334155;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
}

.frame-btn-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}

/* --------------------------------------------------------------------------
   7. Sliders
   -------------------------------------------------------------------------- */
.range-group {
  margin-bottom: 0.85rem;
}

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

.range-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--blue-light);
  font-weight: 600;
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: #1E293B;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3B82F6;
  border: 2px solid #FFFFFF;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   8. Live Preview Stage & Frame Rendering
   -------------------------------------------------------------------------- */
.preview-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.preview-header-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  flex-shrink: 0;
}

.scan-health-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
  white-space: nowrap;
  flex-shrink: 0;
}

.scan-health-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #FBBF24;
}

.scan-health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.preview-stage-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.25rem 1rem;
  min-height: 290px;
  background: #080C18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  position: relative;
}

#qr-frame-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 14px;
  background: #FFFFFF;
  color: #030712;
  transition: all 0.2s ease;
  position: relative;
  max-width: 100%;
}

#qr-frame-wrapper.frame-top-banner .frame-banner-text {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

#qr-frame-wrapper.frame-bottom-badge .frame-badge-text {
  margin-top: 8px;
  padding: 5px 16px;
  background: var(--blue-primary);
  color: #FFFFFF;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#qr-frame-wrapper.frame-polaroid {
  padding: 14px 14px 20px;
  border-radius: 10px;
}
#qr-frame-wrapper.frame-polaroid .frame-polaroid-title {
  margin-top: 10px;
  font-size: 0.9rem;
  font-weight: 800;
  color: #1E293B;
}
#qr-frame-wrapper.frame-polaroid .frame-polaroid-sub {
  font-size: 0.72rem;
  color: #64748B;
  margin-top: 2px;
}

#qr-frame-wrapper.frame-neon {
  background: #0A0F1D;
  border: 2px solid #3B82F6;
  color: #FFFFFF;
}
#qr-frame-wrapper.frame-neon .frame-neon-text {
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #60A5FA;
  letter-spacing: 0.08em;
}

#qr-frame-wrapper.frame-ticket {
  border: 1px dashed #94A3B8;
  background: #F8FAFC;
}
#qr-frame-wrapper.frame-ticket .frame-ticket-text {
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
}

#qr-canvas-holder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

#qr-canvas-holder canvas, #qr-canvas-holder svg {
  max-width: 100%;
  height: auto !important;
  display: block;
  border-radius: 6px;
}

.decoded-data-chip {
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  padding: 0.35rem 0.65rem;
  background: #080C18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}

.resolution-control-box {
  margin-bottom: 1rem;
}

.resolution-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.res-info-tag {
  font-size: 0.72rem;
  color: var(--blue-light);
  font-family: 'JetBrains Mono', monospace;
}

/* --------------------------------------------------------------------------
   9. Action Buttons & Export Hub
   -------------------------------------------------------------------------- */
.export-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary-glow {
  background: #2563EB;
  color: #FFFFFF;
  border: 1px solid #3B82F6;
  grid-column: span 2;
}

.btn-primary-glow:hover {
  background: #1D4ED8;
  border-color: #60A5FA;
}

.btn-secondary {
  background: #0F172A;
  color: var(--text-main);
  border: 1px solid #1E293B;
}

.btn-secondary:hover {
  background: #1E293B;
  border-color: #334155;
}

.quick-toolbar {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-tool-btn:hover {
  color: #FFFFFF;
  background: #1E293B;
  border-color: #334155;
}

/* --------------------------------------------------------------------------
   10. Modals
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  width: 100%;
  max-width: 580px;
  background: #0A0F1D;
  border: 1px solid #1E293B;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  transform: translateY(15px) scale(0.98);
  transition: transform 0.2s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

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

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

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #FFFFFF;
}

.modal-close-btn {
  background: #0F172A;
  border: 1px solid #1E293B;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: #1E293B;
  color: #FFFFFF;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  background: #080C18;
}

/* Scanner Viewport */
.scanner-viewport {
  position: relative;
  width: 100%;
  height: 260px;
  background: #000000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  border: 1px solid #1E293B;
}

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

.scanner-crosshair {
  position: absolute;
  width: 180px;
  height: 180px;
  border: 2px solid #3B82F6;
  border-radius: 12px;
  pointer-events: none;
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #3B82F6;
  box-shadow: 0 0 8px #3B82F6;
  animation: scanLaser 2s infinite ease-in-out;
}

@keyframes scanLaser {
  0% { top: 0%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Bulk Preview Grid */
.bulk-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #080C18;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  margin-top: 1rem;
}

.bulk-qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem;
  background: #0F172A;
  border-radius: var(--radius-xs);
  border: 1px solid #1E293B;
}

.bulk-qr-canvas {
  width: 75px;
  height: 75px;
}

.bulk-qr-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 100%;
  margin-top: 0.25rem;
}
