/* Direct, clean social app showcase windows */
.social-brand-section {
  position: relative;
  inset: auto;
  width: auto;
  min-height: 0;
  margin-top: 16px;
  padding: 16px !important;
  border: 1px solid #cce3ec;
  border-radius: 18px;
  background: linear-gradient(155deg, #f3fafd 0%, #ffffff 65%) !important;
  box-shadow: 0 8px 24px rgba(6, 63, 89, 0.05);
  color: #063f59;
}
.social-brand-section::before,
.social-brand-section::after {
  content: none !important;
  display: none !important;
}

.social-brand-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.social-brand-heading span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #087fa7;
}
.social-brand-heading h3 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.2;
}
.social-brand-heading h3 em {
  font-style: normal;
  font-weight: 500;
  color: #168eac;
}
.social-brand-heading > b {
  font-size: 10px;
  background: #063f59;
  color: #d9f7ff;
  border-radius: 999px;
  padding: 6px 11px;
  white-space: nowrap;
}

.social-brand-logo {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #13242f;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(0, 27, 41, 0.16);
}
.social-brand-logo.instagram {
  background: linear-gradient(140deg, #6a4dd9, #cc447b, #ed9e48);
}
.social-brand-logo.facebook {
  background: #1877f2;
}

/* Integrated switcher shown on narrow viewports & modals */
.social-brand-tabs {
  display: none;
  gap: 8px;
  margin-bottom: 12px;
}
.social-brand-tabs button {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #cfe3eb;
  border-radius: 12px;
  background: #fff;
  color: #2f5566;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.social-brand-tabs button.is-active,
.social-brand-tabs button[aria-selected="true"] {
  background: #eaf8fc;
  border-color: #0e95bb;
  color: #063f59;
  box-shadow: 0 3px 10px rgba(8, 127, 167, 0.12);
}
.social-brand-tabs button:focus-visible {
  outline: 2px solid #087fa7;
  outline-offset: 2px;
}
.social-brand-tab-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
}
.social-brand-tab-label strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.social-brand-tab-label small {
  font-size: 10px;
  font-weight: 600;
  color: #5b7e8d;
  margin-top: 2px;
}
.social-brand-tabs button[data-connected="1"] .social-brand-tab-label small {
  color: #0b7a52;
}

/* App window cards grid */
.social-brand-grid {
  display: grid !important;
  grid-template-columns: repeat(var(--social-cols, 3), minmax(0, 1fr)) !important;
  gap: 14px;
  align-items: stretch !important;
}
.social-brand-section .social-brand-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid #c5e1ec;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(6, 63, 89, 0.06);
}
.social-brand-section .social-brand-card::before {
  content: '';
  height: 3px;
  display: block;
  flex: none;
  background: linear-gradient(90deg, #087fa7, #21bfd8);
}
.social-brand-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 11px 13px;
  background: linear-gradient(120deg, #063f59, #0c546d);
  color: #fff;
  border-bottom: 1px solid #16607a;
}
.social-brand-meta {
  min-width: 0;
  flex: 1;
}
.social-brand-top h4 {
  margin: 0 0 2px;
  font-size: 14px;
  color: #fff;
}
.social-brand-top small {
  display: block;
  font-size: 11px;
  color: #b4dce9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.social-brand-top button {
  margin-left: auto;
  font: inherit;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.14);
  color: #ecfbff;
  border: 1px solid rgba(135, 210, 232, 0.45);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.social-brand-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  background: #fff;
  min-height: 170px;
  max-height: 290px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #b0dce8 #f0f7fa;
}
.social-brand-card[data-connected="1"] .social-brand-content {
  min-height: 260px;
}
.social-brand-card[data-connected="1"][data-network="tiktok"] .social-brand-content {
  background: #061f2b;
}
.social-brand-content iframe {
  display: block;
  width: 100%;
  max-width: none;
  height: 270px !important;
  flex-shrink: 0;
  border: 0;
  background: #fff;
}
.social-brand-card[data-network="tiktok"] .social-brand-content iframe {
  height: 270px !important;
  background: #061f2b;
}

.social-brand-placeholder {
  width: 100%;
  min-height: 170px;
  box-sizing: border-box;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at top, #f0fafe, #ffffff);
  gap: 8px;
}
.social-brand-placeholder > span {
  font-size: 34px;
  color: #168eac;
}
.social-brand-placeholder > b {
  font-size: 15px;
  color: #063f59;
}
.social-brand-placeholder p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #617e8c;
  max-width: 240px;
}
.social-brand-connect-cta {
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  background: #087fa7;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.social-brand-connect-cta:hover {
  background: #06698c;
}
.social-video-empty {
  height: 100%;
  min-height: 420px;
  background: radial-gradient(circle at 50% 20%, #0c5870, #061f2b);
  color: #fff;
}
.social-video-empty > span {
  color: #28c4db;
  font-size: 48px;
}
.social-video-empty > b {
  color: #fff;
}
.social-video-empty p {
  color: #b8d4df;
}

.social-brand-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  margin: 8px 10px 10px;
  padding: 7px 12px;
  background: #eef9fd;
  color: #087fa7;
  border: 1px solid #bfe0ec;
  border-radius: 10px;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 700;
  box-sizing: border-box;
}
.social-brand-open:hover {
  background: #e5f6fc;
  color: #063f59;
}
.social-brand-privacy {
  font-size: 10px;
  line-height: 1.45;
  color: #6c8a97;
  margin: 10px 0 0;
}

/* Inline form replaces stage cleanly while editing */
.social-brand-card.is-editing .social-brand-content,
.social-brand-card.is-editing .social-brand-open {
  display: none !important;
}
.social-brand-editor {
  padding: 16px;
  display: grid;
  gap: 12px;
  background: #fff;
}
.social-brand-editor label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #063f59;
}
.social-brand-editor input,
.social-brand-editor textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid #c5dfe9;
  border-radius: 9px;
  background: #f8fcfe;
  padding: 10px;
  font: inherit;
  font-size: 12px;
  color: #063f59;
}
.social-brand-editor input:focus,
.social-brand-editor textarea:focus {
  outline: 2px solid #1ba4c9;
  outline-offset: 2px;
}
.social-brand-editor small {
  font-size: 10px;
  font-weight: 400;
  line-height: 1.45;
  color: #6c8693;
}
.social-brand-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.social-brand-editor-actions button {
  font: inherit;
  cursor: pointer;
  border: 1px solid #c9e4ed;
  border-radius: 9px;
  padding: 9px 14px;
  background: #f2fbfe;
  color: #087fa7;
  font-size: 12px;
  font-weight: 700;
}
.social-brand-editor-actions button:first-child {
  background: #087fa7;
  border-color: #087fa7;
  color: #fff;
}
.social-brand-editor button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.social-brand-status {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #a03a32;
}
.social-brand-editor .social-brand-note {
  margin: 0;
  font-size: 11px;
  color: #6d8996;
}

/* Preview modal width tuning */
#communityProfileDialog.profile-preview-open .community-profile-card {
  width: min(1240px, calc(100vw - 40px)) !important;
  max-width: 1240px !important;
}
#communityProfileContent .social-brand-section {
  margin-top: 10px;
}

/* Mobile & narrow tablet: show all 3 social networks side-by-side in the same row */
@media (max-width: 900px) {
  .social-brand-section {
    padding: 10px 8px !important;
    border-radius: 15px;
  }
  .social-brand-heading {
    margin-bottom: 8px;
  }
  .social-brand-heading h3 {
    font-size: 16px;
  }
  .social-brand-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
  }
  .social-brand-tabs button {
    flex-direction: row;
    gap: 5px;
    padding: 6px 6px;
    border-radius: 10px;
    text-align: left;
  }
  .social-brand-tabs .social-brand-logo {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 12px;
    border-radius: 6px;
  }
  .social-brand-tab-label strong {
    font-size: 10px;
  }
  .social-brand-tab-label small {
    font-size: 8.5px;
    margin-top: 1px;
  }
  .social-brand-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    align-items: stretch !important;
  }
  .social-brand-card[data-network] {
    display: none !important;
    flex-direction: column;
    min-width: 0;
    border-radius: 12px;
  }
  .social-brand-card[data-network].is-active,
  .social-brand-card[data-network].is-editing {
    display: flex !important;
    border-color: #0e95bb !important;
    box-shadow: 0 6px 16px rgba(8, 127, 167, 0.14) !important;
  }
  .social-brand-top {
    min-height: 36px;
    padding: 6px 9px;
    gap: 7px;
  }
  .social-brand-top .social-brand-logo {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
    font-size: 13px;
    border-radius: 7px;
  }
  .social-brand-top h4 {
    font-size: 11.5px;
    margin: 0 0 1px;
  }
  .social-brand-top small {
    font-size: 9px;
  }
  .social-brand-top button {
    padding: 4px 8px;
    font-size: 9.5px;
    border-radius: 7px;
  }
  .social-brand-content,
  .social-brand-card[data-connected="1"] .social-brand-content {
    position: relative;
    min-height: 158px !important;
    height: 158px !important;
    max-height: 158px !important;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .social-brand-content iframe,
  .social-brand-card[data-network="tiktok"] .social-brand-content iframe {
    width: 118% !important;
    height: 210px !important;
    margin-bottom: -30px !important;
    transform: scale(0.85) !important;
    transform-origin: top left !important;
  }
  .social-brand-placeholder {
    min-height: 158px !important;
    padding: 12px 10px;
    gap: 5px;
  }
  .social-brand-placeholder > span {
    font-size: 22px;
  }
  .social-brand-placeholder > b {
    font-size: 12px;
  }
  .social-brand-placeholder p {
    font-size: 10px;
    line-height: 1.3;
  }
  .social-brand-connect-cta {
    padding: 6px 11px;
    font-size: 10.5px;
    border-radius: 8px;
  }
  .social-brand-open {
    min-height: 32px;
    margin: 7px 9px 9px;
    padding: 6px 10px;
    font-size: 10.5px;
    border-radius: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .social-brand-privacy {
    font-size: 9px;
    margin-top: 6px;
  }
  #communityProfileDialog.profile-preview-open .community-profile-card {
    width: 100vw !important;
    max-width: 100vw !important;
  }
}
