/* =========================================================================
   dopic.app - Mobile DSLR Blur & Bokeh Studio Stylesheet
   Dedicated mobile controls & comparison viewport layout
   ========================================================================= */

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
}

/* 1. Main Workspace Stage Container */
.m-workspace-stage {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  margin-bottom: 0.85rem;
  position: relative;
}

.m-stage-header {
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-stage-header .stage-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 3px 12px 3px 4px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  max-width: 100%;
}

.m-stage-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.22);
  flex-shrink: 0;
  line-height: 1.3;
}

.m-stage-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* 2. Comparison Viewport & Canvases */
.m-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 460px;
  background: #f1f5f9;
  overflow: hidden;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  touch-action: none;
}

#resultCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.m-before-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

#beforeCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* 3. Interactive Split Divider & Handle */
.m-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2.5px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 20;
}

.m-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  background: #ffffff;
  border: 2px solid #0284c7;
  border-radius: 50%;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0284c7;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: ew-resize;
  letter-spacing: -1px;
}

/* 4. Quick Action Pills Under Viewport */
.m-quick-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.65rem 0.5rem;
  background: #ffffff;
  border-top: 1px solid var(--border, #e2e8f0);
  flex-wrap: wrap;
}

.m-btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.m-btn-pill:active {
  background: #e2e8f0;
  transform: scale(0.97);
}

/* 5. Mobile Action Row (Album Upload + Camera) */
.m-stage-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0.5rem 0 0.85rem 0;
}

.m-stage-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--border, #e2e8f0);
}

.m-btn-album {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.m-btn-album:active {
  background: #0369a1;
}

.m-btn-camera {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--border, #e2e8f0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.m-btn-camera:active {
  background: #f8fafc;
}

/* 6. Studio Controls Card */
.m-studio-box {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.m-blur-slider-card {
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 0.85rem;
}

.m-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.m-slider {
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  outline: none;
  -webkit-appearance: none;
  background: #cbd5e1;
  accent-color: #0284c7;
  cursor: pointer;
}

.m-quick-pills-row {
  display: flex;
  gap: 5px;
  margin-top: 0.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.m-pill-aperture {
  flex: 1;
  padding: 5px 6px;
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.m-pill-aperture.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0284c7;
  font-weight: 700;
}

/* 7. Bokeh Shapes */
.m-compact-bokeh {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.m-compact-pill {
  padding: 7px 4px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.m-compact-pill.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0284c7;
  font-weight: 700;
}

/* 8. Advanced Details Accordion */
.m-advanced-details {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}

.m-advanced-details summary {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
}

.m-focus-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.m-mode-btn {
  padding: 5px 4px;
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.m-mode-btn.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  font-weight: 700;
}

/* 9. Brush Dock Toolbar */
.canvas-brush-dock {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.brush-dock-modes {
  display: flex;
  gap: 6px;
}

.dock-btn-brush {
  flex: 1;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
}

.dock-btn-brush.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0284c7;
}

.brush-dock-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dock-slider {
  flex: 1;
  accent-color: #0284c7;
}

.dock-size-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0284c7;
  min-width: 32px;
}

.dock-btn-action,
.dock-btn-close {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border, #e2e8f0);
  background: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.dock-hint {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 4px;
  text-align: center;
}

/* 10. Focus Ring & Loading Spinner */
.m-stage-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 30;
}

.m-stage-loading.is-hidden {
  display: none !important;
}

.m-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: blurSpin 0.8s linear infinite;
}

@keyframes blurSpin {
  to { transform: rotate(360deg); }
}

.m-focus-ring {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 2px solid #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 10px #0284c7;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 15;
  display: none;
}

.brush-cursor-ring {
  position: absolute;
  border: 2px dashed rgba(2, 132, 199, 0.85);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 25;
  display: none;
}
