/* ==========================================================================
   Noise Image Generator Studio Stylesheet - PicDriver
   100% Client-Side Procedural Noise, Film Grain & Seamless Texture Synthesizer
   ========================================================================== */

/* Layout & Studio Stage */
.noise-workspace {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.noise-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
  gap: 1.75rem;
  align-items: start;
}

/* Stage & Viewport */
.noise-stage-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.noise-viewport-card {
  background: var(--bg-surface, #1e222d);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.5);
  position: relative;
}

.noise-viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  gap: 0.75rem;
  flex-wrap: wrap;
}

.noise-status-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary, #94a3b8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-badge.accent {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.3);
}

.hud-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.noise-canvas-container {
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #0f1117 radial-gradient(circle at center, rgba(30, 34, 45, 0.6) 0%, rgba(10, 12, 16, 0.95) 100%);
  position: relative;
  overflow: hidden;
}

/* Responsive fluid canvas */
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

#noise-canvas,
#photo-composite-canvas {
  max-width: 100%;
  max-height: 540px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.noise-canvas-container.zoom-100 {
  overflow: auto;
}

.noise-canvas-container.zoom-100 #noise-canvas,
.noise-canvas-container.zoom-100 #photo-composite-canvas {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
}

.noise-canvas-container.zoom-200 {
  overflow: auto;
}

.noise-canvas-container.zoom-200 #noise-canvas,
.noise-canvas-container.zoom-200 #photo-composite-canvas {
  max-width: none;
  max-height: none;
  transform: scale(2);
  transform-origin: center center;
}

/* 3x3 Repeat Preview Container */
#tiling-preview-wrap {
  display: none;
  width: 100%;
  max-width: 540px;
}

#tiling-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px dashed rgba(99, 102, 241, 0.4);
}

/* Test Overlay Image Viewport */
#photo-overlay-wrap {
  display: none;
  position: relative;
  max-width: 100%;
  max-height: 540px;
  border-radius: 8px;
  overflow: hidden;
}

#overlay-base-image {
  max-width: 100%;
  max-height: 540px;
  display: block;
  border-radius: 8px;
}

#overlay-blend-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Quick Viewport Action Buttons */
.view-tabs {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.view-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.view-tab-btn:hover {
  color: #fff;
}

.view-tab-btn.active {
  background: var(--brand-primary, #6366f1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Presets Bar */
.presets-card {
  background: var(--bg-surface, #1e222d);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
}

.presets-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preset-chips-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
}

.preset-chip {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.preset-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
  transform: translateY(-1px);
}

.preset-chip.active {
  background: var(--brand-primary, #6366f1);
  border-color: var(--brand-primary, #6366f1);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

/* Controls Panel */
.tool-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-card {
  background: var(--bg-surface, #1e222d);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.65rem;
}

.control-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Form Inputs & Sliders */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
}

.form-value-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--brand-primary, #818cf8);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.styled-select,
.styled-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: #fff;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s;
}

.styled-select:focus,
.styled-input:focus {
  border-color: var(--brand-primary, #6366f1);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.slider-input {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  accent-color: var(--brand-primary, #6366f1);
  cursor: pointer;
}

/* Inline Grid of Sliders */
.dimension-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Switch / Toggle Controls */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
}

.toggle-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
  display: flex;
  flex-direction: column;
}

.toggle-sub {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
  font-weight: 400;
}

.styled-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary, #6366f1);
  cursor: pointer;
}

/* Color Pickers for Duotone */
.colors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.color-picker-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.color-input-bubble {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  background: none;
  padding: 0;
}

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

.color-input-bubble::-webkit-color-swatch {
  border: none;
  border-radius: 5px;
}

/* Test Photo Overlay Dropzone */
.test-photo-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 1.15rem 1rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.test-photo-dropzone:hover {
  border-color: var(--brand-primary, #6366f1);
  background: rgba(99, 102, 241, 0.05);
}

.test-photo-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
}

.test-photo-sub {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
  margin-top: 2px;
}

/* Export & Download Card */
.export-card {
  background: linear-gradient(145deg, rgba(30, 34, 45, 0.9), rgba(20, 23, 31, 0.95));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.2);
}

.export-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-download-main {
  background: var(--brand-primary, #6366f1);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-download-main:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.export-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn-download-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.btn-download-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Responsive Table container for SEO Guide */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary, #94a3b8);
}

table tr:last-child td {
  border-bottom: none;
}

/* Media Queries for Mobile and Tablets */
@media (max-width: 768px) {
  .noise-grid {
    grid-template-columns: 1fr;
  }

  .noise-canvas-container {
    min-height: 320px;
    padding: 0.75rem;
  }

  .dimension-inputs-grid,
  .colors-grid,
  .export-sub-row {
    grid-template-columns: 1fr;
  }

  .noise-viewport-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .view-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .view-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
  }
}
