/* ============================================
   AsilMedia v2 — Comments (modern redesign v2)
   ============================================ */

.comments-section {
  margin-top: var(--sp-6);
  padding: var(--sp-5) var(--sp-4);
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  contain-intrinsic-size: 1px 600px;
}

@media (min-width: 768px) {
  .comments-section {
    padding: var(--sp-6);
  }
}

/* ─── Header ─────────────────────────────────── */
.comments-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.comments-section__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.comments-section__title .icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.comments-section__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 10px;
  margin-left: var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  background: rgba(0, 180, 216, 0.12);
  border-radius: var(--radius-full);
  line-height: 1.5;
}

.comments-section__cta {
  white-space: nowrap;
}

/* ─── Comments list ─────────────────────────── */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* DLE wraps every comment with <div id="comment-id-{id}">…</div>.
   That wrapper has no class and would break our flex gap if we used
   margin; gap on the parent is enough. */
.comments-list > div {
  min-width: 0;
}

/* DLE inserts new AJAX-added comments wrapped in
   <div id="blind-animation-{id}" style="display:none"> — we restyle that
   hidden state so jQuery's slideDown still reveals it, then add a
   landing flourish via .comment--just-added on the inner comment. */
.comments-list [id^="blind-animation-"] {
  will-change: transform, opacity;
}

.comment--just-added {
  animation: comment-land 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.05) both;
  animation-delay: 0.6s; /* waits for paper plane to arrive */
  box-shadow: 0 0 0 0 rgba(0, 180, 216, 0);
}

@keyframes comment-land {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(0, 180, 216, 0.35),
                0 0 0 6px rgba(0, 180, 216, 0.08);
  }
  55% {
    opacity: 1;
    transform: translateY(0) scale(1.01);
    border-color: var(--accent);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(0, 180, 216, 0);
  }
}

/* ═══════════════════════════════════════════════════
   Paper plane launch animation (submit → comments list)
   ═══════════════════════════════════════════════════ */
.comment-plane {
  position: fixed;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
  color: var(--accent, #00b4d8);
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transform: translate(0, 0) rotate(-45deg) scale(0.6);
  filter: drop-shadow(0 6px 14px rgba(0, 180, 216, 0.5));
}

.comment-plane svg {
  width: 100%;
  height: 100%;
  display: block;
}

.comment-plane--flying {
  animation: plane-fly 0.9s cubic-bezier(0.35, 0.0, 0.25, 1) forwards;
}

@keyframes plane-fly {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(var(--plane-angle, -45deg)) scale(0.5);
  }
  10% {
    opacity: 1;
    transform: translate(0, 0) rotate(var(--plane-angle, -45deg)) scale(1);
  }
  85% {
    opacity: 1;
    transform: translate(
      calc(var(--plane-dx, 0px)),
      calc(var(--plane-dy, 0px))
    ) rotate(var(--plane-angle, -45deg)) scale(0.95);
  }
  100% {
    opacity: 0;
    transform: translate(
      calc(var(--plane-dx, 0px)),
      calc(var(--plane-dy, 0px) - 8px)
    ) rotate(var(--plane-angle, -45deg)) scale(0.2);
  }
}

/* Ripple effect where the plane lands */
.comment-plane--landing::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent, #00b4d8);
  animation: plane-ripple 0.5s cubic-bezier(0, 0.5, 0.5, 1) forwards;
}

@keyframes plane-ripple {
  0% {
    width: 12px;
    height: 12px;
    margin-left: -6px;
    margin-top: -6px;
    opacity: 0.8;
  }
  100% {
    width: 90px;
    height: 90px;
    margin-left: -45px;
    margin-top: -45px;
    opacity: 0;
    border-width: 1px;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .comment--just-added,
  .comment-plane,
  .comment-plane--flying,
  .comment-plane--landing::after {
    animation: none !important;
  }
  .comment-plane {
    display: none;
  }
}

/* ─── Single comment ─────────────────────────── */
.comment {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
  position: relative;
}

.comment:hover {
  border-color: rgba(0, 180, 216, 0.35);
}

.comment__news-link {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
}

.comment__news-link a {
  color: var(--accent);
}

/* Avatar */
.comment__avatar {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-primary));
  border: 2px solid var(--border);
}

.comment__avatar a,
.comment__avatar img,
.comment__avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
}

@media (max-width: 600px) {
  .comment__avatar {
    width: 40px;
    height: 40px;
  }
}

/* Body */
.comment__body {
  flex: 1;
  min-width: 0;
}

.comment__header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  flex-wrap: wrap;
}

.comment__author {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.comment__author a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.comment__author a:hover {
  color: var(--accent);
}

.comment__date {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.comment__date::before {
  content: "·";
  margin-right: var(--sp-2);
  color: var(--text-muted);
}

/* Text */
.comment__text {
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: anywhere;
  margin-bottom: var(--sp-3);
}

.comment__text img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: var(--sp-2) 0;
}

.comment__text blockquote {
  margin: var(--sp-3) 0;
  padding: var(--sp-2) var(--sp-3);
  border-left: 3px solid var(--accent);
  background: var(--bg-tertiary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Actions — DLE replaces [reply], [fast], [com-edit], [com-del],
   [complaint] with <a> tags; keep selectors matching both our span
   wrappers and DLE's auto-injected anchors. */
.comment__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

.comment__actions > a,
.comment__action {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  cursor: pointer;
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.comment__actions > a:hover,
.comment__action:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.comment__actions svg,
.comment__action svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.comment__action--like:hover {
  color: var(--success, #22c55e);
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
}

.comment__action--dislike:hover {
  color: var(--danger, #ef4444);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.comment__action--danger:hover {
  color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

/* DLE also injects an admin checkbox via {mass-action} when viewing
   as admin. Tone it down so it doesn't dominate the layout. */
.comment .form-check-label {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  opacity: 0.4;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.comment:hover .form-check-label {
  opacity: 1;
}

/* Negative / spam-flagged comments render identically to regular ones.
   Dimming them looked like they were "disabled" and confused readers —
   the rating thumbs and the DLE Spam badge already communicate status. */

/* ─── Login CTA for guests ─────────────────── */
.comments-login-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  margin-top: var(--sp-5);
  background:
    radial-gradient(ellipse at top left, rgba(0, 180, 216, 0.08), transparent 60%),
    var(--bg-secondary);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  text-align: left;
}

.comments-login-cta__icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.7;
}

.comments-login-cta__body {
  flex: 1;
  min-width: 0;
}

.comments-login-cta__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 var(--sp-1);
}

.comments-login-cta__text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--sp-3);
  line-height: 1.5;
}

.comments-login-cta__actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .comments-login-cta {
    flex-direction: column;
    text-align: center;
    padding: var(--sp-4);
  }
  .comments-login-cta__icon {
    width: 40px;
    height: 40px;
  }
  .comments-login-cta__actions {
    justify-content: center;
  }
}

/* ─── Add comment form ─────────────────────── */
.comment-form {
  position: relative;
  margin-top: var(--sp-6);
  padding: var(--sp-5);
  background:
    radial-gradient(ellipse at top right, rgba(0, 180, 216, 0.06), transparent 50%),
    var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  scroll-margin-top: 80px;
}

.comment-form__head {
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.comment-form__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--sp-1);
  color: var(--text-primary);
}

.comment-form__title .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.comment-form__hint {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.comment-form__group {
  margin-bottom: var(--sp-3);
}

.comment-form__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

/* Core input styling */
.comment-form__input,
.comment-form input[type="text"],
.comment-form input[type="email"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-base);
  line-height: 1.5;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.comment-form__input:focus,
.comment-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

/* Editor area — DLE injects <div class="bb-editor"><textarea …></textarea></div>.
   Kill the runaway height the default CSS caused. */
.comment-form__editor {
  margin-bottom: var(--sp-3);
}

.comment-form__editor .bb-editor {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.comment-form__editor .bb-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.comment-form__editor textarea,
.comment-form__editor .bb-editor textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  max-height: 320px;
  padding: 14px;
  background: transparent;
  border: 0;
  outline: 0;
  resize: vertical;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-base);
  line-height: 1.6;
  box-sizing: border-box;
}

.comment-form__editor textarea::placeholder {
  color: var(--text-muted);
}

/* DLE BBcode toolbar */
.comment-form .bbcodes,
.comment-form__editor .bbcodes {
  background: var(--bg-tertiary);
  padding: 6px 10px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.comment-form input.bbcodes {
  width: auto;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 3px 8px;
  margin: 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: var(--fw-semibold);
  min-height: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.comment-form input.bbcodes:hover {
  background: var(--bg-secondary);
  color: var(--accent);
  border-color: var(--accent);
}

/* Captcha row */
.comment-form__captcha {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.comment-form__captcha img,
.comment-form__captcha .secure img {
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.comment-form__captcha input {
  flex: 1;
  min-width: 160px;
}

/* Upload wrapper keeps plupload tidy */
.comment-form__upload {
  margin-bottom: var(--sp-3);
}

.comment-form__upload .comments-image-uploader,
.comment-form__upload .plupload_wrapper {
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Footer with submit */
.comment-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.comment-form__rules {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.comment-form__rules .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.comment-form__submit {
  min-width: 160px;
}

/* ─── Comment pagination ──────────────────── */
.comments-nav {
  display: flex;
  justify-content: center;
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* ─── Small-screen adjustments ─────────────── */
@media (max-width: 600px) {
  .comments-section {
    padding: var(--sp-4) var(--sp-3);
    border-radius: var(--radius-md);
  }

  .comments-section__title {
    font-size: var(--fs-lg);
  }

  .comment {
    padding: var(--sp-3);
    gap: var(--sp-2);
  }

  .comment-form {
    padding: var(--sp-4) var(--sp-3);
  }

  .comment-form__footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .comment-form__submit {
    width: 100%;
  }

  .comment-form__rules {
    justify-content: center;
  }
}

/* ─── Spam badge ───────────────────────────── */
.comment .badge--quality {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger, #ef4444);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ============================================
   DLEPush toast notifications (global)
   Used by DLE for AJAX success/error messages.

   DLE's jGrowl keeps an empty template placeholder
   `<div class="DLEPush-notification"></div>` inside the root container —
   we must NOT style that shell, otherwise it shows up as an empty pill
   in the corner. Every style below is scoped to `.wrapper`, which DLE
   only applies to the real (visible) toasts.
   ============================================ */
.DLEPush {
  position: fixed;
  top: calc(var(--sp-4) + env(safe-area-inset-top, 0px));
  right: calc(var(--sp-4) + env(safe-area-inset-right, 0px));
  left: auto;
  width: auto;
  max-width: 380px;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: transparent;
  border: 0;
  padding: 0;
}

/* Empty template placeholder — never visible */
.DLEPush > .DLEPush-notification:not(.wrapper) {
  display: none !important;
}

.DLEPush-notification.wrapper {
  position: relative;
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 56px;
  background: var(--bg-secondary, #161b27);
  color: var(--text-primary, #e8eaf0);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-left: 4px solid var(--accent, #00b4d8);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
  font-size: var(--fs-sm, 14px);
  line-height: 1.5;
  word-wrap: break-word;
  animation: dlepush-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1.1);
}

/* Variant colors — DLE emits push-success / push-error / push-warning /
   push-info / push-notice as modifier classes on the wrapper */
.DLEPush-notification.wrapper.push-success {
  border-left-color: #22c55e;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.12) 0%, var(--bg-secondary, #161b27) 100%);
}
.DLEPush-notification.wrapper.push-success .DLEPush-icon { color: #22c55e; }

.DLEPush-notification.wrapper.push-error {
  border-left-color: #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12) 0%, var(--bg-secondary, #161b27) 100%);
}
.DLEPush-notification.wrapper.push-error .DLEPush-icon { color: #ef4444; }

.DLEPush-notification.wrapper.push-warning,
.DLEPush-notification.wrapper.push-notice {
  border-left-color: #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, var(--bg-secondary, #161b27) 100%);
}
.DLEPush-notification.wrapper.push-warning .DLEPush-icon,
.DLEPush-notification.wrapper.push-notice .DLEPush-icon { color: #f59e0b; }

.DLEPush-notification.wrapper.push-info {
  border-left-color: var(--accent, #00b4d8);
  background: linear-gradient(180deg, rgba(0, 180, 216, 0.12) 0%, var(--bg-secondary, #161b27) 100%);
}
.DLEPush-notification.wrapper.push-info .DLEPush-icon { color: var(--accent, #00b4d8); }

.DLEPush-notification.wrapper .DLEPush-icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #00b4d8);
}
.DLEPush-notification.wrapper .DLEPush-icon svg {
  width: 24px;
  height: 24px;
}

.DLEPush-notification.wrapper .DLEPush-header {
  font-weight: var(--fw-semibold, 600);
  margin-bottom: var(--sp-1);
  color: var(--text-primary);
}
.DLEPush-notification.wrapper .DLEPush-header:empty {
  display: none;
}

.DLEPush-notification.wrapper .DLEPush-message {
  color: var(--text-primary);
}

.DLEPush-notification.wrapper .DLEPush-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: 0;
  padding: 0 4px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary, #8b92a5);
  transition: color var(--duration-fast) var(--ease-out);
}
.DLEPush-notification.wrapper .DLEPush-close:hover {
  color: var(--text-primary);
}

@keyframes dlepush-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 600px) {
  .DLEPush {
    top: var(--sp-3);
    right: var(--sp-3);
    left: var(--sp-3);
    max-width: none;
  }

  .DLEPush-notification.wrapper {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}
