/* Photo Mosaic Maker Online - Modern Material UI 3 (M3) Styles */
/* PicDriver Suite */

/* Workspace Layout */
.workspace-card {
  background: var(--bg-card, rgba(15, 23, 42, 0.75));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow-lg, 0 20px 40px -10px rgba(0, 0, 0, 0.5));
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 400px;
  min-height: 640px;
}

@media (max-width: 1080px) {
  .workspace-card {
    grid-template-columns: 1fr;
  }
}

/* Viewport Column */
.viewport-col {
  display: flex;
  flex-direction: column;
  background: #070a12;
  position: relative;
  min-height: 560px;
  overflow: hidden;
}

/* Controls Column */
.controls-col {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 120px);
  min-height: 600px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
}

@media (max-width: 1080px) {
  .controls-col {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    max-height: none;
  }
}

.controls-col::-webkit-scrollbar {
  width: 6px;
}

.controls-col::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 4px;
}

/* Dual Ingestion Grid */
.dual-uploader-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

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

.dual-drop-card {
  background: rgba(15, 23, 42, 0.65);
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 190px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.dual-drop-card:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.dual-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #818cf8;
  backdrop-filter: blur(6px);
  z-index: 2;
}

.dual-preview-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Preset Tile Packs Grid */
.tile-packs-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .tile-packs-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 540px) {
  .tile-packs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tile-pack-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tile-pack-card:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.tile-pack-card.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(79, 70, 229, 0.35) 100%);
  border-color: #6366f1;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

/* Sample Picker Bar on Dropzone */
.sample-picker-box {
  background: rgba(30, 41, 59, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.sample-presets-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.btn-sample-preset {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sample-preset:hover {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* 1-Click Mosaic Style Presets */
.style-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.style-preset-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.style-preset-card.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28) 0%, rgba(16, 185, 129, 0.2) 100%);
  border-color: #6366f1;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
}

.preset-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
}

.preset-card-desc {
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.25;
}

/* Floating Viewport Toolbar */
.viewport-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 10px;
  flex-wrap: wrap;
  z-index: 10;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary, #94a3b8);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.tool-btn:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.tool-btn.active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.zoom-display {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary, #f8fafc);
  min-width: 44px;
  text-align: center;
}

/* Canvas Viewport */
.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  background-color: #070a12;
  background-image: 
    linear-gradient(45deg, #0e1422 25%, transparent 25%),
    linear-gradient(-45deg, #0e1422 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0e1422 75%),
    linear-gradient(-45deg, transparent 75%, #0e1422 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.canvas-container:active {
  cursor: grabbing;
}

.mosaic-canvas {
  display: block;
  max-width: none;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  transition: none; /* Zero latency pan & zoom */
  transform-origin: center center;
  border-radius: 4px;
}

/* Panel Headers & Sub-panels */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.panel-icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-subtle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.sub-panel {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(10px);
}

.panel-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  margin-bottom: 2px;
}

/* Preset Chips */
.preset-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary, #94a3b8);
  padding: 5px 10px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.preset-chip.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
  font-weight: 700;
}

/* Switch Toggle */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  transition: 0.25s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s;
}

.switch-toggle input:checked + .toggle-slider {
  background-color: #6366f1;
}

.switch-toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Form Controls */
.select-input,
.text-input {
  width: 100%;
  background-color: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.select-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
  appearance: none;
}

.select-input:hover,
.text-input:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.select-input:focus,
.text-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6366f1;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.control-value {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: #818cf8;
}

/* Radiant CTA Buttons */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #db2777 100%);
  color: #ffffff;
  border: none;
  padding: 13px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(99, 102, 241, 0.55), 0 12px 30px rgba(219, 39, 119, 0.4);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

@keyframes pic-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Tile Preview Strip */
.mosaic-tile-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}

.mini-tile-thumb {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

/* Steps & Features */
.steps-grid,
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1024px) {
  .steps-grid,
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .steps-grid,
  .features-grid {
    grid-template-columns: 1fr;
  }
}
