/* =====================================================
           COMMENTS SECTION STYLES
           ===================================================== */
.comments-section {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 2px solid var(--primary-color);
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.comments-header h2 {
  font-family: "Roboto Slab", sans-serif;
  font-size: 1.8rem;
  color: var(--primary-color);
  margin: 0;
}

.comments-count {
  background: var(--primary-color);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  margin-left: 10px;
}

.comments-sort {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Roboto Slab", sans-serif;
  font-size: 0.9rem;
}

.comments-sort select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
}

/* Comment Form */
.comment-form-container {
  background: #f9f9f9;
  padding: 25px;
  border-radius: 8px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.comment-form-mascot {
  position: absolute;
  bottom: 30px;
  left: 25px;
  width: 150px;
  height: auto;
  pointer-events: none;
  z-index: 0;
}

.comment-form-container h3 {
  font-family: "Roboto Slab", sans-serif;
  font-size: 1.2rem;
  color: var(--primary-color);
  margin: 0 0 20px 0;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-family: "Roboto Slab", sans-serif;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 5px;
}

.form-group input,
.form-group textarea {
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: "Crimson Text", serif;
  font-size: 1rem;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(7, 41, 77, 0.1);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.char-counter {
  font-family: "Roboto Slab", sans-serif;
  font-size: 0.75rem;
  color: #888;
  text-align: right;
  margin-top: 5px;
}

.char-counter.warning {
  color: #e67e22;
}

.char-counter.danger {
  color: #e74c3c;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-note {
  font-size: 0.85rem;
  color: #888;
}

.btn {
  padding: 12px 25px;
  border: none;
  border-radius: 4px;
  font-family: "Roboto Slab", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #0a3a6e;
}

.btn-primary:disabled {
  background: #999;
  cursor: not-allowed;
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Comments List */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comment {
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.3s;
}

.comment:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.comment-header {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 12px;
}

.comment-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-light); 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: "Roboto Slab", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-meta {
  flex: 1;
}

.comment-author {
  font-family: "Roboto Slab", sans-serif;
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1rem;
}

.comment-author.is-owner::after {
  content: "You";
  margin-left: 8px;
  padding: 2px 8px;
  background: #e8f4fd;
  color: var(--primary-color);
  font-size: 0.7rem;
  border-radius: 10px;
  font-weight: 500;
}

.comment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: auto;
  align-items: flex-start;
}

.comment-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 10px;
  color: white;
  font-family: "Roboto Slab", sans-serif;
  position: relative;
  cursor: default;
}

.comment-badge[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 100;
  margin-bottom: 5px;
}

.comment-badge[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
  z-index: 100;
}

/* Like tooltip */
.like-btn {
  position: relative;
}

.like-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 100;
  margin-bottom: 8px;
  max-width: 200px;
  text-align: left;
}

.like-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

.like-btn:hover .like-tooltip {
  display: block;
}

.like-tooltip-item {
  display: block;
  padding: 2px 0;
}

.comment-time {
  font-size: 0.85rem;
  color: #888;
  margin-top: 2px;
}

.comment-edited {
  font-style: italic;
  color: #aaa;
}

.comment-content {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #333;
  margin-bottom: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.comment-action {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px 12px;
  font-family: "Roboto Slab", sans-serif;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.3s;
}

.comment-action:hover {
  background: #f5f5f5;
  color: var(--primary-color);
}

.comment-action.liked {
  color: #e74c3c;
  background: #fdf2f2;
}

.comment-action.liked:hover {
  background: #fce8e8;
}

.like-icon {
  font-size: 1rem;
  transition: transform 0.2s;
}

.comment-action:active .like-icon {
  transform: scale(1.3);
}

.comment-owner-actions {
  margin-left: auto;
  display: flex;
  gap: 5px;
}

.comment-owner-action {
  background: none;
  border: none;
  padding: 5px 10px;
  font-size: 0.8rem;
  color: #999;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s;
}

.comment-owner-action:hover {
  background: #f5f5f5;
  color: #666;
}

.comment-owner-action.delete:hover {
  background: #fdf2f2;
  color: #e74c3c;
}

/* Replies */
.comment-replies {
  margin-top: 20px;
  margin-left: 30px;
  padding-left: 20px;
  border-left: 2px solid #e0e0e0;
}

.comment-replies .comment {
  background: #fafafa;
  border-color: #f0f0f0;
}

.comment-replies .comment-avatar {
  width: 35px;
  height: 35px;
  font-size: 0.9rem;
}

/* Reply Form */
.reply-form-container {
  margin-top: 15px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
}

.reply-form-container .form-row {
  flex-wrap: wrap;
}

.reply-form-container .form-group {
  min-width: 150px;
}

.reply-form-container textarea {
  min-height: 80px;
}

.reply-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Empty state */
.comments-empty {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.comments-empty-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

.comments-empty p {
  font-family: "Roboto Slab", sans-serif;
  font-size: 1.1rem;
  margin: 0;
}

/* Loading state */
.comments-loading {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error/Success Messages */
.message {
  padding: 12px 20px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-family: "Roboto Slab", sans-serif;
  font-size: 0.9rem;
}

.message-error {
  background: #fdf2f2;
  color: #c0392b;
  border: 1px solid #f5c6cb;
}

.message-success {
  background: #e8f8f0;
  color: #27ae60;
  border: 1px solid #c3e6cb;
}

@media print {
  .print-logo {
    display: block;
  }
  .print-logo img,
  .print-logo svg {
    height: 40px;
    margin-bottom: 20px;
  }
  .header-global,
  .header-nav-container,
  .flex-sidebar,
  .footer-wrapper {
    display: none;
  }
}

/* Responsive */
@media (max-width: 960px) {
  .generic-flex-container {
    flex-direction: column;
  }

  .flex-sidebar {
    width: 100%;
  }

  .single-title h1 {
    font-size: 2rem;
  }
}

@media (max-width: 640px) {
  .header-logo-desktop {
    display: none;
  }

  .header-logo-mobile {
    display: block;
  }

  .header-logo-mobile img,
  .header-logo-mobile svg {
    height: 40px;
  }

  .main-menu {
    gap: 15px;
  }

  .main-menu li a {
    font-size: 12px;
  }

  .single-title h1 {
    font-size: 1.6rem;
  }

  .single-meta {
    flex-direction: column;
    gap: 5px;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }

  .footer-branding {
    max-width: 100%;
  }

  .footer-nav-links {
    justify-content: center;
  }

  /* Comments responsive */
  .comments-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row {
    flex-direction: column;
  }

  .form-actions {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .form-actions .form-note {
    text-align: center;
  }

  .comment-replies {
    margin-left: 10px;
    padding-left: 15px;
  }

  .comment-actions {
    flex-wrap: wrap;
  }

  .comment-owner-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
    margin-top: 10px;
  }
}
