/* SocialHub shared interface */
:root {
  --sh-ink: #16151f;
  --sh-ink-2: #52505f;
  --sh-muted: #8c8a99;
  --sh-line: #eceaf2;
  --sh-paper: #ffffff;
  --sh-mist: #f7f6fb;
  --sh-bg: #f0eee9;
  --sh-rose: #e8385e;
  --sh-rose-deep: #c81e48;
  --sh-green: #16d08a;
  --sh-font-display: "Sora", system-ui, sans-serif;
  --sh-font-body: "Plus Jakarta Sans", system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body.socialhub-page,
body.socialhub-admin {
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  align-items: stretch;
  padding: 0;
  background: var(--sh-bg);
  color: var(--sh-ink);
  font-family: var(--sh-font-body);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding: 20px clamp(18px, 5vw, 76px);
  border-bottom: 1px solid var(--sh-line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--sh-ink);
  text-decoration: none;
  font-family: var(--sh-font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--sh-rose);
  color: #fff;
  box-shadow: 0 10px 24px rgba(232, 56, 94, 0.25);
}

.brand-mark::before {
  content: "";
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 15%, #fff 0 2px, transparent 2.5px),
    radial-gradient(circle at 18% 82%, #fff 0 2.4px, transparent 2.8px),
    radial-gradient(circle at 82% 82%, #fff 0 2.4px, transparent 2.8px),
    radial-gradient(circle at 50% 52%, #fff 0 4px, transparent 4.5px);
}

.brand-accent {
  color: var(--sh-rose);
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: clamp(12px, 2.5vw, 28px);
  min-width: 0;
}

.nav-links a,
.footer-links a,
.site-footer a {
  color: var(--sh-ink-2);
  text-decoration: none;
  font-weight: 700;
}

.nav-links a:hover,
.footer-links a:hover,
.site-footer a:hover {
  color: var(--sh-rose);
}

.nav-cta,
.hero-cta,
.btn-primary,
.submit-btn,
.adapt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 11px;
  background: var(--sh-rose);
  color: #fff;
  text-decoration: none;
  font-family: var(--sh-font-body);
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(232, 56, 94, 0.25);
}

.nav-cta {
  padding: 11px 16px;
  max-width: 100%;
  white-space: nowrap;
}

.nav-links .nav-cta,
.nav-links .nav-cta:hover {
  color: #fff;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  min-height: min(620px, calc(100vh - 82px));
  padding: clamp(54px, 9vw, 110px) 0 clamp(42px, 7vw, 86px);
  text-align: center;
  overflow: hidden;
}

.hero-minimal {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero h1 {
  max-width: 780px;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--sh-ink);
  font-family: var(--sh-font-display);
  font-size: clamp(2.45rem, 5.7vw, 4.9rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero h1 span {
  color: var(--sh-rose);
}

.hero p {
  max-width: 660px;
  margin: 22px 0 0;
  color: var(--sh-ink-2);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 30px;
}

.hero-logo {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 28px;
  color: var(--sh-ink);
  text-decoration: none;
  font-family: var(--sh-font-display);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 800;
}

.hero-logo .brand-mark {
  width: clamp(50px, 7vw, 74px);
  height: clamp(50px, 7vw, 74px);
  border-radius: 20px;
}

.hero-cta {
  min-height: 52px;
  padding: 0 24px;
  font-size: 1rem;
}

.hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid var(--sh-line);
  border-radius: 11px;
  background: #fff;
  color: var(--sh-ink);
  text-decoration: none;
  font-weight: 800;
}

.tool-section {
  width: min(1040px, calc(100% - 36px));
  margin: 0 auto clamp(46px, 7vw, 76px);
  padding-top: clamp(28px, 5vw, 52px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2,
body.socialhub-admin header h1 {
  margin: 0;
  font-family: var(--sh-font-display);
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  letter-spacing: 0;
}

.section-heading p,
body.socialhub-admin header p {
  margin-top: 8px;
  color: var(--sh-muted);
  line-height: 1.5;
}

body.socialhub-page .card,
body.socialhub-page .post-preview-section,
body.socialhub-admin .card,
body.socialhub-admin .login-card {
  max-width: none;
  border-color: var(--sh-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(22, 21, 31, 0.06);
}

body.socialhub-page .card {
  padding: clamp(20px, 4vw, 34px);
}

body.socialhub-page header {
  width: auto;
  max-width: none;
  margin: 0;
}

body.socialhub-page form.card,
body.socialhub-page .post-preview-section {
  width: 100%;
}

body.socialhub-page .field > label,
body.socialhub-admin .field label {
  color: var(--sh-muted);
  font-family: var(--sh-font-body);
}

body.socialhub-page textarea,
body.socialhub-page input[type="url"],
body.socialhub-page input[type="text"],
body.socialhub-admin .input-wrap input,
body.socialhub-admin .login-card input {
  border-color: var(--sh-line);
  border-radius: 12px;
  background: var(--sh-mist);
  font-family: var(--sh-font-body);
}

body.socialhub-page textarea:focus,
body.socialhub-page input[type="url"]:focus,
body.socialhub-page input[type="text"]:focus,
body.socialhub-admin .input-wrap input:focus,
body.socialhub-admin .login-card input:focus {
  border-color: var(--sh-rose);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(232, 56, 94, 0.1);
}

.format-toolbar,
.text-stats-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--sh-line);
  background: #fff;
}

.format-toolbar {
  flex-wrap: wrap;
  padding: 9px;
  border-radius: 12px 12px 0 0;
  border-bottom: 0;
}

.toolbar-label,
.text-stat span {
  color: var(--sh-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.format-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sh-ink-2);
  font-family: var(--sh-font-body);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.format-btn:hover {
  border-color: var(--sh-line);
  background: var(--sh-mist);
  color: var(--sh-ink);
}

.format-btn.fb {
  font-weight: 900;
}

.format-btn.fi {
  font-style: italic;
}

.format-btn.fbi {
  font-weight: 900;
  font-style: italic;
}

.format-btn.danger:hover {
  border-color: rgba(224, 82, 82, 0.36);
  background: rgba(224, 82, 82, 0.08);
  color: #c0392b;
}

.toolbar-sep {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: var(--sh-line);
}

body.socialhub-page .format-toolbar + textarea {
  border-radius: 0;
}

.text-stats-bar {
  overflow-x: auto;
  border-top: 0;
  border-radius: 0 0 12px 12px;
}

.text-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-right: 1px solid var(--sh-line);
}

.text-stat:last-child {
  border-right: 0;
  margin-left: auto;
}

.text-stat strong {
  min-width: 16px;
  color: var(--sh-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.text-stat strong.highlight {
  color: var(--sh-rose);
}

.alt-text-panel {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.alt-text-panel label,
.quick-insert-group span {
  color: var(--sh-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.alt-text-panel textarea {
  min-height: 72px;
}

.quick-insert-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--sh-line);
  border-radius: 12px;
  background: #fff;
}

.quick-insert-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.quick-chip,
#clear-draft,
.copy-social-btn {
  min-height: 30px;
  border: 1px solid var(--sh-line);
  border-radius: 8px;
  background: var(--sh-mist);
  color: var(--sh-ink-2);
  font-family: var(--sh-font-body);
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.quick-chip {
  padding: 0 10px;
}

.quick-chip:hover,
#clear-draft:hover,
.copy-social-btn:hover {
  border-color: rgba(232, 56, 94, 0.34);
  background: rgba(232, 56, 94, 0.08);
  color: var(--sh-rose);
}

body.socialhub-page .drop-zone {
  border-color: var(--sh-line);
  border-radius: 16px;
  background: var(--sh-mist);
}

body.socialhub-page .drop-zone:hover,
body.socialhub-page .drop-zone.drag-over {
  border-color: var(--sh-rose);
  background: #fff;
}

body.socialhub-page .social-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

body.socialhub-page .social-btn {
  min-height: 46px;
  border-radius: 12px;
  background: #fff;
}

body.socialhub-page .submit-btn {
  min-height: 52px;
  background: var(--sh-ink);
  box-shadow: none;
}

body.socialhub-page .adapt-btn {
  display: inline-flex;
  min-height: 40px;
  padding: 0 16px;
  background: var(--sh-rose);
}

.config-api-link {
  margin-right: 8px;
  text-decoration: none;
}

body.socialhub-page hr {
  border-top-color: var(--sh-line);
}

body.socialhub-page .char-info:empty {
  display: none;
}

.field-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.field-title-row > label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

#reset-ai {
  border: 0;
  background: transparent;
  color: var(--sh-muted);
  font-family: var(--sh-font-body);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

#reset-ai:hover {
  color: var(--sh-rose);
}

.field-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#draft-status,
#checklist-score {
  color: var(--sh-muted);
  font-size: 0.74rem;
  font-weight: 800;
}

#clear-draft {
  padding: 0 9px;
}

.copy-social-btn {
  padding: 0 9px;
  background: #fff;
}

.social-counter-track {
  height: 4px;
  background: var(--sh-line);
}

.social-counter-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--sh-green);
}

.social-counter-fill.warn {
  background: #f0a22e;
}

.social-counter-fill.over {
  background: #c0392b;
}

.empty-social-copy {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px dashed var(--sh-line);
  border-radius: 14px;
  color: var(--sh-muted);
  background: var(--sh-mist);
  font-weight: 700;
}

.publish-checklist {
  display: grid;
  gap: 12px;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--sh-line);
  border-radius: 12px;
  background: #fff;
  color: var(--sh-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.check-item span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d4d4d8;
  flex: 0 0 auto;
}

.check-item.ok {
  color: var(--sh-ink);
}

.check-item.ok span {
  background: var(--sh-green);
}

.check-item.warn span {
  background: #f0a22e;
}

.post-preview-section {
  display: block;
  margin-top: 18px;
  padding: clamp(18px, 3vw, 26px);
}

.preview-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.preview-section-heading h3 {
  margin: 0;
  font-family: var(--sh-font-display);
  font-size: 1.25rem;
}

.preview-section-heading p {
  margin: 6px 0 0;
  color: var(--sh-muted);
  font-size: 0.92rem;
}

.post-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.post-preview-card {
  overflow: hidden;
  border: 1px solid var(--sh-line);
  border-radius: 16px;
  background: #fff;
}

.post-preview-card[data-social="tiktok"] {
  background: #111;
  color: #fff;
}

.post-preview-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sh-line);
}

.post-preview-card[data-social="tiktok"] .post-preview-head {
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

.post-preview-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.post-preview-title {
  flex: 1;
  min-width: 0;
  font-weight: 800;
}

.post-preview-title span {
  display: block;
  margin-top: 2px;
  color: var(--sh-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.post-preview-card[data-social="tiktok"] .post-preview-title span {
  color: rgba(255, 255, 255, 0.62);
}

.post-preview-media {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 170px;
  background: var(--sh-mist);
  color: var(--sh-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.post-preview-card[data-social="tiktok"] .post-preview-media {
  min-height: 260px;
  background: #1d1d22;
  color: rgba(255, 255, 255, 0.55);
}

.post-preview-media.has-crop {
  background: #111;
  cursor: grab;
}

.post-preview-media.has-crop:active {
  cursor: grabbing;
}

.inline-crop-area {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  background: #111;
}

.inline-crop-area::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.inline-crop-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(22, 21, 31, 0.68);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  pointer-events: none;
}

.inline-crop-controls {
  display: grid;
  grid-template-columns: 1fr 32px 32px auto;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--sh-line);
  background: #fff;
}

.post-preview-card[data-social="tiktok"] .inline-crop-controls {
  border-top-color: rgba(255, 255, 255, 0.12);
  background: #18181d;
}

.inline-crop-controls span {
  color: var(--sh-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.inline-crop-controls .crop-zoom-btn,
.inline-crop-controls .crop-reset {
  border: 1px solid var(--sh-line);
  border-radius: 8px;
  background: var(--sh-mist);
  color: var(--sh-ink);
  font-family: var(--sh-font-body);
  font-weight: 800;
  cursor: pointer;
}

.inline-crop-controls .crop-zoom-btn {
  width: 32px;
  height: 30px;
}

.inline-crop-controls .crop-reset {
  height: 30px;
  padding: 0 9px;
  font-size: 0.72rem;
}

.post-preview-card[data-social="tiktok"] .inline-crop-controls .crop-zoom-btn,
.post-preview-card[data-social="tiktok"] .inline-crop-controls .crop-reset {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.post-preview-media img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  display: block;
}

.post-preview-media .crop-area img {
  position: absolute;
  top: 50%;
  left: 50%;
  min-height: unset;
  object-fit: unset;
}

.post-preview-body {
  padding: 13px 14px 15px;
}

.post-preview-actions {
  display: flex;
  gap: 13px;
  margin-bottom: 9px;
  color: var(--sh-ink-2);
}

.post-preview-card[data-social="tiktok"] .post-preview-actions {
  color: rgba(255, 255, 255, 0.78);
}

.preview-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.preview-editor-head .cc-ai {
  color: var(--sh-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.74rem;
  font-weight: 800;
}

.preview-editor-head .cc-ai.warn {
  color: #c98200;
}

.preview-editor-head .cc-ai.over {
  color: #c0392b;
}

.post-preview-text {
  white-space: pre-wrap;
  color: var(--sh-ink);
  font-size: 0.9rem;
  line-height: 1.48;
  word-break: break-word;
}

.preview-caption-input,
.first-comment-input {
  width: 100%;
  border: 1px solid var(--sh-line);
  border-radius: 10px;
  background: var(--sh-mist);
  color: var(--sh-ink);
  font-family: var(--sh-font-body);
  font-size: 0.9rem;
  line-height: 1.48;
  resize: vertical;
}

.preview-caption-input {
  min-height: 118px;
  padding: 10px 11px;
}

.first-comment-input {
  min-height: 66px;
  margin-top: 8px;
  padding: 9px 10px;
  font-size: 0.82rem;
}

.post-preview-card[data-social="tiktok"] .preview-caption-input,
.post-preview-card[data-social="tiktok"] .first-comment-input {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.post-preview-link {
  margin-top: 9px;
  overflow: hidden;
  color: #3168a8;
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(120px, auto));
  gap: clamp(20px, 5vw, 64px);
  width: 100%;
  padding: 42px clamp(18px, 5vw, 76px);
  border-top: 1px solid var(--sh-line);
  background: #fff;
  overflow: hidden;
}

.site-footer p {
  max-width: 280px;
  margin: 14px 0 0;
  color: var(--sh-muted);
  line-height: 1.55;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 120px;
  max-width: 100%;
}

.footer-col strong {
  font-family: var(--sh-font-display);
  font-size: 0.9rem;
}

.footer-col a {
  font-size: 0.92rem;
}

body.socialhub-admin header {
  width: min(860px, calc(100% - 36px));
  max-width: none;
  margin: 36px auto 22px;
}

body.socialhub-admin form[method="post"],
body.socialhub-admin .save-bar {
  max-width: 860px !important;
}

body.socialhub-admin form[method="post"] {
  margin: 0 auto;
}

body.socialhub-admin .login-card {
  width: min(380px, calc(100% - 36px));
  margin: 84px auto;
}

body.socialhub-admin .card-header {
  background: var(--sh-mist);
}

body.socialhub-admin .btn-primary {
  min-height: 44px;
  padding: 0 24px;
}

@media (max-width: 860px) {
  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    overflow: visible;
    padding-bottom: 0;
  }

  .nav-links a {
    font-size: 0.9rem;
  }

  .nav-cta {
    width: 100%;
    min-height: 44px;
  }

  .hero {
    min-height: auto;
    width: min(100%, calc(100% - 28px));
    padding-top: clamp(42px, 12vw, 72px);
  }

  .hero h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .hero p {
    max-width: 36rem;
    font-size: 1rem;
  }

  .hero-actions,
  .hero-cta {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  body.socialhub-page .social-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.socialhub-page .previews-grid {
    grid-template-columns: 1fr;
  }

  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .post-preview-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .nav-links {
    gap: 12px;
  }

  .nav-cta {
    padding-inline: 14px;
  }
}
