/* Remove the random neon root tokens (optional) */
/* :root { ... } */

/* Keep your IG palette in the scoped wrapper */
.ig-comments {
  --ig-purp-500: #b10fff;
  --ig-purp-600: #8a0dd9;
  --ig-pink-500: #ff71ff;

  --ig-border: rgba(177, 15, 255, 0.22);
  --ig-border-hover: rgba(177, 15, 255, 0.45);
  --ig-glow: rgba(177, 15, 255, 0.18);
  --ig-glow-2: rgba(255, 113, 255, 0.14);
}

/* Comment card: DO NOT change background; theme/TW controls it (bg-dark-400, etc.) */
.ig-comments .ig-comment {
  position: relative;
  border: 1px solid var(--ig-border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* Subtle hover: border + glow only (no bg override) */
.ig-comments .ig-comment:hover {
  border-color: var(--ig-border-hover);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.12),
    0 0 18px var(--ig-glow);
}

/* Add a small gradient accent bar (gaming vibe) without touching background */
.ig-comments .ig-comment::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--ig-purp-500), var(--ig-pink-500));
  opacity: 0.9;
}

/* Circular avatar */
.ig-comments .ig-avatar img,
.ig-comments .comment-author img {
  border-radius: 9999px !important;
  border: 2px solid var(--ig-border-hover);
  box-shadow: 0 0 0 3px var(--ig-glow-2);
}

/* Force consistent avatar sizing for BOTH app + WP avatars */
.ig-comments {
  --ig-avatar-size: 48px; /* keep in sync with wp_list_comments avatar_size */
}

.ig-comments .ig-avatar,
.ig-comments .comment-author .avatar {
  width: var(--ig-avatar-size);
  height: var(--ig-avatar-size);
  flex: 0 0 var(--ig-avatar-size);
}

.ig-comments .ig-avatar img,
.ig-comments .comment-author img.avatar {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  border-radius: 9999px;
}

/* TEXT-LINK style actions (no pill background) */
.ig-comments .ig-reply a.comment-reply-link,
.ig-comments .ig-toggle-replies {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;

  height: auto !important;
  padding: 0 !important;
  border-radius: 0 !important;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-decoration: none;

  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
}

.ig-comments .ig-reply a.comment-reply-link:hover,
.ig-comments .ig-toggle-replies:hover {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: var(--ig-purp-500);
  text-underline-offset: 3px;
}

/* Remove the segmented text-decoration underline */
.ig-comments .ig-reply a.comment-reply-link:hover,
.ig-comments .ig-toggle-replies:hover {
  text-decoration: none;
  text-decoration-color: transparent;
}

/* Continuous underline across text + gap + arrow */
.ig-comments .ig-toggle-replies:hover {
  box-shadow: inset 0 -2px 0 var(--ig-purp-500) !important;
  padding-bottom: 2px !important; /* base has padding:0 !important; so we need !important here */
}

/* Optional: make reply link use the same continuous underline too */
.ig-comments .ig-reply a.comment-reply-link:hover {
  box-shadow: inset 0 -2px 0 var(--ig-purp-500) !important;
  padding-bottom: 2px !important;
}

/* Add a subtle "purp -> pink" glow on hover, still text-only */
.ig-comments .ig-reply a.comment-reply-link:hover,
.ig-comments .ig-toggle-replies:hover {
  text-shadow:
    0 0 16px var(--ig-glow),
    0 0 14px var(--ig-glow-2);
}

/* Make toggle underline span across text + gap + arrow */
.ig-comments .ig-toggle-replies {
  text-decoration: none; /* disable text underline mechanics */
  white-space: nowrap;
}

.ig-comments .ig-toggle-replies:hover {
  text-decoration: none; /* ensure no segmented underline */
  /* draw a continuous underline across the whole button content */
  background-image: linear-gradient(
    var(--ig-purp-500),
    var(--ig-purp-500)
  );
  background-repeat: no-repeat;
  background-size: 100% 2px;
  background-position: 0 100%;
  padding-bottom: 2px; /* gives room for the underline */
}

/* optional: keep the same glow you already added */
.ig-comments .ig-toggle-replies:hover {
  text-shadow:
    0 0 16px var(--ig-glow),
    0 0 14px var(--ig-glow-2);
}

/* Keep chevron animation */
.ig-comments .ig-toggle-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  opacity: 0.9;
}
.ig-comments .ig-toggle-replies[aria-expanded="false"] .ig-toggle-icon {
  transform: rotate(-90deg);
}

/* Optional: separate actions from content a bit more */
.ig-comments .ig-comment__actions {
  margin-top: 10px;
  gap: 14px;
}

/* Replies: clearer nesting, same palette */
.ig-comments .comment-list .children {
  margin-top: 12px;
  margin-left: 8px;

  position: relative;

  transition: all 0.25s ease;
  max-height: 5000px;
  opacity: 1;
  overflow: hidden;
}

.ig-comments .comment-list .children::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(
    180deg,
    rgba(177, 15, 255, 0),
    var(--ig-border-hover),
    var(--ig-pink-500),
    rgba(255, 113, 255, 0)
  );
}

.ig-comments .comment-list .children > li {
  margin: 12px 12px 6px 12px;
}

/* Collapsed */
.ig-comments .comment-list .children.is-collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  border-left-color: transparent;
}

/* Form panel (keeps theme background; adds border/glow only) */
.ig-comments .ig-comment-form {
  padding: 16px;
  border: 1px solid var(--ig-border);
  border-radius: 12px;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.35),
    0 0 18px var(--ig-glow);
  position: relative;
  overflow: hidden;
}

.ig-comments .ig-comment-form::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ig-purp-500), var(--ig-pink-500));
  opacity: 0.95;
}

/* grid for name/email */
.ig-comments .ig-comment-form__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px) {
  .ig-comments .ig-comment-form__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.ig-comments .ig-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

/* Beat theme rule: #comments textarea, #comments input */
#comments.ig-comments .ig-input,
#comments.ig-comments .ig-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  padding: 10px 12px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

#comments.ig-comments .ig-textarea {
  min-height: 120px;
  resize: vertical;
}

#comments.ig-comments .ig-input:focus,
#comments.ig-comments .ig-textarea:focus {
  border-color: var(--ig-border-hover);
  box-shadow:
    0 0 0 3px var(--ig-glow),
    0 0 18px var(--ig-glow-2);
}

/* cookies consent (WP default) */
.ig-comments .comment-form-cookies-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}
.ig-comments .comment-form-cookies-consent input {
  margin-top: 4px;
  accent-color: var(--ig-purp-500);
}

/* submit + cancel reply */
.ig-comments .ig-comment-form__actions {
  display: flex;
  justify-content: center; /* center the submit block */
  margin-top: 10px;
}

/* button container takes full width so centering is always true */
.ig-comments .ig-comment-form__submit {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* WP "Cancel reply" link */
.ig-comments #cancel-comment-reply-link {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ig-pink-500);
}
.ig-comments #cancel-comment-reply-link:hover {
  color: #fff;
  text-decoration-color: var(--ig-pink-500);
}

.ig-comments .ig-comment-form__error {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ig-pink-500);
}

#comments.ig-comments .ig-field--error {
  border-color: var(--ig-pink-500) !important;
  box-shadow: 0 0 0 3px var(--ig-glow-2) !important;
}

/* Sticky reply-mode bar (solves "lost form" UX) */
.ig-reply-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9999;

  display: none;
}

.ig-reply-bar.is-visible {
  display: block;
}

.ig-reply-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 10px 12px;
  border-radius: 12px;

  border: 1px solid var(--ig-border-hover);
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(10px);

  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.55),
    0 0 18px var(--ig-glow);
}

.ig-reply-bar__title {
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ig-reply-bar__actions {
  display: inline-flex;
  gap: 10px;
  flex: 0 0 auto;
}

.ig-reply-bar__btn {
  background: transparent;
  border: 0;
  padding: 0;

  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ig-border-hover);
}

.ig-reply-bar__btn:hover {
  color: #fff;
  text-decoration-color: var(--ig-pink-500);
}

/* ===== Fix comment text breaking layout (long URLs / long words) ===== */

/* Make sure flex/grid children are allowed to shrink (helps with overflow in cards) */
.ig-comments .ig-comment,
.ig-comments .comment-body,
.ig-comments .comment-content {
  min-width: 0;
}

/* Apply robust wrapping to BOTH your class and WP's default class */
.ig-comments .ig-comment__content,
.ig-comments .comment-content {
  max-width: 100%;
  overflow-wrap: anywhere; /* breaks long URLs/strings */
  word-break: break-word; /* fallback */
  hyphens: auto;
}

/* Ensure descendants don't exceed container width */
.ig-comments .ig-comment__content *,
.ig-comments .comment-content * {
  max-width: 100%;
}

/* Links are common offenders */
.ig-comments .ig-comment__content a,
.ig-comments .comment-content a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Code blocks: don't expand the card */
.ig-comments .ig-comment__content pre,
.ig-comments .comment-content pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

.ig-comments .ig-comment__content code,
.ig-comments .comment-content code {
  word-break: break-word;
}

/* Media safety */
.ig-comments .ig-comment__content img,
.ig-comments .ig-comment__content video,
.ig-comments .ig-comment__content iframe,
.ig-comments .comment-content img,
.ig-comments .comment-content video,
.ig-comments .comment-content iframe {
  max-width: 100%;
  height: auto;
}

/* --- Comment header (author + date) responsive + unbreakable --- */
.ig-comments .ig-comment__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;

  /* allow wrapping instead of overflowing */
  flex-wrap: wrap;
  gap: 8px 12px;
}

/* Critical: allow flex children to shrink so ellipsis works */
.ig-comments .ig-comment__author,
.ig-comments .ig-comment__author-name,
.ig-comments .ig-comment__timestamp {
  min-width: 0;
}

/* Author block can grow, but must be allowed to shrink */
.ig-comments .ig-comment__author {
  flex: 1 1 260px; /* grows, shrinks, reasonable basis */
}

/* Truncate very long author names */
.ig-comments .ig-comment__author-name .fn,
.ig-comments .ig-comment__author-name .fn a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Timestamp sits to the right, but can shrink */
.ig-comments .ig-comment__timestamp {
  flex: 0 1 auto;
  margin-left: auto;
  text-align: right;
}

/* Keep date/time from wrapping into ugly multi-lines; truncate instead */
.ig-comments .ig-comment__timestamp a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Small screens: stack timestamp under author for a clean layout */
@media (max-width: 640px) {
  .ig-comments .ig-comment__timestamp {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }
}

/* Pending comment: slightly different accent so users instantly understand state */
.ig-comments .ig-comment--pending {
  border-color: var(--ig-pink-500);
}

/* Moderation notice block */
.ig-comments .ig-moderation-alert {
  display: flex;
  align-items: center;
  gap: 10px;

  margin: 8px 0 10px;
  padding: 10px 12px;

  border-radius: 10px;
  border: 1px solid var(--ig-pink-500);
  background: var(--ig-glow-2);
}

.ig-comments .ig-moderation-alert__badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;

  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(
    90deg,
    var(--ig-purp-500),
    rgba(177, 15, 255, 0.25)
  );
}

.ig-comments .ig-moderation-alert__text {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
}
