/* =========================================================
   SOCIAL TAB — mini social interno alla chat
   Palette coerente con il resto della chat (toni azzurri,
   niente nero): riusa le variabili --accent/--panel/--line/--text
   quando disponibili, con fallback espliciti.
   ========================================================= */

/* Regola di sicurezza: qualunque elemento con l'attributo "hidden"
   deve restare invisibile, anche se una regola più sotto in questo
   file gli assegna un display esplicito (flex/block/grid...). */
[hidden] {
  display: none !important;
}

.side-tab-panel.social-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
  height: 100%;
}

/* ---------- Composer ---------- */
.social-composer {
  background: linear-gradient(180deg, #eef6fd, #e2eff9);
  border: 1px solid var(--line, #a8bfd4);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(40, 90, 140, 0.08);
}

.social-composer-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.social-composer-head img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--accent, #2e8ee8);
  flex: none;
}

#socialComposerInput {
  flex: 1;
  resize: none;
  border: 1px solid var(--line, #a8bfd4);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  background: #ffffff;
  color: var(--text, #111);
}

#socialComposerInput:focus {
  outline: none;
  border-color: var(--accent, #2e8ee8);
  box-shadow: 0 0 0 2px rgba(46, 142, 232, 0.18);
}

.social-composer-preview {
  border: 1px dashed var(--line, #a8bfd4);
  border-radius: 10px;
  padding: 6px;
  position: relative;
  background: #ffffff;
}

.social-composer-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

.social-composer-preview .social-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-composer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.social-tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line, #a8bfd4);
  background: #ffffff;
  color: #1f6fb2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.15s, border-color 0.15s;
}

.social-tool-btn:hover {
  background: #eaf3fc;
  border-color: var(--accent, #2e8ee8);
}

.social-toolbar-grow {
  flex: 1;
}

.social-publish-btn {
  background: linear-gradient(180deg, #3aa1ff, #1680dc);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 5px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 128, 220, 0.3);
}

.social-publish-btn:hover {
  filter: brightness(1.05);
}

.social-publish-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.social-composer-error {
  color: #c0392b;
  font-size: 12px;
  padding: 2px 2px 0;
}

.social-mini-popup {
  background: #ffffff;
  border: 1px solid var(--line, #a8bfd4);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.social-mini-popup input[type="text"] {
  flex: 1;
  min-width: 140px;
  border: 1px solid var(--line, #a8bfd4);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}

.social-mini-popup-btn {
  background: var(--accent, #2e8ee8);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.social-mini-popup .emoji-item {
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
}

.social-mini-popup .emoji-item:hover {
  background: #eaf3fc;
}

.social-gif-results {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.social-gif-results img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--line, #a8bfd4);
}

/* ---------- Feed ---------- */
.social-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-post {
  background: #ffffff;
  border: 1px solid var(--line, #a8bfd4);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(40, 90, 140, 0.07);
}

.social-post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
}

.social-post-head img.social-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--panel, #d9eafa);
  flex: none;
}

.social-post-head-info {
  flex: 1;
  min-width: 0;
}

.social-post-head-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text, #111);
}

.social-post-menu-btn {
  background: none;
  border: none;
  color: #6f8aa3;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-post-menu-btn:hover {
  background: #eef6fd;
  color: #c0392b;
}

.social-post-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 6px 0;
}

.social-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #33475a;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, color 0.15s;
}

.social-icon-btn:hover {
  color: var(--accent, #2e8ee8);
}

.social-icon-btn:active {
  transform: scale(0.88);
}

.social-icon-btn.is-liked {
  color: #e0245e;
}

.social-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.social-post-likes {
  padding: 2px 12px 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #111);
}

.social-post-caption {
  padding: 2px 12px 2px;
  font-size: 13px;
  color: var(--text, #111);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.social-post-caption .cap-name,
.social-comment-body .cap-name {
  font-weight: 700;
  margin-right: 5px;
}

.social-post-caption img.inline-smiley,
.social-comment-body img.inline-smiley {
  height: 16px;
  vertical-align: -3px;
}

.social-view-comments {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 12px 0;
  font-size: 12.5px;
  color: #7c93a8;
  text-align: left;
}

.social-view-comments:hover {
  color: #4f6b85;
}

.social-post-media {
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  background: #eaf1f8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-post-media img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

/* Anteprima YouTube "lazy": mostra solo la thumbnail finché non si clicca,
   così il player non parte da solo e non appesantisce il caricamento. */
.social-yt-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  cursor: pointer;
}

.social-yt-wrap img.social-yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.92;
}

.social-yt-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(220, 40, 40, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.social-yt-play::after {
  content: "";
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}

.social-yt-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.social-post-time-full {
  padding: 6px 12px 0;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #9aacbd;
}

.social-comments-wrap {
  padding: 8px 12px 2px;
}

.social-comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.social-comment {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.social-comment img.social-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  margin-top: 1px;
}

.social-comment-body {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text, #111);
  line-height: 1.4;
  word-break: break-word;
}

.social-comment-time {
  font-size: 10.5px;
  color: #9aacbd;
  margin-top: 1px;
}

.social-comment-form-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--panel, #d9eafa);
  margin-top: 4px;
}

.social-comment-form-inline input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12.5px;
  padding: 4px 0;
  color: var(--text, #111);
}

.social-comment-form-inline input:focus {
  outline: none;
}

.social-post-send-btn {
  background: none;
  border: none;
  color: var(--accent, #2e8ee8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
}

.social-comment-form-inline input:not(:placeholder-shown) ~ .social-post-send-btn {
  opacity: 1;
}

.social-load-more-btn {
  align-self: center;
  background: #ffffff;
  border: 1px solid var(--accent, #2e8ee8);
  color: #1f6fb2;
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin: 4px auto 6px;
}

.social-load-more-btn:hover {
  background: #eaf3fc;
}

.social-empty {
  text-align: center;
  color: #6f8aa3;
  font-size: 12.5px;
  padding: 16px 8px;
}

/* ---------- Toolbar: aggiorna + notifiche ---------- */
.social-toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.social-toolbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line, #a8bfd4);
  background: #ffffff;
  color: #1f6fb2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.social-toolbar-icon-btn:hover {
  background: #eaf3fc;
  border-color: var(--accent, #2e8ee8);
}

.social-toolbar-icon-btn:active svg {
  transform: rotate(50deg);
}

.social-notif-wrap {
  position: relative;
}

.social-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: #e0245e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.social-notif-dropdown {
  position: absolute;
  top: 38px;
  right: 0;
  width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line, #a8bfd4);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(30, 70, 110, 0.18);
  z-index: 20;
}

.social-notif-dropdown-head {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text, #111);
  padding: 9px 12px 6px;
  border-bottom: 1px solid var(--panel, #d9eafa);
}

.social-notif-list {
  display: flex;
  flex-direction: column;
}

.social-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--panel, #d9eafa);
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
}

.social-notif-item:hover {
  background: #eef6fd;
}

.social-notif-item img.social-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.social-notif-item-text {
  font-size: 12px;
  color: var(--text, #111);
  line-height: 1.4;
}

.social-notif-empty {
  text-align: center;
  color: #7c93a8;
  font-size: 12px;
  padding: 14px 8px;
  margin: 0;
}

/* ---------- Popup "chi ha messo mi piace" ---------- */
.social-likers-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 45, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
}

.social-likers-modal {
  width: 260px;
  max-height: 70vh;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.social-likers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text, #111);
  border-bottom: 1px solid var(--panel, #d9eafa);
}

.social-likers-head button {
  background: none;
  border: none;
  cursor: pointer;
  color: #6f8aa3;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 6px;
}

.social-likers-head button:hover {
  background: #eef6fd;
  color: #c0392b;
}

.social-likers-list {
  overflow-y: auto;
  padding: 6px 0;
}

.social-likers-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--text, #111);
}

.social-likers-item img.social-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.social-likers-loading {
  text-align: center;
  color: #7c93a8;
  font-size: 12.5px;
  padding: 16px 8px;
  margin: 0;
}

/* ---------- Eliminazione commenti ---------- */
.social-comment {
  position: relative;
}

.social-comment-delete-btn {
  flex: none;
  background: none;
  border: none;
  color: #b7c4d1;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  align-self: flex-start;
  margin-top: 2px;
}

.social-comment-delete-btn:hover {
  background: #fdecea;
  color: #c0392b;
}

/* ---------- Evidenzia post dopo salto da notifica ---------- */
@keyframes socialPostHighlight {
  0% { box-shadow: 0 0 0 3px rgba(46, 142, 232, 0.55); }
  100% { box-shadow: 0 2px 6px rgba(40, 90, 140, 0.07); }
}

.social-post-highlight {
  animation: socialPostHighlight 1.8s ease-out;
}

/* ---------- Banner "nuovi post" (al posto dell'inserimento live) ---------- */
.social-new-posts-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--accent, #2e8ee8);
  color: #1f6fb2;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 2px;
}

.social-new-posts-banner:hover {
  background: #eaf3fc;
}

/* ---------- Icona tipo (like/commento) sull'avatar nelle notifiche ---------- */
.social-notif-item-avatar-wrap {
  position: relative;
  flex: none;
}

.social-notif-item-icon {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}

.social-notif-item-icon svg {
  width: 10px;
  height: 10px;
}

.social-notif-item-icon-like {
  color: #e0245e;
}

.social-notif-item-icon-comment {
  color: var(--accent, #2e8ee8);
}

/* ---------- Ricerca per nome utente ---------- */
.social-search-wrap {
  position: relative;
}

.social-search-box {
  position: absolute;
  top: 38px;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--line, #a8bfd4);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(30, 70, 110, 0.18);
  padding: 6px 8px;
  z-index: 20;
  width: 165px;
}

.social-search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12.5px;
  padding: 4px 2px;
  color: var(--text, #111);
}

.social-search-box input:focus {
  outline: none;
}

.social-search-clear {
  background: none;
  border: none;
  color: #9aacbd;
  cursor: pointer;
  font-size: 11px;
  padding: 3px 5px;
  border-radius: 6px;
  flex: none;
}

.social-search-clear:hover {
  background: #fdecea;
  color: #c0392b;
}