/* src/css/comments.css */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-strong);
}
.comments-container {
  max-width: 100%;
}
.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.comments-header h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}
.comments-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
#sort-comments {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sort-arrow {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}
.comment-form-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px var(--shadow-color);
  display: none;
}
.comment-form-container.show {
  display: block;
}
.comment-form .form-group {
  margin-bottom: 1.5rem;
}
.comment-form .form-group:last-of-type {
  margin-bottom: 0.5rem;
}
.comment-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}
.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-orange-rgb), 0.2);
}
.comment-form textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}
.captcha-group {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.captcha-question {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-style: italic;
  box-sizing: border-box;
  margin-bottom: 1rem;
  line-height: 1.4;
}
.captcha-content {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}
.captcha-question-wrapper {
  flex: 1;
  min-width: 0;
}
.captcha-question-wrapper .captcha-question {
  margin-bottom: 0;
}
.captcha-input-group {
  flex: 1;
  min-width: 0;
}
.captcha-input-group input {
  width: 100%;
  margin-bottom: 0 !important;
}
@media (max-width: 768px) {
  .captcha-content {
    flex-direction: column;
    gap: 0;
  }
  .captcha-question-wrapper {
    width: 100%;
    margin-bottom: 1rem;
  }
  .captcha-question-wrapper .captcha-question {
    width: 100%;
    margin-bottom: 0;
  }
  .captcha-input-group {
    width: 100%;
    margin-top: 0;
  }
  .captcha-input-group input {
    width: 100%;
  }
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
  align-items: flex-start;
}
.secret-group {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0 !important;
}
.secret-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.name-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0 !important;
}
.name-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.btn-submit {
  flex-shrink: 0;
  margin: auto;
}
@media (max-width: 640px) {
  .comment-form-container {
    padding: 1.5rem 1rem;
  }
  .comment-form .form-group {
    margin-bottom: 1.5rem;
  }
  .comment-form label {
    margin-bottom: 0.75rem;
    font-size: 1rem;
  }
  .comment-form input,
  .comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 6px;
  }
  .comment-form textarea {
    min-height: 120px;
  }
  .captcha-group {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }
  .captcha-question {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.4;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }
  .secret-group,
  .name-group {
    min-width: unset;
    margin-bottom: 0 !important;
  }
  .form-help {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.3;
  }
  .btn-submit {
    margin-top: 0;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    min-height: 48px;
  }
}
.form-message {
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 1rem;
  display: block;
}
.form-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.form-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
html.dark-mode .form-message.success {
  background: #1e3a2e;
  color: #4ade80;
  border-color: #16a34a;
}
html.dark-mode .form-message.error {
  background: #3c1e1e;
  color: #f87171;
  border-color: #dc2626;
}
.delete-form-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px var(--shadow-color);
  display: none;
}
.delete-form-container.show {
  display: block;
}
.delete-form .secret-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.secret-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.secret-input-group input {
  flex: 1;
  margin-bottom: 0 !important;
}
.secret-input-group button {
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
}
.form-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.3;
}
.delete-preview {
  margin-top: 1rem;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-primary);
}
.preview-header {
  padding: 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 500;
  color: var(--text-primary);
}
.preview-comment {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.preview-comment:last-child {
  border-bottom: none;
}
.preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.preview-meta strong {
  color: var(--text-primary);
}
.preview-meta time {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.preview-content {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.9rem;
}
.no-preview {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}
.delete-message {
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 1rem;
  display: block;
}
.delete-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.delete-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.delete-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}
html.dark-mode .delete-message.success {
  background: #1e3a2e;
  color: #4ade80;
  border-color: #16a34a;
}
html.dark-mode .delete-message.error {
  background: #3c1e1e;
  color: #f87171;
  border-color: #dc2626;
}
html.dark-mode .delete-message.info {
  background: #1e293b;
  color: #38bdf8;
  border-color: #0ea5e9;
}
.delete-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.delete-modal-content {
  background: var(--bg-primary);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.delete-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.delete-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.2rem;
}
.delete-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.delete-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.delete-modal-body {
  padding: 1rem;
}
.delete-modal-body p {
  margin: 0 0 1rem 0;
  color: var(--text-primary);
}
.modal-secret-input {
  padding: 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
}
.modal-secret-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(255, 154, 60, 0.2);
}
.delete-modal-message {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
.delete-modal-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.delete-modal-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.delete-modal-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}
html.dark-mode .delete-modal-message.success {
  background: #1e3a2e;
  color: #4ade80;
  border-color: #16a34a;
}
html.dark-mode .delete-modal-message.error {
  background: #3c1e1e;
  color: #f87171;
  border-color: #dc2626;
}
html.dark-mode .delete-modal-message.info {
  background: #1e293b;
  color: #38bdf8;
  border-color: #0ea5e9;
}
.delete-modal-footer {
  display: flex;
  justify-content: end;
  gap: 0.75rem;
  padding: 1rem;
  border-top: 1px solid var(--border-subtle);
}
.brief-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  font-size: 0.9rem;
  max-width: 300px;
}
.brief-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.brief-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.brief-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}
html.dark-mode .brief-message.success {
  background: #1e3a2e;
  color: #4ade80;
  border-color: #16a34a;
}
html.dark-mode .brief-message.error {
  background: #3c1e1e;
  color: #f87171;
  border-color: #dc2626;
}
html.dark-mode .brief-message.info {
  background: #1e293b;
  color: #38bdf8;
  border-color: #0ea5e9;
}
.comments-list-container {
  margin-top: 2rem;
}
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.comment {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px var(--shadow-color);
  transition: box-shadow 0.2s ease;
}
.comment:hover {
  box-shadow: 0 4px 8px var(--shadow-color);
}
.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}
.comment-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
  line-height: 1.4;
}
.comment-label strong {
  color: var(--text-accent);
  font-weight: 600;
}
.author-tag {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  color: var(--text-muted);
  font-family: inherit;
}
.admin-comment .author-tag {
  color: var(--text-primary);
  font-weight: inherit;
}
.admin-comment {
  border: 2px solid var(--border-accent);
  border-radius: 4px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 154, 60, 0.1),
      transparent 1px);
}
.comment-delete-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.comment-delete-btn:hover {
  background: var(--bg-primary);
  color: var(--danger-color, #dc3545);
  transform: scale(1.1);
}
.comment-delete-btn:active {
  transform: scale(0.95);
}
.pending-indicator {
  color: var(--text-accent);
  font-style: italic;
  font-size: 0.8rem;
  font-weight: normal;
}
.pending-comment {
  border-color: var(--text-accent);
  background: var(--bg-secondary);
  opacity: 0.9;
}
.comment-content {
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.loading-message,
.no-comments,
.error-message {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-style: italic;
}
.error-message {
  background: var(--bg-secondary);
  border: 2px dashed var(--border-accent);
  border-radius: 8px;
  color: var(--text-accent, #dc3545);
}
.no-comments {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}
@media (max-width: 768px) {
  .comments-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .comments-controls {
    width: 100%;
    justify-content: flex-end;
  }
  .comment-form-container {
    padding: 0.75rem;
  }
  .comment {
    padding: 0.75rem;
  }
  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  .name-group {
    width: 100%;
  }
  .submit-btn {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 480px) {
  .comments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
  .comments-header h3 {
    font-size: 1.25rem;
  }
  .comments-header {
    margin-bottom: 1.5rem;
  }
  .comment-form-container {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }
  .comment-form .form-group {
    margin-bottom: 1.25rem;
  }
  .comment-form label {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
  }
  .comment-form input,
  .comment-form textarea {
    width: 100%;
    padding: 0.625rem;
    font-size: 16px;
  }
  .comment {
    padding: 0.75rem;
  }
  .captcha-group {
    padding: 0.75rem;
  }
  .captcha-question {
    width: 100%;
    padding: 0.625rem;
    font-size: 0.95rem;
  }
  .btn-submit {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    min-height: 44px;
  }
  .comments-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .comments-controls .btn {
    width: 100%;
    justify-content: center;
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }
}
.comment-form input:focus,
.comment-form textarea:focus,
.comments-controls .btn:focus,
.submit-btn:focus {
  outline: 2px solid var(--border-accent);
  outline-offset: 2px;
}
.submit-btn:disabled .submit-text::after {
  content: "...";
  animation: dots 1.5s infinite;
}
@keyframes dots {
  0%, 20% {
    content: "...";
  }
  40% {
    content: "..";
  }
  60% {
    content: ".";
  }
  80%, 100% {
    content: "";
  }
}
