/* ================== ENHANCED REPLY SYSTEM - CLEAN & RESPONSIVE ================== */

/* Main reply card container */
.reply-item {
  position: relative;
  padding: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 12px;
  animation: slideInReply 0.3s ease-out;
  margin-bottom: 2px;
}

@keyframes slideInReply {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Threading line - Much more visible */
.reply-item::before {
  content: '';
  position: absolute;
  left: 8px;
  top: -12px;
  bottom: -12px;
  width: 3px;
  background: linear-gradient(180deg, rgba(56,189,248,0.8), rgba(56,189,248,0.3));
  opacity: 1;
  pointer-events: none;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(56,189,248,0.4);
}

.reply-item[data-level="0"]::before { display: none; }

/* Horizontal layout */
.reply-thread-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

/* Avatar styling */
.reply-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56,189,248,0.2), rgba(125,211,252,0.12));
  border: 2px solid rgba(56,189,248,0.3);
  box-shadow: 0 2px 8px rgba(56,189,248,0.1);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.reply-item:hover .reply-avatar {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(56,189,248,0.18);
  border-color: rgba(56,189,248,0.4);
}

/* Body container */
.reply-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Parent label - Replying to username */
.reply-parent-label {
  font-size: 0.8rem;
  color: #38bdf8;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(56,189,248,0.08));
  border-left: 4px solid rgba(56,189,248,0.5);
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.reply-parent-label:hover {
  background: rgba(56,189,248,0.2);
  border-left-color: rgba(56,189,248,0.6);
}

.reply-parent-label::before {
  content: '↳';
  font-weight: 800;
  opacity: 0.8;
  font-size: 1rem;
}

/* Header with alias and actions */
.reply-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Alias (username) styling */
.reply-item .reply-alias {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  row-gap: 6px;
  margin-bottom: 0;
  min-width: 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.reply-item .reply-alias-name { 
  min-width: 0; 
  overflow-wrap: anywhere; 
  flex: 1 1 auto;
  word-break: break-word;
}

/* Thread indicator badge */
.reply-thread-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #38bdf8;
  background: linear-gradient(135deg, rgba(56,189,248,0.2), rgba(56,189,248,0.08));
  border: 1.5px solid rgba(56,189,248,0.35);
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(56,189,248,0.12);
}

/* Action buttons container */
.reply-actions-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
  flex-shrink: 0;
}

/* View replies/Hide replies button */
.collapse-toggle {
  background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(56,189,248,0.08));
  border: 1.5px solid rgba(56,189,248,0.3);
  color: #38bdf8;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  touch-action: manipulation;
}

.collapse-toggle:hover { 
  background: linear-gradient(135deg, rgba(56,189,248,0.22), rgba(56,189,248,0.12));
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(56,189,248,0.15);
  border-color: rgba(56,189,248,0.4);
}

.collapse-toggle:active {
  transform: translateY(0);
}

/* Reply button */
.reply-item .reply-to-btn {
  border: 1.5px solid rgba(56,189,248,0.35);
  background: linear-gradient(135deg, rgba(56,189,248,0.14), rgba(56,189,248,0.07));
  color: #38bdf8;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  touch-action: manipulation;
}

.reply-item .reply-to-btn::before {
  content: '+';
  font-size: 1.1rem;
  font-weight: 900;
}

.reply-item .reply-to-btn:hover {
  background: linear-gradient(135deg, rgba(56,189,248,0.22), rgba(56,189,248,0.12));
  border-color: rgba(56,189,248,0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56,189,248,0.18);
}

.reply-item .reply-to-btn:active {
  transform: translateY(0);
}

/* Reply message text */
.reply-item .reply-text {
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  margin-top: 4px;
  padding: 8px 0;
}

/* Footer with time and actions */
.reply-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(56,189,248,0.08);
}

/* Timestamp */
.reply-item .reply-time { 
  font-size: 0.75rem; 
  color: var(--text-secondary); 
  letter-spacing: 0.01em;
  font-weight: 500;
  min-width: auto;
}

/* Footer action buttons container */
.reply-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Like button */
.reply-like-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid rgba(56,189,248,0.3);
  background: linear-gradient(135deg, rgba(56,189,248,0.12), rgba(56,189,248,0.05));
  color: #38bdf8;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  letter-spacing: 0.01em;
  min-height: 40px;
  touch-action: manipulation;
}

.reply-like-btn:hover { 
  background: linear-gradient(135deg, rgba(56,189,248,0.18), rgba(56,189,248,0.09));
  border-color: rgba(56,189,248,0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(56,189,248,0.12);
}

.reply-like-btn.active {
  color: #fda4af;
  border-color: rgba(244,63,94,0.38);
  background: linear-gradient(135deg, rgba(244,63,94,0.18), rgba(244,63,94,0.07));
  box-shadow: 0 0 0 2px rgba(244,63,94,0.1);
}

.reply-like-btn i {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reply-like-btn.active i {
  transform: scale(1.25) rotate(-12deg);
}

/* Delete button */
.reply-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(239,68,68,0.35);
  background: linear-gradient(135deg, rgba(239,68,68,0.14), rgba(239,68,68,0.06));
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  letter-spacing: 0.01em;
  gap: 4px;
  text-transform: uppercase;
  min-height: 40px;
  touch-action: manipulation;
}

.reply-delete-btn:hover {
  background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(239,68,68,0.09));
  border-color: rgba(239,68,68,0.45);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239,68,68,0.14);
}

.reply-delete-btn:active {
  transform: translateY(0);
}

/* OP badge - Original Poster */
.reply-item .op-badge { 
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(251, 191, 36, 0.3);
  border: 1.5px solid rgba(251, 191, 36, 0.48);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Healer badge - Supportive commenter */
.reply-item .healer-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(167,243,208,0.96), rgba(110,231,183,0.92));
  color: #064e3b;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.28);
  border: 1.5px solid rgba(16, 185, 129, 0.45);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Hover state for cards */
.reply-item:hover,
.reply-item:focus-within {
  border-color: rgba(125,211,252,0.5);
  box-shadow: 0 0 0 1px rgba(125,211,252,0.15), 0 12px 32px rgba(2,132,199,0.12);
  background: linear-gradient(180deg, rgba(8,145,178,0.06), var(--card-bg));
}

/* Targeted/highlighted reply */
.reply-item.reply-targeted {
  border-color: rgba(125,211,252,0.65) !important;
  box-shadow: 0 0 0 2px rgba(125,211,252,0.22), 0 16px 40px rgba(2,132,199,0.2) !important;
  background: linear-gradient(180deg, rgba(8,145,178,0.18), var(--card-bg)) !important;
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* Nested replies container */
.reply-children {
  margin-top: 16px;
  margin-left: 0;
  padding-left: 14px;
  border-left: 3px solid rgba(56,189,248,0.2);
  display: block;
  position: relative;
}

.reply-children::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, rgba(56,189,248,0.5), transparent);
  border-radius: 10px;
}

/* Collapsed state */
.reply-item.collapsed > .reply-children { 
  display: none !important; 
}

/* Loading state animations */
.reply-like-btn.loading,
.reply-delete-btn.loading,
.reply-to-btn.loading {
  opacity: 0.6;
  pointer-events: none;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { opacity: 0.6; }
  50% { opacity: 0.8; }
  100% { opacity: 0.6; }
}

@keyframes slideOutReply {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.5) rotate(15deg); }
}

/* Light mode adjustments */
body.light-mode .reply-item .op-badge {
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
  color: #7c2d12;
  box-shadow: 0 3px 12px rgba(217, 119, 6, 0.35);
  border: 1.5px solid rgba(217, 119, 6, 0.6);
}

body.light-mode .reply-item .healer-badge {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
  border-color: rgba(16,185,129,0.45);
  box-shadow: 0 3px 12px rgba(16,185,129,0.25);
}

/* ============ TABLET RESPONSIVE (768px) ============ */
@media (max-width: 768px) {
  .reply-item {
    padding: 14px;
    gap: 11px;
    margin-bottom: 4px;
  }

  .reply-thread-row {
    gap: 11px;
  }

  .reply-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 1.3rem;
  }

  .reply-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    width: 100%;
  }

  .reply-actions-inline {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
    gap: 7px;
    flex-direction: column;
  }

  .collapse-toggle,
  .reply-item .reply-to-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 12px;
    min-height: 44px;
    font-size: 0.82rem;
  }

  .reply-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .reply-footer-actions {
    width: 100%;
    gap: 7px;
    flex-direction: column;
  }

  .reply-like-btn,
  .reply-delete-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .reply-item .reply-text {
    font-size: 0.93rem;
  }
}

/* ============ MOBILE RESPONSIVE (480px) ============ */
@media (max-width: 480px) {
  .reply-item {
    padding: 12px;
    gap: 10px;
    border-radius: 10px;
  }

  .reply-thread-row {
    gap: 10px;
    flex-wrap: wrap;
  }

  .reply-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 1.2rem;
  }

  .reply-body {
    width: 100%;
    gap: 9px;
  }

  .reply-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .reply-item .reply-alias {
    font-size: 0.9rem;
    gap: 6px;
  }

  .reply-actions-inline {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
    gap: 6px;
    flex-direction: column;
  }

  .collapse-toggle,
  .reply-item .reply-to-btn,
  .reply-like-btn,
  .reply-delete-btn {
    font-size: 0.78rem;
    padding: 9px 10px;
    min-height: 42px;
    width: 100%;
    justify-content: center;
    border-radius: 6px;
  }

  .reply-item .reply-text {
    font-size: 0.92rem;
    line-height: 1.5;
    margin-top: 2px;
  }

  .reply-time {
    font-size: 0.7rem;
  }

  .reply-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid rgba(56,189,248,0.06);
  }

  .reply-footer-actions {
    width: 100%;
    gap: 6px;
    flex-direction: column;
  }

  .reply-parent-label {
    font-size: 0.75rem;
    padding: 7px 10px;
    gap: 5px;
  }

  .reply-parent-label::before {
    font-size: 0.9rem;
  }

  .reply-thread-indicator {
    font-size: 0.65rem;
    padding: 4px 8px;
  }

  .reply-item .op-badge,
  .reply-item .healer-badge {
    font-size: 0.65rem;
    padding: 4px 8px;
  }

  .reply-children {
    padding-left: 12px;
    margin-top: 12px;
  }

  .reply-item::before {
    left: 6px;
  }
}

/* ============ VERY SMALL MOBILE (max 360px) ============ */
@media (max-width: 360px) {
  .reply-item {
    padding: 10px;
    gap: 8px;
  }

  .reply-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 1rem;
  }

  .collapse-toggle,
  .reply-item .reply-to-btn,
  .reply-like-btn,
  .reply-delete-btn {
    font-size: 0.7rem;
    padding: 8px 8px;
    min-height: 40px;
  }

  .reply-item .reply-alias {
    font-size: 0.85rem;
  }

  .reply-item .reply-text {
    font-size: 0.88rem;
  }
}

/* ============ ACCOUNT MODAL STYLING ============ */
.account-modal {
  max-width: 760px !important;
}

.account-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px;
}

.tab-pill {
  padding: 12px 16px !important;
  border-radius: 12px !important;
  border: none !important;
  cursor: pointer !important;
  background: rgba(56, 189, 248, 0.08) !important;
  color: var(--text-primary) !important;
  font-weight: 800 !important;
  font-size: 0.9rem !important;
  transition: all 0.2s ease !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
}

.tab-pill:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  transform: translateY(-1px) !important;
}

.tab-pill.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.12)) !important;
  border: 1.5px solid rgba(56, 189, 248, 0.3) !important;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
}

.account-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.3);
}

.account-scroll::-webkit-scrollbar {
  width: 6px;
}

.account-scroll::-webkit-scrollbar-track {
  background: rgba(56, 189, 248, 0.05);
  border-radius: 10px;
}

.account-scroll::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 10px;
}

.account-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

.delete-activity-btn {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08)) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
  cursor: pointer !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.delete-activity-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.15)) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
}

.delete-activity-btn:active {
  transform: translateY(0) !important;
}

.parent-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  opacity: 0.85;
  color: #38bdf8;
  margin-right: 2px;
}
