/**
 * dopic.app - Mobile Image Stitch & Collage Workbench Styles
 * Apple iOS Minimalist White Design System for tools/stitch/m/
 */

/* Container & Layout */
.m-workspace-wrap .app-box {
  padding: 0 0.75rem 1.5rem !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Editor Layout: Single Column Mobile Flow */
.m-workspace-wrap .editor-layout,
#editorLayout {
  display: none;
  flex-direction: column !important;
  gap: 0.75rem !important;
  width: 100% !important;
  margin-top: 0.5rem !important;
  box-sizing: border-box !important;
}

#editorLayout.active,
#editorLayout[style*="grid"],
#editorLayout[style*="block"],
#editorLayout[style*="flex"] {
  display: flex !important;
  flex-direction: column !important;
}

/* 1. Preview Stage (Top Photo Studio Viewport) */
.m-workspace-wrap .preview-stage {
  order: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05) !important;
  overflow: hidden !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Top Toolbar: Clean, Edge-to-Edge Minimalist Bar */
.m-workspace-wrap .stage-toolbar {
  width: 100% !important;
  align-self: stretch !important;
  background: #ffffff !important;
  border: none !important;
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 0 14px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  gap: 10px !important;
  box-sizing: border-box !important;
}

/* Left: Format Selector */
.m-workspace-wrap .stage-toolbar-format {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.m-workspace-wrap .stage-format-label {
  font-size: 0.8rem !important;
  color: #64748b !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  letter-spacing: -0.01em !important;
}

.m-workspace-wrap .stage-toolbar select#exportFormat {
  height: 30px !important;
  padding: 0 24px 0 9px !important;
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat calc(100% - 7px) center !important;
  color: #0f172a !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  outline: none !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: border-color 0.15s ease !important;
}

.m-workspace-wrap .stage-toolbar select#exportFormat:focus {
  border-color: #4f46e5 !important;
}

/* Right: Add More Images Button */
.m-workspace-wrap .btn-stage-add-more {
  height: 30px !important;
  padding: 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
  border-radius: 8px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  box-shadow: none !important;
  transition: all 0.15s ease !important;
}

.m-workspace-wrap .btn-stage-add-more:active {
  background: #e2e8f0 !important;
  transform: scale(0.97) !important;
}

/* Canvas Stage Viewport */
.m-workspace-wrap .canvas-scroll-wrap {
  width: 100% !important;
  align-self: stretch !important;
  flex: 1 1 auto !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch !important;
  max-height: 48vh !important;
  min-height: 240px !important;
  padding: 12px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  background: repeating-conic-gradient(#fafbfc 0% 25%, #f1f4f8 0% 50%) 50% / 14px 14px !important;
  box-sizing: border-box !important;
}

.m-workspace-wrap #stitchCanvas {
  max-width: 100% !important;
  max-height: 44vh !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08) !important;
  border-radius: 8px !important;
  display: block !important;
  margin: 0 auto !important;
}

/* 2. Action Bar (Between Preview & Settings) */
.m-workspace-wrap .action-bar,
#actionBar {
  order: 2 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: 10px !important;
  width: 100% !important;
  margin-top: 0.4rem !important;
  margin-bottom: 0.4rem !important;
  box-sizing: border-box !important;
}

.m-workspace-wrap .btn-main {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  border-radius: 12px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  box-sizing: border-box !important;
  padding: 0 1rem !important;
  line-height: 1 !important;
}

.m-workspace-wrap .btn-main:active {
  transform: scale(0.97) !important;
}

.m-workspace-wrap .btn-secondary,
#btnReset {
  flex: 1 1 0 !important;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

.m-workspace-wrap .btn-secondary:active,
#btnReset:active {
  background: #f8fafc !important;
  transform: scale(0.99) !important;
}

.m-workspace-wrap .btn-download,
#btnDownload {
  flex: 2 1 0 !important;
  background: #0f172a !important;
  border: 1px solid #0f172a !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.m-workspace-wrap .btn-download:active,
#btnDownload:active {
  background: #1e293b !important;
  transform: scale(0.99) !important;
}

.m-workspace-wrap .btn-download:active,
#btnDownload:active {
  background: #4338ca !important;
}

/* 3. Control Panel (Settings Sections below Canvas) */
.m-workspace-wrap .control-panel {
  order: 3 !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05) !important;
  padding: 1.15rem 1rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1.25rem !important;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.m-workspace-wrap .panel-block-title {
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  margin-bottom: 0.6rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* Direction Mode Switcher (Symmetrical 3 Columns) */
.m-workspace-wrap .dir-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.m-workspace-wrap .dir-btn {
  padding: 10px 4px !important;
  border: 1.5px solid #e2e8f0 !important;
  background: #f8fafc !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: #475569 !important;
  cursor: pointer !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  transition: all 0.15s ease !important;
  box-sizing: border-box !important;
}

.m-workspace-wrap .dir-btn svg {
  width: 18px !important;
  height: 18px !important;
  stroke-width: 2 !important;
}

.m-workspace-wrap .dir-btn.active {
  border-color: #4f46e5 !important;
  background: #eef2ff !important;
  color: #4f46e5 !important;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.12) !important;
}

/* Image Thumbnails List */
.m-workspace-wrap .thumb-list-wrap {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  max-height: 200px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-right: 2px !important;
}

.m-workspace-wrap .thumb-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 6px 10px !important;
  gap: 8px !important;
  box-sizing: border-box !important;
}

.m-workspace-wrap .thumb-preview {
  width: 40px !important;
  height: 40px !important;
  border-radius: 6px !important;
  object-fit: cover !important;
  background: #e2e8f0 !important;
  flex-shrink: 0 !important;
}

.m-workspace-wrap .thumb-info {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.m-workspace-wrap .thumb-name {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.m-workspace-wrap .thumb-size {
  font-size: 0.7rem !important;
  color: #64748b !important;
  margin-top: 1px !important;
}

.m-workspace-wrap .thumb-btns {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-shrink: 0 !important;
}

.m-workspace-wrap .thumb-btn-sm {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  padding: 4px 8px !important;
  cursor: pointer !important;
  color: #475569 !important;
  line-height: 1 !important;
}

.m-workspace-wrap .thumb-btn-sm:active {
  background: #f1f5f9 !important;
}

.m-workspace-wrap .thumb-btn-sm.del {
  color: #ef4444 !important;
  border-color: #fecaca !important;
}

.m-workspace-wrap .thumb-btn-sm.del:active {
  background: #fee2e2 !important;
}

/* Sliders */
.m-workspace-wrap .slider-row {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.35rem !important;
  margin-bottom: 0.85rem !important;
}

.m-workspace-wrap .slider-header {
  display: flex !important;
  justify-content: space-between !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  color: #475569 !important;
}

.m-workspace-wrap .slider-header span.val {
  font-weight: 700 !important;
  color: #0f172a !important;
}

.m-workspace-wrap input[type="range"] {
  width: 100% !important;
  accent-color: #4f46e5 !important;
  cursor: pointer !important;
  height: 6px !important;
}

/* Color Options */
.m-workspace-wrap .color-options {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

.m-workspace-wrap .color-dot {
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  border: 2px solid #cbd5e1 !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  transition: transform 0.15s ease !important;
}

.m-workspace-wrap .color-dot.active {
  border-color: #4f46e5 !important;
  outline: 2px solid #a5b4fc !important;
  transform: scale(1.08) !important;
}

.m-workspace-wrap .color-picker-input {
  width: 30px !important;
  height: 30px !important;
  border: 2px solid #cbd5e1 !important;
  padding: 0 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  background: transparent !important;
}
