/*
==================================================
AURILUX COMMENTS SYSTEM STYLES
==================================================
*/

/* Comments Section Container */
.comments-section {
  margin-top: 3rem;
  padding: 2rem;
  background: rgba(15, 6, 6, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 0 30px rgba(212, 175, 55, 0.05);
}

/* On lesson pages, keep comments centered under the main content
   so they don't sit underneath the gamification HUD on wide screens. */
body[data-page-type="day"] .comments-section {
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

.comments-header {
  margin-bottom: 2rem;
}

.comments-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  color: var(--text-accent);
  margin-bottom: 0.5rem;
}

.comments-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Comment Form */
.comment-form {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(26, 10, 10, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
}

.comment-form textarea {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
  transition: all 0.3s ease;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--text-accent);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

.comment-form textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.comment-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.char-counter {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.char-counter.over-limit {
  color: #f87171;
  font-weight: 600;
}

.comment-submit-btn {
  padding: 0.75rem 1.5rem;
  background: var(--text-accent);
  color: #1a0a0c;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.comment-submit-btn:hover:not(:disabled) {
  background: #e0b584;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.comment-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Login Prompt */
.login-prompt {
  padding: 2rem;
  text-align: center;
  background: rgba(26, 10, 10, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
}

.login-prompt p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.login-prompt a {
  color: var(--text-accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.login-prompt a:hover {
  color: #e0b584;
}

/* Comments List */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.comments-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.no-comments {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Individual Comment */
.comment-item {
  padding: 1.5rem;
  background: rgba(26, 10, 10, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  transition: all 0.3s ease;
  animation: commentSlideIn 0.4s ease-out;
}

@keyframes commentSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.comment-item:hover {
  border-color: rgba(212, 175, 55, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.comment-author {
  font-weight: 600;
  color: var(--text-accent);
  font-size: 0.95rem;
}

.comment-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

.comment-body {
  margin-bottom: 1rem;
}

.comment-body p {
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.comment-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Like Button */
.btn-like {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-like:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.4);
  transform: scale(1.05);
}

.btn-like.liked {
  background: rgba(212, 175, 55, 0.15);
  border-color: rgba(212, 175, 55, 0.4);
}

.btn-like:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.like-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.like-count {
  font-weight: 600;
  color: var(--text-primary);
}

/* Delete Button */
.btn-delete {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 6px;
  color: #f87171;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-delete:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.5);
}

/* Toast Notifications */
.comment-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 1rem 1.5rem;
  background: rgba(26, 10, 10, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  backdrop-filter: blur(10px);
}

.comment-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.comment-toast--success {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(19, 59, 46, 0.95);
}

.comment-toast--error {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(59, 19, 19, 0.95);
}

/* Light Mode Overrides */
body[data-theme="light"] .comments-section,
body[data-theme="light"] .comment-form,
body[data-theme="light"] .login-prompt,
body[data-theme="light"] .comment-item,
body[data-theme="light"] .comment-form textarea,
body[data-theme="light"] .btn-like,
body[data-theme="light"] .comment-toast {
  color: #F0F0F0 !important;
}

body[data-theme="light"] .comments-section *,
body[data-theme="light"] .comment-form *,
body[data-theme="light"] .login-prompt *,
body[data-theme="light"] .comment-item *,
body[data-theme="light"] .comment-toast * {
  color: #F0F0F0 !important;
}

body[data-theme="light"] .comments-header h3,
body[data-theme="light"] .comment-author {
  color: #D4AF37 !important;
}

/* Responsive */
@media (max-width: 768px) {
  .comments-section {
    padding: 1.5rem 1rem;
  }

  .comment-form {
    padding: 1rem;
  }

  .comment-item {
    padding: 1rem;
  }

  .comment-form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .comment-submit-btn {
    width: 100%;
  }

  .comment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .comment-actions {
    flex-wrap: wrap;
  }
}
