/* ============================================================
   SM POST ENGINE — smPostEngine.css
   © 2026 Paradiddle Publishing. All rights reserved.
   ============================================================ */

/* ── OVERLAY ─────────────────────────────────────────────── */

#smeOverlayBackdrop {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  animation: smeFadeIn 0.2s ease;
}

@keyframes smeFadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes smeFadeOut { from { opacity:1 } to { opacity:0 } }
@keyframes smeSlideIn { from { transform:translateX(-100%);opacity:0 } to { transform:translateX(0);opacity:1 } }
@keyframes smeSlideOut{ from { transform:translateX(0);opacity:1 } to { transform:translateX(-100%);opacity:0 } }

#smePanel {
  width: 860px;
  max-width: 96vw;
  height: 100vh;
  background: #0e0e0e;
  border: none;
  border-right: 1px solid #2e2e2e;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: smeSlideIn 0.28s cubic-bezier(0.16,1,0.3,1);
  align-self: flex-start;
}

/* ── TOP BAR ─────────────────────────────────────────────── */

.sme-top-bar {
  height: 52px;
  min-height: 52px;
  background: #181818;
  border-bottom: 1px solid #2e2e2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
}

.sme-engine-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: #e2e2e2;
  font-family: 'Inter', sans-serif;
}

.sme-engine-sub {
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: #4a5260;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
}

.sme-top-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sme-close-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.48);
  cursor: pointer;
  font-size: 11px;
  padding: 5px 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}
.sme-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.22);
}

/* ── BODY ────────────────────────────────────────────────── */

.sme-body {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
  min-height: 0;
}

/* ── LEFT PANEL ──────────────────────────────────────────── */

.sme-left {
  background: linear-gradient(180deg, #1c1c2a 0%, #181818 100%);
  border-right: 1px solid #2e2e2e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  gap: 0;
}

.sme-left-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  gap: 16px;
  display: flex;
  flex-direction: column;
}

.sme-left-scroll::-webkit-scrollbar { width: 5px; }
.sme-left-scroll::-webkit-scrollbar-track { background: transparent; }
.sme-left-scroll::-webkit-scrollbar-thumb { background: rgba(91,45,142,0.4); border-radius: 3px; }
.sme-left-scroll::-webkit-scrollbar-thumb:hover { background: rgba(91,45,142,0.7); }

.sme-left-footer {
  padding: 12px;
  border-top: 1px solid #2e2e2e;
  background: linear-gradient(180deg, #1c1c2a 0%, #181818 100%);
  flex-shrink: 0;
}

.sme-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4a5260;
  font-family: 'Inter', sans-serif;
  margin-bottom: 6px;
}

/* Platform selector */
.sme-platform-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sme-platform-btn {
  flex: 1;
  min-width: 44px;
  height: 36px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #7a8494;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sme-platform-btn:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-platform-btn.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}

/* Post type selector */
.sme-type-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sme-type-btn {
  width: 100%;
  height: 36px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #7a8494;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sme-type-btn:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-type-btn.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}

/* Format selector */
.sme-format-row {
  display: flex;
  gap: 6px;
}

.sme-format-btn {
  flex: 1;
  height: 36px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #7a8494;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sme-format-btn:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-format-btn.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}

/* Content inputs */
.sme-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sme-textarea {
  width: 100%;
  box-sizing: border-box;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: #e2e2e2;
  outline: none;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.sme-textarea:focus { border-color: rgba(91,45,142,0.5); }
.sme-textarea::placeholder { color: #4a5260; }

.sme-input {
  width: 100%;
  box-sizing: border-box;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: #e2e2e2;
  outline: none;
  transition: border-color 0.15s;
}
.sme-input:focus { border-color: rgba(91,45,142,0.5); }
.sme-input::placeholder { color: #4a5260; }

/* Logo/image upload */
.sme-upload-row {
  display: flex;
  gap: 8px;
}

.sme-upload-btn {
  flex: 1;
  min-width: 60px;
  min-height: 30px;
  height: 30px;
  background: #1a1a1a;
  border: 1px dashed #2e2e2e;
  border-radius: 8px;
  color: #4a5260;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sme-upload-btn:hover {
  border-color: #5B2D8E;
  color: #c084fc;
}
.sme-upload-btn.has-file {
  border-style: solid;
  border-color: rgba(91,45,142,0.4);
  color: #c084fc;
  background: rgba(91,45,142,0.1);
}

/* Colour inputs */
.sme-colour-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sme-colour-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #2e2e2e;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.sme-colour-label {
  font-size: 0.72rem;
  color: #7a8494;
  font-family: 'Inter', sans-serif;
  flex: 1;
}

/* Build button */
.sme-build-btn {
  width: 100%;
  min-height: 44px;
  height: 44px;
  background: rgba(91,45,142,0.25);
  border: 1px solid rgba(91,45,142,0.5);
  border-radius: 10px;
  color: #c084fc;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sme-build-btn:hover {
  background: rgba(91,45,142,0.4);
  border-color: #5B2D8E;
  color: #fff;
}
.sme-build-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.sme-build-btn.building {
  animation: smePulse 1s infinite;
}
@keyframes smePulse {
  0%,100% { opacity:1 }
  50%      { opacity:0.5 }
}

@keyframes leExplodeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes leExplodeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.97); }
}

/* ── RIGHT PANEL ─────────────────────────────────────────── */

.sme-right {
  display: flex;
  flex-direction: column;
  background: #0e0e0e;
  overflow: hidden;
}

/* Canvas preview area */
.sme-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.sme-canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #2e2e2e;
  font-family: 'Inter', sans-serif;
}

.sme-canvas-empty-icon {
  font-size: 3rem;
  opacity: 0.3;
}

.sme-canvas-empty-text {
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4a5260;
}

#smeCanvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  display: none;
}

/* Caption area */
.sme-caption-wrap {
  border-top: 1px solid #2e2e2e;
  padding: 12px 16px;
  background: #181818;
  flex-shrink: 0;
}

.sme-caption-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4a5260;
  font-family: 'Inter', sans-serif;
  margin-bottom: 6px;
}

.sme-caption-text {
  width: 100%;
  box-sizing: border-box;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: #e2e2e2;
  outline: none;
  resize: none;
  height: 80px;
  line-height: 1.5;
}
.sme-caption-text:focus { border-color: rgba(91,45,142,0.5); }

/* Bottom bar */
.sme-bottom-bar {
  height: 48px;
  min-height: 48px;
  background: #181818;
  border-top: 1px solid #2e2e2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
}

.sme-status {
  font-size: 0.72rem;
  color: #4a5260;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}
.sme-status.building { color: #f59e0b; }
.sme-status.ready    { color: #39ff88; }
.sme-status.error    { color: #ef4444; }

.sme-action-btns {
  display: flex;
  gap: 8px;
}

.sme-action-btn {
  height: 32px;
  padding: 0 16px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #7a8494;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sme-action-btn:hover {
  border-color: #5B2D8E;
  color: #c084fc;
}
.sme-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.sme-action-btn.primary {
  background: rgba(91,45,142,0.2);
  border-color: rgba(91,45,142,0.4);
  color: #c084fc;
}
.sme-action-btn.primary:hover {
  background: rgba(91,45,142,0.35);
  border-color: #5B2D8E;
  color: #fff;
}

/* ── PROVIDER SELECTOR ───────────────────────────────────── */

.sme-provider-row {
  display: flex;
  gap: 6px;
}

.sme-provider-btn {
  flex: 1;
  height: 36px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #7a8494;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sme-provider-btn:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-provider-btn.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}

/* ── CONTENT MODE TOGGLE ─────────────────────────────────── */

.sme-toggle-row {
  display: flex;
  gap: 6px;
}

.sme-toggle-btn {
  flex: 1;
  height: 36px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #7a8494;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.sme-toggle-btn:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-toggle-btn.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}
.sme-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.65rem;
  font-weight: 400;
  color: #e2e2e2;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}
.sme-toggle-btn:hover .sme-tooltip {
  display: block;
}

/* ── OUTPUT CONTRAST WARNING ─────────────────────────────── */

.sme-contrast-warn {
  font-size: 0.68rem;
  color: #f59e0b;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: 'Inter', sans-serif;
}

/* ── ASSET ROW ───────────────────────────────────────────── */

.sme-asset-row {
  display: flex;
  gap: 6px;
}

.sme-asset-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ── OPACITY / FX SLIDERS ────────────────────────────────── */

.sme-opacity-slider {
  width: 100%;
  height: 2px;
  accent-color: #5B2D8E;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
  transition: opacity 0.15s;
}
.sme-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5B2D8E;
  cursor: pointer;
}
.sme-opacity-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5B2D8E;
  cursor: pointer;
  border: none;
}
.sme-opacity-slider:not([disabled]) {
  opacity: 1;
  cursor: pointer;
}
.sme-opacity-slider[disabled] {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

/* Tone slider — teal accent */
.sme-tone-slider {
  accent-color: #06b6d4;
}
.sme-tone-slider::-webkit-slider-thumb {
  background: #06b6d4;
}
.sme-tone-slider::-moz-range-thumb {
  background: #06b6d4;
}

/* Blur slider — amber accent */
.sme-blur-slider {
  accent-color: #f59e0b;
}
.sme-blur-slider::-webkit-slider-thumb {
  background: #f59e0b;
}
.sme-blur-slider::-moz-range-thumb {
  background: #f59e0b;
}

/* Randomise slider — green accent */
.sme-rnd-slider {
  accent-color: #39ff88;
}
.sme-rnd-slider::-webkit-slider-thumb {
  background: #39ff88;
}
.sme-rnd-slider::-moz-range-thumb {
  background: #39ff88;
}

/* ── BODY EFFECT CYCLE BUTTON ────────────────────────────── */

.sme-fx-cycle-btn {
  width: 100%;
  height: 20px;
  background: #1a1a1a;
  border: 1px dashed #2e2e2e;
  border-radius: 4px;
  color: #4a5260;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}
.sme-fx-cycle-btn:hover {
  border-color: #5B2D8E;
  color: #c084fc;
}
.sme-fx-cycle-btn.active {
  border-style: solid;
  border-color: rgba(91,45,142,0.4);
  color: #c084fc;
  background: rgba(91,45,142,0.1);
}
.sme-fx-cycle-btn[disabled] {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── PATTERN STYLES ──────────────────────────────────────── */

.sme-pattern-styles {
  margin-top: 4px;
}

.sme-pattern-style-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sme-style-btn {
  flex: 1;
  min-width: 72px;
  height: 30px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  color: #7a8494;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sme-style-btn:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-style-btn.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}
.sme-style-surprise {
  border-color: rgba(255,180,80,0.3);
  color: #ffb450;
}
.sme-style-surprise:hover {
  border-color: #ffb450;
  color: #ffb450;
}
.sme-style-surprise.active {
  background: rgba(255,180,80,0.1);
  border-color: #ffb450;
  color: #ffb450;
}

/* ── TEMPLATE STRIP ──────────────────────────────────────── */

.sme-strip-grid {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 38px;
  gap: 6px;
  padding: 6px;
  background: #141414;
  border-top: 1px solid #2e2e2e;
  border-bottom: 1px solid #2e2e2e;
  flex-shrink: 0;
}

.sme-strip-inner {
  flex: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sme-strip-row {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex: 1;
}

.sme-strip-anchor {
  flex: 0.6;
  height: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sme-slot-btn-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: stretch;
}

.sme-slot-btn-wrap > .sme-template-btn {
  width: 100%;
}

.sme-template-btn {
  flex: 1;
  height: 22px;
  background: #222;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  color: #7a8494;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sme-template-btn:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-template-btn.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}
.sme-template-btn.filled {
  background: #222;
  border-color: #2e2e2e;
  color: #7a8494;
}
.sme-template-btn.filled:hover {
  border-color: #5B2D8E;
  color: #e2e2e2;
}
.sme-template-btn.filled.active {
  background: rgba(91,45,142,0.2);
  border-color: #5B2D8E;
  color: #c084fc;
}

/* ── OV LABEL ────────────────────────────────────────────── */

.ov {
  font-size: 0.58rem;
  color: #4a5260;
  font-family: 'Inter', sans-serif;
  text-align: right;
  line-height: 1;
}

/* ── SCROLLBAR ───────────────────────────────────────────── */

.sme-left::-webkit-scrollbar { width: 6px; }
.sme-left::-webkit-scrollbar-track { background: transparent; }
.sme-left::-webkit-scrollbar-thumb { background: rgba(91,45,142,0.4); border-radius: 3px; }
.sme-left::-webkit-scrollbar-thumb:hover { background: rgba(91,45,142,0.7); }

.sme-textarea::-webkit-scrollbar { width: 6px; }
.sme-textarea::-webkit-scrollbar-track { background: transparent; }
.sme-textarea::-webkit-scrollbar-thumb { background: rgba(91,45,142,0.4); border-radius: 3px; }
.sme-textarea::-webkit-scrollbar-thumb:hover { background: rgba(91,45,142,0.7); }