/*
 * SelfTube Pro — SEO & Social Preview editor (scoped styles)
 *
 * All classes are prefixed with .stp- (SelfTube Pro) to avoid colliding
 * with the AGPL dashboard's Tailwind utilities. Uses the SelfTube design
 * tokens from /design-tokens.css (Swiss: accent #00875A green, zero
 * border-radius, Neue Haas Grotesk via Typekit already loaded by the
 * parent dashboard).
 */

[x-cloak] { display: none !important; }

body.stp-lock { overflow: hidden; }

/* ── Floating Action Button ──────────────────────────────── */

.stp-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  background: #0A0A0A;
  color: #FAFAF8;
  border: none;
  padding: 12px 20px;
  font: 600 11px/1 'neue-haas-grotesk-display', 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 120ms ease;
}
.stp-fab:hover { background: #00875A; }
.stp-fab__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00875A;
  display: inline-block;
  transition: background 120ms ease;
}
.stp-fab:hover .stp-fab__dot { background: #FAFAF8; }

/* ── Drawer root + backdrop ───────────────────────────────── */

.stp-root {
  font-family: 'neue-haas-grotesk-text', 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  color: #0A0A0A;
}

.stp-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  z-index: 9999;
}

.stp-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(1100px, 85vw);
  height: 100vh;
  background: #FAFAF8;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #0A0A0A;
}

/* Alpine transitions */
.stp-drawer--enter { transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1); }
.stp-drawer--enter-start { transform: translateX(100%); }
.stp-drawer--enter-end { transform: translateX(0); }
.stp-drawer--leave { transition: transform 200ms cubic-bezier(0.4, 0, 1, 1); }
.stp-drawer--leave-start { transform: translateX(0); }
.stp-drawer--leave-end { transform: translateX(100%); }

/* ── Header ──────────────────────────────────────────────── */

.stp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid #E0E0DC;
  flex-shrink: 0;
  background: #FAFAF8;
}
.stp-header h2 {
  font: 700 20px/1.1 'neue-haas-grotesk-display', 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  margin: 0;
  letter-spacing: -0.015em;
  color: #0A0A0A;
}
.stp-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #7A7A72;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transition: color 120ms ease;
}
.stp-close:hover { color: #0A0A0A; }

/* ── Body layout ─────────────────────────────────────────── */

.stp-body {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: #FAFAF8;
}
.stp-body--loading {
  display: grid;
  place-items: center;
  font-size: 13px;
  color: #7A7A72;
}

@media (max-width: 900px) {
  .stp-body { grid-template-columns: 1fr; }
}

.stp-editor,
.stp-previews {
  padding: 28px 32px;
}
.stp-editor { border-right: 1px solid #E0E0DC; }

.stp-editor h3,
.stp-previews h3 {
  font: 700 11px/1 'neue-haas-grotesk-display', 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #7A7A72;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #E0E0DC;
}
.stp-editor h3:not(:first-child) { margin-top: 32px; }

/* ── Fields ──────────────────────────────────────────────── */

.stp-field {
  display: block;
  margin-bottom: 18px;
}
.stp-field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 500 11px/1 'neue-haas-grotesk-display', 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7A7A72;
  margin-bottom: 8px;
}
.stp-counter {
  font: 400 10px/1 'SF Mono', 'Fira Code', ui-monospace, monospace;
  color: #A0A098;
  font-variant-numeric: tabular-nums;
}
.stp-counter--over { color: #B83232; }

.stp-input-row {
  position: relative;
  display: flex;
}
.stp-field input[type="text"],
.stp-field textarea {
  width: 100%;
  border: 1px solid #E0E0DC;
  background: #FAFAF8;
  padding: 10px 36px 10px 12px;
  font: 400 14px/1.5 'neue-haas-grotesk-text', 'Inter', sans-serif;
  color: #0A0A0A;
  border-radius: 0;
  outline: none;
  transition: border-color 120ms ease;
  resize: vertical;
  min-height: 40px;
}
.stp-field input[type="text"]:focus,
.stp-field textarea:focus { border-color: #0A0A0A; }
.stp-field input[type="text"]::placeholder,
.stp-field textarea::placeholder { color: #A0A098; }

.stp-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #F2F2F0;
  border: none;
  width: 22px;
  height: 22px;
  font-size: 15px;
  line-height: 1;
  color: #7A7A72;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 120ms ease, color 120ms ease;
}
.stp-clear:hover { background: #0A0A0A; color: #FAFAF8; }

/* ── Dropzone ────────────────────────────────────────────── */

.stp-dropzone {
  border: 1px dashed #C8C8C2;
  background: #FAFAF8;
  min-height: 160px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: border-color 120ms ease, background 120ms ease;
}
.stp-dropzone:hover { border-color: #00875A; background: #E6F5EF; }
.stp-dropzone--busy { opacity: 0.6; pointer-events: none; }

.stp-dropzone__empty {
  font: 400 12px/1.5 'neue-haas-grotesk-text', 'Inter', sans-serif;
  color: #7A7A72;
  text-align: center;
  padding: 20px;
}

.stp-dropzone__preview {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
}
.stp-dropzone__preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}
.stp-dropzone__preview .stp-clear {
  top: 14px;
  right: 14px;
  background: #0A0A0A;
  color: #FAFAF8;
}
.stp-dropzone__preview .stp-clear:hover { background: #B83232; }

/* ── Actions ─────────────────────────────────────────────── */

.stp-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #E0E0DC;
}
.stp-btn {
  background: #FAFAF8;
  border: 1px solid #0A0A0A;
  color: #0A0A0A;
  padding: 10px 18px;
  font: 600 11px/1 'neue-haas-grotesk-display', 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.stp-btn:hover { background: #0A0A0A; color: #FAFAF8; }
.stp-btn--primary { background: #00875A; color: #FAFAF8; border-color: #00875A; }
.stp-btn--primary:hover { background: #006B47; border-color: #006B47; color: #FAFAF8; }
.stp-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.stp-btn:disabled:hover { background: inherit; color: inherit; }

.stp-save-msg {
  font: 500 12px/1 'neue-haas-grotesk-text', 'Inter', sans-serif;
  color: #00875A;
}

/* ── Previews container ──────────────────────────────────── */

.stp-previews {
  background: #F2F2F0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stp-preview {
  background: #FAFAF8;
  border: 1px solid #E0E0DC;
  position: relative;
  overflow: hidden;
}
.stp-preview__badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #0A0A0A;
  color: #FAFAF8;
  font: 600 9px/1 'SF Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 6px 10px;
  z-index: 2;
}

/* ── Google SERP ─────────────────────────────────────────── */

.stp-serp {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 16px;
  padding: 20px;
  font-family: arial, sans-serif;
}
.stp-serp__main { min-width: 0; }
.stp-serp__site {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.stp-serp__favicon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #00875A;
  flex-shrink: 0;
  display: inline-block;
}
.stp-serp__domain {
  font: 400 14px/1.3 arial;
  color: #202124;
}
.stp-serp__breadcrumb {
  font: 400 12px/1.3 arial;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stp-serp__title {
  font: 400 20px/1.3 arial;
  color: #1a0dab;
  margin: 6px 0 4px;
  text-decoration: underline;
  text-decoration-color: transparent;
  max-width: 600px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.stp-serp__desc {
  font: 400 14px/1.57 arial;
  color: #4d5156;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stp-serp__thumb {
  width: 112px;
  height: 64px;
  object-fit: cover;
  background: #E0E0DC;
  border-radius: 8px;
}

/* ── Facebook / LinkedIn ─────────────────────────────────── */

.stp-fb {
  background: #f0f2f5;
  font-family: system-ui, -apple-system, 'Helvetica Neue', sans-serif;
}
.stp-fb__image {
  width: 100%;
  aspect-ratio: 1.91 / 1;
  background: #e4e6eb no-repeat center/cover;
  border-bottom: 1px solid #dadde1;
}
.stp-fb__body {
  padding: 10px 12px;
  background: #f2f3f5;
}
.stp-fb__domain {
  font: 400 12px/1 system-ui;
  color: #65676b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 3px;
}
.stp-fb__title {
  font: 600 16px/1.25 system-ui;
  color: #050505;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}
.stp-fb__desc {
  font: 400 14px/1.3 system-ui;
  color: #606770;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── WhatsApp / Signal ───────────────────────────────────── */

.stp-wa {
  background: #e4ddd5;
  padding: 18px;
  font-family: -apple-system, system-ui, 'Helvetica Neue', sans-serif;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.3) 0%, transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.2) 0%, transparent 40%);
}
.stp-wa__bubble {
  background: #d9fdd3;
  max-width: 330px;
  margin-left: auto;
  padding: 4px;
  border-radius: 8px 2px 8px 8px;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}
.stp-wa__card {
  background: #c5f0ba;
  border-radius: 6px;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
  align-items: flex-start;
}
.stp-wa__thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: #e5e5e4;
}
.stp-wa__text { min-width: 0; }
.stp-wa__title {
  font: 600 14px/1.3 system-ui;
  color: #111b21;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 2px;
}
.stp-wa__desc {
  font: 400 13px/1.35 system-ui;
  color: #667781;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.stp-wa__url {
  font: 400 12px/1 system-ui;
  color: #8696a0;
  text-transform: lowercase;
}
.stp-wa__link {
  font: 400 14.5px/1.4 system-ui;
  color: #027eb5;
  padding: 6px 8px 2px;
  word-break: break-all;
}

/* ── Twitter / X ─────────────────────────────────────────── */

.stp-tw {
  background: #fff;
  border: 1px solid #cfd9de;
  border-radius: 16px;
  overflow: hidden;
  margin: 14px;
  font-family: 'TwitterChirp', system-ui, -apple-system, sans-serif;
}
.stp-tw__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #e5e5e4 no-repeat center/cover;
  position: relative;
  display: grid;
  place-items: center;
}
.stp-tw__play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 22px;
  display: grid;
  place-items: center;
  padding-left: 4px;
}
.stp-tw__body { padding: 10px 14px 14px; }
.stp-tw__title {
  font: 500 15px/1.3 system-ui;
  color: #0f1419;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stp-tw__desc {
  font: 400 14px/1.35 system-ui;
  color: #536471;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.stp-tw__domain {
  font: 400 13px/1 system-ui;
  color: #536471;
}
