/* ═══════════════════════════════════════════════════════════════════════
   Photo Studio — standalone AI image editor (/edit).
   WB-035 (وحش بلال 2026-05-06): full visual rewrite per Bilal "بعدهن
   شكلهن كلش مو حلو مو بروفشنل غيرها كلها بتصميم احلى وارتب بروفشنل".

   DESIGN PHILOSOPHY (strict):
     • Less is more — remove decoration, keep structure
     • Discipline — 3 surface colors, 2 text levels, 1 accent
     • Borders > shadows for separation
     • Spacing > glow for hierarchy
     • Flat panels (NO glass-morphism, NO blur)
     • NO gradients except: primary CTA, brand badge
     • Active = solid accent bg, NOT gradient + shadow + glow

   References: Figma left panel, Linear, Adobe Firefly Web.
   Every .ps-* selector preserved so static/js/photo_studio.js works.
   ─────────────────────────────────────────────────────────────────── */

.ps-root {
  /* ── 3 surface colors only ─────────────────────────────────────── */
  --bg:        #0a0a0d;          /* page background — near-black, neutral */
  --surface:   #14141a;          /* panels — flat, no transparency */
  --surface-2: #1c1c24;          /* nested elements (toolbar groups, inputs) */
  --surface-3: #26262e;          /* hover state for nested elements */

  /* ── Borders ───────────────────────────────────────────────────── */
  --border:    #232329;          /* default 1px panel border */
  --border-2:  #2e2e36;          /* hover/focus border */
  --border-strong: #3a3a44;      /* prominent borders */

  /* ── Text — 2 levels only ─────────────────────────────────────── */
  --text:      #f5f5f7;          /* primary — high contrast */
  --text-2:    #9696a0;          /* secondary — 60% perceived */
  --text-3:    #5e5e68;          /* dim — labels/captions */

  /* ── Accent — single brand color ──────────────────────────────── */
  --accent:    #8b5cf6;
  --accent-2:  #a78bfa;          /* lighter for text on dark */
  --accent-soft: rgba(139,92,246,.12);
  --accent-soft-2: rgba(139,92,246,.20);

  /* ── Status ────────────────────────────────────────────────────── */
  --ok:        #22c55e;
  --warn:      #f59e0b;
  --danger:    #ef4444;
  --gold:      #c8a24e;          /* used ONLY for cost badges */

  /* ── Spacing scale ─────────────────────────────────────────────── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* ── Radii ─────────────────────────────────────────────────────── */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* ── ONE shadow value (used sparingly) ───────────────────────────── */
  --shadow:   0 1px 2px rgba(0,0,0,.40), 0 8px 24px rgba(0,0,0,.32);

  /* ── Page shell ────────────────────────────────────────────────── */
  min-height: calc(100vh - 60px);
  background: var(--bg);
  color: var(--text);
  padding: 32px 24px 96px;
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ps-wrap {
  max-width: 1480px;
  margin: 0 auto;
}

/* ═════════════════════════════════════════════════════════════════════
   PAGE HEADER — restrained product header
   ═══════════════════════════════════════════════════════════════════ */
.ps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.ps-head-title {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  letter-spacing: -0.4px;
  line-height: 1.2;
  color: var(--text);
}
.ps-head-title > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.ps-head-title .ps-badge-new {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  position: relative;
  top: -1px;
}
.ps-head-title .ps-lead {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 400;
  margin-inline-start: var(--sp-3);
  letter-spacing: 0;
  padding-inline-start: var(--sp-3);
  border-inline-start: 1px solid var(--border);
}
.ps-head-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ═════════════════════════════════════════════════════════════════════
   3-COLUMN GRID
   ═══════════════════════════════════════════════════════════════════ */
.ps-grid {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: var(--sp-3);
  align-items: stretch;
}
@media (max-width: 1180px) {
  .ps-grid { grid-template-columns: 220px 1fr 300px; }
}
@media (max-width: 980px) {
  .ps-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--sp-3);
  }
}

/* ═════════════════════════════════════════════════════════════════════
   PANELS — flat, single border, no shadows by default
   ═══════════════════════════════════════════════════════════════════ */
.ps-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.ps-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}

/* ═════════════════════════════════════════════════════════════════════
   LEFT — TOOL LIST (Figma-like sidebar)
   ═══════════════════════════════════════════════════════════════════ */
.ps-tools {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ps-tool {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: start;
  font-family: inherit;
  transition: background .12s ease, color .12s ease;
}
.ps-tool:hover {
  background: var(--surface-2);
  color: var(--text);
}
.ps-tool.active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}
.ps-tool-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-3);
  transition: color .12s ease;
}
.ps-tool:hover .ps-tool-icon { color: var(--text-2); }
.ps-tool.active .ps-tool-icon { color: var(--accent-2); }
.ps-tool-label {
  flex: 1;
  line-height: 1.2;
}
.ps-tool-cost {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  letter-spacing: .2px;
  font-feature-settings: "tnum";
}
.ps-tool.active .ps-tool-cost { color: var(--gold); }

/* ═════════════════════════════════════════════════════════════════════
   MIDDLE — CANVAS PANEL
   ═══════════════════════════════════════════════════════════════════ */
.ps-canvas-panel {
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  min-height: 600px;
}
.ps-canvas-toolbar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  padding: 0 0 var(--sp-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-3);
}
.ps-tb-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ps-tb-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .12s ease, color .12s ease;
}
.ps-tb-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.ps-tb-btn.active {
  background: var(--accent);
  color: #fff;
}
.ps-tb-btn[disabled] {
  opacity: .4;
  cursor: not-allowed;
}
.ps-tb-range {
  width: 110px;
  height: 3px;
  accent-color: var(--accent);
  cursor: pointer;
}
.ps-tb-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 var(--sp-1);
}
.ps-tb-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: .2px;
}

/* ── Canvas stage ─────────────────────────────────────────────────── */
.ps-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  min-height: 480px;
  border: 1px solid var(--border);
}

/* Empty state — minimal, confident */
.ps-stage-empty {
  text-align: center;
  color: var(--text-2);
  padding: 56px 32px;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}
.ps-stage-empty > div:first-child {
  /* Hero icon — single accent ring */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 32px !important;
  margin: 0 auto var(--sp-5) !important;
  color: var(--accent-2);
}
.ps-stage-empty h3 {
  font-size: 20px;
  color: var(--text);
  margin: 0 0 var(--sp-2);
  font-weight: 600;
  letter-spacing: -0.3px;
}
.ps-stage-empty p {
  font-size: 14px;
  margin: 0 0 var(--sp-6);
  max-width: 380px;
  margin-inline: auto;
  line-height: 1.6;
  color: var(--text-2);
}

/* Canvas host */
.ps-canvas-host {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 600px;
  line-height: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ps-canvas-host canvas {
  display: block;
  max-width: 100%;
  max-height: 600px;
}
.ps-canvas-host canvas.ps-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .55;
}
.ps-canvas-host.is-drawing canvas.ps-mask { pointer-events: auto; }

/* Brush cursor */
.ps-canvas-host.brush-cursor canvas.ps-mask { cursor: crosshair; }

/* ═════════════════════════════════════════════════════════════════════
   RIGHT — OPTIONS / INSPECTOR PANEL
   ═══════════════════════════════════════════════════════════════════ */
.ps-options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.ps-option-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.ps-option-row > label {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.ps-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.ps-legend {
  padding: 0;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
}
.ps-expand-pad .e-cell > label {
  font-size: 10px;
  color: var(--text-3);
  margin-bottom: 2px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Form controls — clean, minimal ──────────────────────────────── */
.ps-input, .ps-textarea, .ps-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: border-color .15s ease, background .15s ease;
  box-sizing: border-box;
  line-height: 1.5;
}
.ps-textarea { min-height: 80px; }
.ps-input::placeholder, .ps-textarea::placeholder {
  color: var(--text-3);
}
.ps-input:hover, .ps-textarea:hover, .ps-select:hover {
  border-color: var(--border-2);
}
.ps-input:focus, .ps-textarea:focus, .ps-select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ps-select {
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-end: 36px;
}

/* ── Direction grid (relight) ────────────────────────────────────── */
.ps-dir-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.ps-dir-btn {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s ease;
}
.ps-dir-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  color: var(--text);
}
.ps-dir-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Relight pad (preserved torch interaction) ───────────────────── */
.ps-relight-pad {
  position: relative;
  aspect-ratio: 1/1;
  width: 100%;
  max-width: 220px;
  margin: var(--sp-3) auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.ps-relight-pad.dragging { cursor: grabbing; }
.ps-pad-label {
  position: absolute; top: 12px; left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
  pointer-events: none;
  letter-spacing: .3px;
}
.ps-pad-arrow {
  position: absolute;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  line-height: 1;
}
.ps-pad-arrow--top    { top: 32px;    left: 50%; transform: translateX(-50%); }
.ps-pad-arrow--bottom { bottom: 12px; left: 50%; transform: translateX(-50%); }
.ps-pad-arrow--left   { left: 12px;   top: 50%;  transform: translateY(-50%); }
.ps-pad-arrow--right  { right: 12px;  top: 50%;  transform: translateY(-50%); }
.ps-pad-handle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  transform-origin: center;
  color: var(--gold);
  pointer-events: none;
  transition: transform .15s cubic-bezier(.4,0,.2,1);
}
.ps-pad-handle-svg { display: block; overflow: visible; }
.ps-pad-body { fill: var(--gold); }
.ps-pad-beam { fill: url(#psBeamGradient); }
.ps-relight-pad:not(.has-beam) .ps-pad-beam { fill: rgba(200,162,78,.45); }
.ps-relight-pad.dragging .ps-pad-handle {
  filter: drop-shadow(0 0 8px rgba(200,162,78,.55));
}
.ps-relight-pad.back-mode .ps-pad-handle { opacity: 0.55; }
.ps-relight-pad.back-mode .ps-pad-body,
.ps-relight-pad.back-mode .ps-pad-beam   { fill: var(--accent-2); }

/* ── Soft / Color toggle pills ───────────────────────────────────── */
.ps-soft-toggle, .ps-color-toggle {
  display: grid;
  gap: 4px;
}
.ps-soft-toggle  { grid-template-columns: repeat(2, 1fr); }
.ps-color-toggle { grid-template-columns: repeat(3, 1fr); }
.ps-soft-btn, .ps-color-btn {
  padding: 8px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s ease;
}
.ps-soft-btn:hover, .ps-color-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  color: var(--text);
}
.ps-soft-btn.active, .ps-color-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Style preset chips ──────────────────────────────────────────── */
.ps-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.ps-preset {
  padding: 10px 8px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s ease;
  text-align: center;
}
.ps-preset:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  color: var(--text);
}
.ps-preset.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Outpaint expand pad ─────────────────────────────────────────── */
.ps-expand-pad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 6px;
  justify-items: center;
  align-items: center;
  max-width: 280px;
  margin: 0 auto;
}
.ps-expand-pad .e-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: var(--text-3);
}
.ps-expand-pad input[type=number] {
  width: 60px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}
.ps-expand-pad input[type=number]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ps-expand-center {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
}

/* ═════════════════════════════════════════════════════════════════════
   BUTTONS — disciplined hierarchy
   ═══════════════════════════════════════════════════════════════════ */
.ps-btn {
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  letter-spacing: -0.1px;
  white-space: nowrap;
  line-height: 1.2;
}

/* Primary — the ONE place we use a gradient. Subtle, not loud. */
.ps-btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-color: var(--accent);
}
.ps-btn-primary:hover:not([disabled]) {
  background: #7c3aed;
  border-color: #7c3aed;
}
.ps-btn-primary[disabled], .ps-btn[disabled] {
  opacity: .4;
  cursor: not-allowed;
}

/* Secondary — flat, bordered */
.ps-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-2);
  font-weight: 500;
}
.ps-btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

/* Gold — kept for back-compat (unused by default, but JS may add it) */
.ps-btn-gold {
  background: var(--gold);
  color: #1a1428;
  font-weight: 600;
}
.ps-btn-gold:hover { background: #d4af4a; }

/* Ghost — minimal */
.ps-btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.ps-btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.ps-btn-block {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
}

/* ═════════════════════════════════════════════════════════════════════
   APPLY FOOTER
   ═══════════════════════════════════════════════════════════════════ */
.ps-apply-foot {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  flex-shrink: 0;
  margin-top: auto;
}
.ps-apply-foot .ps-btn {
  flex: 0 0 auto;
  min-height: 0;
  padding: 12px 16px;
  line-height: 1.2;
}
.ps-apply-foot .ps-btn > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.ps-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-2);
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-weight: 500;
}
.ps-cost-row strong {
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
  font-feature-settings: "tnum";
}

/* ═════════════════════════════════════════════════════════════════════
   HISTORY STRIP
   ═══════════════════════════════════════════════════════════════════ */
.ps-history {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-2) 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.ps-history::-webkit-scrollbar { height: 6px; }
.ps-history::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}
.ps-hist-item {
  position: relative;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color .12s ease;
}
.ps-hist-item:hover {
  border-color: var(--border-strong);
}
.ps-hist-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ps-hist-item.current {
  border-color: var(--accent);
}
.ps-hist-item .ps-hist-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 9px;
  font-weight: 600;
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 2px 4px;
  text-align: center;
  line-height: 1.2;
  letter-spacing: .2px;
}

/* ═════════════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════════════ */
.ps-stage-loading {
  position: absolute;
  inset: 0;
  background: rgba(10,10,13,.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  z-index: 5;
  border-radius: var(--r-md);
}
.ps-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: psSpin 0.8s linear infinite;
}
@keyframes psSpin { to { transform: rotate(360deg); } }
.ps-loading-txt {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .2px;
}

/* ═════════════════════════════════════════════════════════════════════
   EMPTY-STATE UPLOAD CTA
   ═══════════════════════════════════════════════════════════════════ */
.ps-upload-cta {
  display: inline-flex;
  gap: var(--sp-2);
  align-items: center;
  padding: 11px 20px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease;
  font-size: 14px;
  letter-spacing: -0.1px;
  border: 1px solid var(--accent);
}
.ps-upload-cta:hover {
  background: #7c3aed;
  border-color: #7c3aed;
}

/* ═════════════════════════════════════════════════════════════════════
   HINTS — minimal helper text boxes
   ═══════════════════════════════════════════════════════════════════ */
.ps-hint {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.ps-row-tight {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ═════════════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 980px) {
  .ps-root { padding: 16px 12px 80px; }
  .ps-head { margin-bottom: var(--sp-4); }
  .ps-head-title { font-size: 18px; }
  .ps-head-title .ps-lead { display: none; }
  .ps-canvas-panel { min-height: auto; }
  .ps-stage { min-height: 320px; }
  .ps-canvas-host canvas { max-height: 60vh; }
  .ps-stage-empty { padding: 36px 20px; }
  .ps-stage-empty > div:first-child {
    width: 56px;
    height: 56px;
    font-size: 26px !important;
    margin-bottom: var(--sp-4) !important;
  }
  .ps-stage-empty h3 { font-size: 17px; }
  .ps-stage-empty p { font-size: 13px; }
  .ps-tools {
    flex-direction: row;
    overflow-x: auto;
    gap: var(--sp-1);
    padding-bottom: var(--sp-1);
    scrollbar-width: thin;
  }
  .ps-tool {
    flex-shrink: 0;
    min-width: 130px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .ps-panel { padding: var(--sp-3); }
}

/* ────────────────────────────────────────────────────────────────────
   RFC-007 (2026-05-10 Zain): phone-friendly responsive floor.
   The previous "smallest" breakpoint was @max-width:980px which still
   assumes a tablet-sized viewport. On phones (~360-480px) the page felt
   oversized — chips overflowed, header padding was huge, canvas dominated
   the screen. This block tightens everything for narrow viewports.
   Why "why" comment: Bilal's photo_studio was designed desktop-first
   2026-04-25; the 980px floor was added without phone testing. Zain
   confirmed 'image edit too big for mobile' on phone PWA 2026-05-10.
   ──────────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .ps-root { padding: 8px 8px 72px; }
  .ps-head { margin-bottom: var(--sp-3); }
  .ps-head-title { font-size: 15px; }
  .ps-head-title .ps-lead { display: none; }

  /* Tool chips: shrink and let them be smaller; was min-width:130px → chips overflowed badly */
  .ps-tool {
    flex-shrink: 0;
    min-width: 78px;
    padding: 6px 8px;
    font-size: 11px;
  }
  .ps-tools {
    gap: 4px;
    padding-bottom: 4px;
  }

  /* Canvas / stage: don't claim half the viewport */
  .ps-stage { min-height: 220px; }
  .ps-canvas-host canvas { max-height: 50vh; }
  .ps-canvas-panel { min-height: auto; }

  /* Empty-state card: tighter */
  .ps-stage-empty { padding: 24px 14px; }
  .ps-stage-empty > div:first-child {
    width: 44px;
    height: 44px;
    font-size: 22px !important;
    margin-bottom: var(--sp-3) !important;
  }
  .ps-stage-empty h3 { font-size: 15px; }
  .ps-stage-empty p  { font-size: 12px; line-height: 1.4; }

  /* Side panels: tighter padding */
  .ps-panel { padding: var(--sp-2); }

  /* Bottom action bar: smaller font + padding so the upload button fits cleanly */
  .ps-action-bar { padding: 8px 12px; }
  .ps-action-btn { font-size: 13px; padding: 10px 14px; }
}


/* ════════════════════════════════════════════════════════════════════════
   WB-231 PHOTO-STUDIO-CINEMA (وحش بلال 2026-05-13):
   Cinema-green override for /photo-studio. Redefines the 4 --accent*
   CSS variables at .ps-root scope → cascades through every rule that
   uses var(--accent), var(--accent-2), var(--accent-soft), var(--accent-soft-2).
   Plus explicit overrides for 2 hardcoded #7c3aed hover states.
   ════════════════════════════════════════════════════════════════════════ */

.ps-root {
  --accent:        #22c55e !important;
  --accent-2:      #86efac !important;
  --accent-soft:   rgba(34, 197, 94, 0.12) !important;
  --accent-soft-2: rgba(34, 197, 94, 0.22) !important;
}

/* Primary button hover — was hardcoded #7c3aed at line 695 */
.ps-root .ps-btn-primary:hover:not([disabled]) {
  background: #16a34a !important;
  border-color: #16a34a !important;
}

/* Upload CTA hover — was hardcoded #7c3aed at line 889 */
.ps-root .ps-upload-cta:hover {
  background: #16a34a !important;
  border-color: #16a34a !important;
}

/* Primary button base — strengthen so the gradient reads cinema */
.ps-root .ps-btn-primary {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  border-color: #22c55e !important;
  color: #03110a !important;
}

/* Upload CTA base */
.ps-root .ps-upload-cta {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  border-color: #22c55e !important;
  color: #03110a !important;
}

/* Active tool — solid green pill */
.ps-root .ps-tool.active {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: rgba(134, 239, 172, 0.45) !important;
}
.ps-root .ps-tool.active .ps-tool-label {
  color: #86efac !important;
}
.ps-root .ps-tool.active .ps-tool-icon {
  color: #86efac !important;
}

/* NEW badge in header */
.ps-root .ps-badge-new {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: rgba(134, 239, 172, 0.40) !important;
  color: #86efac !important;
}

/* Cost badge on active tool */
.ps-root .ps-tool.active .ps-tool-cost {
  color: #d1fae5 !important;
}

/* =========================================================================
 * RFC-022 PHASE-1 (2026-05-14 Session B): mask brush undo/redo toolbar.
 * Floating 2-button toolbar at top-LEFT of .pie-image-stage (mirroring the
 * X delete button at top-right). Additive on top of Session A's RFC-027.
 * ========================================================================= */
.pie-mask-undo-toolbar {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 4px;
  z-index: 5;
}
.pie-mask-undo-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.pie-mask-undo-btn:active:not(:disabled) {
  background: rgba(61,220,151,0.85);
  color: #1a1d20;
}
.pie-mask-undo-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
/* ============= END RFC-022 PHASE-1 ============= */
