/* ══════════════════════════════════════════════════════════
   SALMART — ELITE REPLY PAGE
   Fonts : Syne (display) · DM Sans (body)
   Tokens: aligned with checkout.css / Alert.css / Deals.css
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=Syne:wght@700;800&display=swap');

/* ══════════════════════════════════════════════════════════
   TOKENS
   ══════════════════════════════════════════════════════════ */
:root {
  --brand:        #1a7a3c;
  --brand-mid:    #22a050;
  --brand-light:  #2ecc71;
  --brand-glow:   rgba(46,204,113,.22);
  --brand-tint:   rgba(46,204,113,.09);
  --brand-tint-2: rgba(46,204,113,.15);

  --danger:       #e63946;
  --danger-soft:  rgba(230,57,70,.10);
  --warning:      #f0a500;

  --bg:           #f2f4f7;
  --surface:      #ffffff;
  --surface-2:    #f8f9fb;
  --border:       #e8eaed;
  --border-subtle:#f0f2f5;
  --text-1:       #0d0f12;
  --text-2:       #44474d;
  --text-3:       #8a8f9a;
  --text-4:       #b2b7c2;

  --sh-xs:  0 1px 3px rgba(0,0,0,.06);
  --sh-sm:  0 2px 8px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  --sh-md:  0 4px 16px rgba(0,0,0,.11);
  --sh-lg:  0 8px 32px rgba(0,0,0,.14);
  --sh-btn: 0 3px 10px rgba(26,122,60,.38);
  --sh-btn-h: 0 6px 20px rgba(26,122,60,.50);

  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-full: 9999px;

  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-logo: 'Syne', 'DM Sans', sans-serif;

  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --ease-out:    cubic-bezier(.22,1,.36,1);
  --t-fast: .15s;
  --t-mid:  .25s;

  --header-h: 58px;
  --input-h:  68px;
}

/* ══════════════════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-2);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; outline: none; }
textarea { font-family: inherit; }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 var(--brand-glow); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ══════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════ */
.reply-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(46,204,113,.08), 0 2px 12px rgba(0,0,0,.05);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.header-container {
  height: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.back-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--t-mid) var(--ease-spring);
}

.back-button:hover {
  background: var(--brand-tint);
  border-color: rgba(46,204,113,.3);
  color: var(--brand);
  transform: translateX(-2px);
}

.back-button:active { transform: scale(.93); }

.header-title {
  flex: 1;
  text-align: center;
}

.header-title h1 {
  font-family: var(--font-logo);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1.2;
  letter-spacing: -.2px;
}

.reply-count {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 2px;
}

.header-actions {
  width: 36px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════ */
.reply-main {
  min-height: calc(100vh - var(--header-h) - var(--input-h));
  padding-bottom: calc(var(--input-h) + 20px);
}

.reply-container {
  max-width: 768px;
  margin: 0 auto;
  padding: 16px 14px;
}

/* ══════════════════════════════════════════════════════════
   SECTION LABELS
   ══════════════════════════════════════════════════════════ */
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 10px;
}

.section-label i {
  color: var(--brand);
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════════
   PARENT COMMENT SECTION
   ══════════════════════════════════════════════════════════ */
.parent-comment-section {
  margin-bottom: 24px;
  animation: fadeUp .3s var(--ease-out) both;
}

.comment-details-container {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   COMMENT CARD
   ══════════════════════════════════════════════════════════ */
.comment {
  display: flex;
  gap: 12px;
  padding: 16px;
  transition: background var(--t-fast) ease;
}

.comment:hover { background: var(--surface-2); }

/* Parent comment — highlighted */
.comment.parent-comment {
  background: linear-gradient(135deg,
    rgba(46,204,113,.07) 0%,
    rgba(26,122,60,.05) 100%);
  border-left: 3.5px solid var(--brand);
}

.comment.parent-comment:hover {
  background: linear-gradient(135deg,
    rgba(46,204,113,.12) 0%,
    rgba(26,122,60,.08) 100%);
}

.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--r-full);
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color var(--t-fast) ease;
}

.comment:hover .comment-avatar { border-color: var(--brand); }

.comment.parent-comment .comment-avatar {
  width: 48px;
  height: 48px;
  border: 2px solid var(--brand);
}

.comment-info {
  flex: 1;
  min-width: 0;
}

.comment-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comment.parent-comment .comment-info strong {
  font-family: var(--font-logo);
  font-size: 15px;
  color: var(--brand);
}

.comment-info p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 6px;
  word-break: break-word;
}

.comment-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-4);
  font-weight: 500;
}

.comment-time::before {
  content: '';
  width: 3px;
  height: 3px;
  background: var(--text-4);
  border-radius: 50%;
  display: inline-block;
}

/* ══════════════════════════════════════════════════════════
   REPLIES SECTION
   ══════════════════════════════════════════════════════════ */
.replies-section {
  margin-bottom: 24px;
  animation: fadeUp .35s var(--ease-out) .06s both;
}

.replies-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.reply {
  border-bottom: 1px solid var(--border-subtle);
  animation: fadeUp .28s var(--ease-out) both;
}

.reply:last-child { border-bottom: none; }

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  animation: fadeUp .4s var(--ease-out) both;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-tint);
  border: 2px solid rgba(46,204,113,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 28px;
  color: var(--brand);
}

.empty-title {
  font-family: var(--font-logo);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}

.empty-subtitle {
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.55;
  max-width: 240px;
}

/* ══════════════════════════════════════════════════════════
   ERROR STATE
   ══════════════════════════════════════════════════════════ */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  gap: 8px;
  animation: fadeUp .4s var(--ease-out) both;
}

.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger-soft);
  border: 2px solid rgba(230,57,70,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--danger);
  margin-bottom: 8px;
}

.error-title {
  font-family: var(--font-logo);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}

.error-message {
  font-size: 13.5px;
  color: var(--text-3);
}

.retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand));
  color: #fff;
  border: none;
  border-radius: var(--r-full);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--sh-btn);
  transition: all var(--t-mid) var(--ease-spring);
}

.retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-btn-h);
}

/* ══════════════════════════════════════════════════════════
   SKELETON LOADERS
   ══════════════════════════════════════════════════════════ */
.loading-skeleton { padding: 16px; }

.skeleton-comment {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.skeleton-comment:last-child { margin-bottom: 0; }

.skeleton-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-content { flex: 1; }

.skeleton-line {
  height: 12px;
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-line.short  { width: 32%; }
.skeleton-line.medium { width: 62%; }
.skeleton-line:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════════════════════
   REPLY INPUT — STICKY BOTTOM
   ══════════════════════════════════════════════════════════ */
.reply-input-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  z-index: 200;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.reply-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 768px;
  margin: 0 auto;
}

/* Avatar */
.user-avatar-container { flex-shrink: 0; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
  aspect-ratio: 1/1;
}

.avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 14px;
}

/* Input field wrapper */
.input-field-container {
  flex: 1;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  transition: border-color var(--t-fast) ease,
              background var(--t-fast) ease,
              box-shadow var(--t-fast) ease;
  min-width: 0;
}

.input-field-container:focus-within {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

/* Textarea */
.reply-textarea {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 14px;
  color: var(--text-1);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  min-height: 22px;
}

.reply-textarea::placeholder { color: var(--text-4); }

/* Actions row */
.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
}

.char-count {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  transition: color var(--t-fast) ease;
}

.emoji-button {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 16px;
  transition: all var(--t-fast) ease;
}

.emoji-button:hover {
  background: var(--border);
  color: var(--text-1);
}

/* Send button */
.reply-submit {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand));
  color: #fff;
  border-radius: var(--r-full);
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: var(--sh-btn);
  transition: all var(--t-mid) var(--ease-spring);
}

.reply-submit:not(:disabled):hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--sh-btn-h);
}

.reply-submit:not(:disabled):active { transform: scale(.93); }

.reply-submit:disabled {
  background: var(--border);
  color: var(--text-4);
  cursor: not-allowed;
  box-shadow: none;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: var(--r-full);
  animation: spin .65s linear infinite;
  display: block;
}

/* ══════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

.toast-message {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--text-1);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--r-full);
  box-shadow: var(--sh-lg);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity var(--t-mid) ease, transform var(--t-mid) var(--ease-spring);
  pointer-events: none;
  min-width: 160px;
  max-width: 340px;
  white-space: nowrap;
}

.toast-message.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-message.success {
  background: linear-gradient(135deg, var(--brand-mid), var(--brand));
}

.toast-message.error {
  background: linear-gradient(135deg, var(--danger), #c82333);
}

/* ══════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .reply-container { padding: 12px 10px; }
  .comment { padding: 12px; gap: 10px; }
  .comment-avatar { width: 36px; height: 36px; }
  .comment.parent-comment .comment-avatar { width: 42px; height: 42px; }
  .comment-info p { font-size: 13.5px; }
  .header-title h1 { font-size: 17px; }
}

/* ══════════════════════════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════════════════════════ */
*:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

::selection {
  background: var(--brand-tint-2);
  color: var(--text-1);
}

/* ══════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --brand:        #2ecc71;
    --brand-mid:    #27ae60;
    --brand-light:  #45e785;
    --brand-glow:   rgba(46,204,113,.25);
    --brand-tint:   rgba(46,204,113,.10);
    --brand-tint-2: rgba(46,204,113,.18);

    --danger:      #ff6b6b;
    --danger-soft: rgba(255,107,107,.12);

    --bg:           #101214;
    --surface:      #1a1d21;
    --surface-2:    #22262b;
    --border:       #2e3238;
    --border-subtle:#22262b;
    --text-1:       #eceef0;
    --text-2:       #9ba3ae;
    --text-3:       #6b7280;
    --text-4:       #4b5563;

    --sh-xs:  0 1px 3px rgba(0,0,0,.35);
    --sh-sm:  0 2px 8px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.04);
    --sh-md:  0 4px 16px rgba(0,0,0,.55);
    --sh-lg:  0 8px 32px rgba(0,0,0,.65);
    --sh-btn: 0 3px 12px rgba(46,204,113,.35);
    --sh-btn-h: 0 6px 22px rgba(46,204,113,.48);
  }

  body { background: #101214; }

  .reply-header {
    background: rgba(16,18,20,.97);
    border-bottom-color: #2e3238;
  }

  .reply-input-container {
    background: rgba(16,18,20,.97);
    border-top-color: #2e3238;
  }

  .comment-details-container,
  .replies-list,
  .empty-state,
  .error-state {
    background: var(--surface);
    border-color: var(--border);
  }

  .comment:hover { background: var(--surface-2); }

  .comment.parent-comment {
    background: rgba(46,204,113,.07);
    border-left-color: var(--brand);
  }

  .comment.parent-comment:hover {
    background: rgba(46,204,113,.11);
  }

  .comment-avatar { border-color: var(--border); }
  .comment:hover .comment-avatar { border-color: var(--brand); }
  .comment.parent-comment .comment-avatar { border-color: var(--brand); }

  .back-button {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-2);
  }

  .back-button:hover {
    background: rgba(46,204,113,.10);
    border-color: rgba(46,204,113,.3);
    color: var(--brand);
  }

  .input-field-container {
    background: var(--surface-2);
    border-color: var(--border);
  }

  .input-field-container:focus-within {
    background: var(--surface);
    border-color: var(--brand);
  }

  .reply-textarea { color: var(--text-1); }
  .reply-textarea::placeholder { color: var(--text-4); }

  .user-avatar { border-color: var(--border); }

  .avatar-fallback {
    background: var(--surface-2);
    border-color: var(--border);
  }

  .emoji-button:hover { background: var(--border); }

  .reply-submit:disabled {
    background: var(--surface-2);
    color: var(--text-4);
  }

  .skeleton-avatar,
  .skeleton-line {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
  }

  .toast-message { background: var(--surface-2); }
  .toast-message.success {
    background: linear-gradient(135deg, var(--brand-mid), var(--brand));
    color: #0d0f12;
  }

  .reply { border-bottom-color: var(--border); }
}


        .material-symbols-rounded {
            font-size: 0 !important;
            width: 24px; height: 24px;
            display: inline-flex; align-items: center; justify-content: center;
        }
        .icon {
            display: inline-flex; align-items: center;
            justify-content: center; vertical-align: middle; flex-shrink: 0;
        }
        .icon svg        { width: 24px; height: 24px; fill: currentColor; }
        .icon.sm svg     { width: 18px; height: 18px; }
        .icon.xl svg     { width: 56px; height: 56px; }
        .section-label   { display: flex; align-items: center; gap: 0.5rem; }
        .section-label .icon { color: var(--primary-color); }
        .emoji-button    { display: flex; align-items: center; justify-content: center; }
        .reply-submit .icon svg { width: 22px; height: 22px; }
        .back-button .icon svg  { width: 22px; height: 22px; }
        .toast-icon svg         { width: 20px; height: 20px; }

        /* Error state */
        .error-state {
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 2.5rem 1.5rem;
            text-align: center;
            background: var(--white);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-md);
            gap: 0.75rem;
        }
        .error-state > svg { width: 52px; height: 52px; fill: var(--error-color); opacity: 0.75; }
        .error-state > p   { font-size: var(--font-size-base); font-weight: 600; color: var(--gray-700); margin: 0; }
        .error-message     { font-size: var(--font-size-sm); color: var(--gray-500); }
        .retry-btn {
            margin-top: 0.25rem;
            padding: 0.5rem 1.5rem;
            background: var(--primary-color);
            color: #fff;
            border: none;
            border-radius: var(--radius-full);
            font-size: var(--font-size-sm);
            font-weight: 600;
            cursor: pointer;
            font-family: inherit;
            transition: background 150ms;
        }
        .retry-btn:hover { background: #1db53a; }
    