/* =====================================================================
   AI Photo Editor layout (loaded after style.css)
   ===================================================================== */
.app.app-wide { max-width: 1440px; }
.brand-name { font-size: inherit; margin: 0; font-weight: 700; }

.ed-chips {
  list-style: none; padding: 0; margin: 14px 0 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
}
.ed-chips li {
  font-size: 0.78rem; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px;
  background: var(--panel-2);
}

.ed-shell {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: min(calc(100vh - 110px), 920px);
  min-height: 560px;
}

.ed-topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.ed-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ed-icon-btn { padding: 8px 12px; min-width: 36px; font-size: 1rem; line-height: 1; }
.ed-meta { color: var(--text-dim); font-size: 0.78rem; margin-left: 6px; white-space: nowrap; }
.ed-topbar .btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }

.ed-body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 330px;
}

.ed-tools {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 6px; overflow-y: auto;
  border-right: 1px solid var(--border);
}
.ed-tool {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px; border-radius: 12px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-dim); cursor: pointer; font: inherit;
}
.ed-tool:hover { background: var(--panel-2); color: var(--text); }
.ed-tool[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(124,108,255,0.22), rgba(56,189,248,0.12));
  border-color: var(--accent); color: var(--text);
}
.ed-tool-icon { font-size: 1.3rem; line-height: 1; }
.ed-tool-name { font-size: 0.68rem; font-weight: 600; text-align: center; line-height: 1.15; }
.ed-ai-badge {
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.04em;
  color: #fff; background: linear-gradient(135deg, #7c6cff, #38bdf8);
  border-radius: 999px; padding: 2px 6px; white-space: nowrap;
}
.ed-tool .ed-ai-badge { position: absolute; top: 4px; right: 4px; padding: 1px 5px; }

.ed-stage {
  position: relative; overflow: auto;
  display: flex;
  min-width: 0; min-height: 0;
}
.ed-stage.dragover { outline: 2px dashed var(--accent); outline-offset: -8px; }
.ed-stage-inner {
  position: relative; flex: none; margin: auto;
  box-shadow: 0 10px 40px -12px rgba(0,0,0,0.6);
}
#ed-view, #ed-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.ed-stage[data-pointer="draw"] #ed-overlay { touch-action: none; cursor: crosshair; }
.ed-stage.comparing::after {
  content: "Original"; position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 0.75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; pointer-events: none;
}

.ed-busy {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,12,24,0.55);
  backdrop-filter: blur(2px);
}
.ed-busy-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 22px; min-width: 240px; max-width: 80%;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.ed-busy-card p { margin: 0; font-size: 0.9rem; }
.ed-progress { width: 100%; height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.ed-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #7c6cff, #38bdf8); transition: width 0.2s ease; }
.ed-progress.indeterminate .ed-progress-fill { width: 35% !important; animation: edIndeterminate 1.1s ease-in-out infinite; }
@keyframes edIndeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.ed-panel {
  overflow-y: auto; padding: 14px 16px 0;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.ed-panel > div:last-child { display: flex; flex-direction: column; flex: 1; }
.ed-panel-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ed-panel-head h2 { margin: 0; font-size: 1.05rem; }

.panel-note { color: var(--text-dim); font-size: 0.8rem; line-height: 1.5; margin: 6px 0 10px; }
.panel-note:empty { display: none; }
.panel-note.dim { opacity: 0.85; }
.panel-section { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.panel-sub { margin: 0 0 8px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.panel-row { display: flex; gap: 8px; margin: 10px 0; }

.sl { margin: 0 0 12px; }
.sl-head { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 4px; }
.sl-head label { font-weight: 600; }
.sl-value { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.sl input[type="range"], .field input[type="range"] { width: 100%; accent-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field-label { font-size: 0.82rem; font-weight: 600; }
.field select, .field input[type="number"] {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 0.88rem;
}
.ed-panel input[type="color"], .ed-dialog input[type="color"] {
  width: 42px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: none; padding: 2px; cursor: pointer;
}

.seg { display: flex; flex-wrap: wrap; gap: 5px; }
.seg-btn {
  font: inherit; font-size: 0.8rem; font-weight: 600;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border);
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; cursor: pointer; margin: 0 0 10px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.check-row .field { margin-bottom: 10px; gap: 8px; }

.btn-wide { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-row .btn { padding: 8px 14px; font-size: 0.82rem; }
.btn-col { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.ed-panel .btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }

.apply-bar {
  position: sticky; bottom: 0; margin-top: auto;
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 0 14px;
  background: linear-gradient(to top, var(--panel) 75%, transparent);
}
.apply-bar .btn { padding: 10px 22px; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.swatch:hover { border-color: var(--accent); }

.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.filter-item {
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  background: none; border: 2px solid transparent; border-radius: 12px; padding: 3px;
  color: var(--text-dim); font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer;
}
.filter-item[aria-selected="true"] { border-color: var(--accent); color: var(--text); }
.filter-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; display: block; background: var(--panel-2); }

.sticker-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.sticker { font-size: 1.35rem; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 0; cursor: pointer; }
.sticker:hover { border-color: var(--accent); }
.text-input {
  width: 100%; resize: vertical; margin: 10px 0 12px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; font: inherit; font-size: 0.92rem;
}

.ed-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1f2440; color: #fff; border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 999px; font-size: 0.86rem; max-width: min(90vw, 560px); text-align: center;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ed-toast.show { opacity: 1; transform: translate(-50%, 0); }

.ed-dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px 6px;
  background: var(--panel); color: var(--text); width: min(92vw, 440px);
}
.ed-dialog::backdrop { background: rgba(5,6,14,0.6); }
.ed-dialog h2 { margin: 0 0 14px; font-size: 1.1rem; }
.ex-size-row { display: flex; align-items: flex-end; gap: 8px; }
.ex-size-row .field { flex: 1; min-width: 0; }
.ex-size-row input { width: 100%; }
.ex-x { padding-bottom: 20px; color: var(--text-dim); }

.content-block h3 { margin: 18px 0 6px; font-size: 1rem; }
.content-block ul, .content-block ol { padding-left: 20px; line-height: 1.7; color: var(--text-dim); }
.content-block li { margin-bottom: 6px; }
.content-block li strong { color: var(--text); }

/* Phones & small tablets: stage on top, tool strip, then the panel */
@media (max-width: 860px) {
  .ed-shell { height: auto; min-height: 0; }
  .ed-body { display: flex; flex-direction: column; }
  .ed-stage { height: 52vh; min-height: 300px; order: 1; }
  .ed-tools {
    order: 2; flex-direction: row; overflow-x: auto; overflow-y: hidden;
    border-right: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
  }
  .ed-tool { flex: 0 0 74px; }
  .ed-panel { order: 3; border-left: none; overflow: visible; }
  .ed-meta { display: none; }
  .filter-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
  .ed-topbar .btn-sm { padding: 7px 10px; }
}

/* Light mode */
:root[data-theme="light"] .ed-busy { background: rgba(240,242,250,0.6); }
:root[data-theme="light"] .ed-toast { background: #181b2c; }
:root[data-theme="light"] .ed-stage-inner { box-shadow: 0 10px 30px -14px rgba(20,24,50,0.35); }
:root[data-theme="light"] .content-block ul,
:root[data-theme="light"] .content-block ol { color: #3a3f57; }
:root[data-theme="light"] .content-block a { color: #5b4bdb; }

/* Shared site.css sizes buttons for marketing pages; the editor keeps its compact controls. */
.app .btn { min-height: 0; transform: none; }
.app .btn:active { transform: scale(0.97); }
.app .drop-sub, .app .drop-hint { margin-top: 6px; }
.ed-tool-icon { width: 22px; height: 22px; }
.ed-tool[aria-pressed="true"] .ed-tool-icon { color: var(--accent); }
.drop-icon .ico { width: 44px; height: 44px; color: var(--accent); }
.brand-icon .ico { width: 26px; height: 26px; color: var(--accent); }
.ed-chips li { display: inline-flex; align-items: center; gap: 6px; }
.ed-chips .ico { width: 15px; height: 15px; }
#ed-export .ico { width: 16px; height: 16px; vertical-align: -3px; }
