/* Commentario Styles - Theme-aware via CSS custom properties */

.commentario-wrapper {
  font-family: inherit;
  max-width: 100%;
  margin: 0;
  padding: 0;
  color: var(--text-primary);
}

/* Notifications */
.commentario-notification {
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 4px;
  transition: opacity 0.3s;
}

.commentario-notification-success {
  background: var(--bg-secondary);
  color: var(--accent-secondary);
  border-left: 4px solid var(--accent-secondary);
}

.commentario-notification-error {
  background: var(--bg-secondary);
  color: var(--accent-video);
  border-left: 4px solid var(--accent-video);
}

/* Comment Form */
.commentario-form {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  border-left: 3px solid var(--accent-tertiary);
}

.commentario-form h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 20px;
  color: var(--text-primary);
}

.commentario-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.commentario-form input[type="text"],
.commentario-form input[type="email"],
.commentario-form input[type="url"],
.commentario-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.commentario-form textarea {
  resize: vertical;
  margin-bottom: 10px;
}

.commentario-form input:focus,
.commentario-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}

/* Login section */
.commentario-login-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border-radius: 6px;
  border: 1px solid var(--bg-tertiary);
}

.commentario-login-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.commentario-login-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.commentario-btn-oauth {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.commentario-btn-oauth:hover { opacity: 0.85; }

.commentario-btn-google { background: #4285f4; color: white; }
.commentario-btn-github { background: #333; color: white; }

/* Logged-in user header */
.commentario-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  border: 1px solid var(--bg-tertiary);
}

.commentario-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
}

.commentario-user-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.commentario-user-name strong { color: var(--text-primary); }

.commentario-btn-logout {
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--bg-tertiary);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.commentario-btn-logout:hover { border-color: var(--accent); color: var(--accent); }

/* Honeypot - hide from users */
.commentario-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}

.commentario-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.commentario-btn-submit,
.commentario-btn-cancel {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.commentario-btn-submit {
  background: var(--accent);
  color: var(--bg-primary);
  border: 2px solid var(--accent);
}

.commentario-btn-submit:hover:not(:disabled) {
  opacity: 0.85;
}

.commentario-btn-submit:disabled {
  background: var(--bg-tertiary);
  border-color: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.commentario-btn-cancel {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--bg-tertiary);
}

.commentario-btn-cancel:hover {
  background: var(--bg-primary);
  border-color: var(--accent);
}

.commentario-form-notice {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Reply Form */
.commentario-reply-form {
  margin-top: 15px;
  margin-bottom: 15px;
  background: var(--bg-primary);
  border-left-color: var(--accent);
}

/* Comments Section */
.commentario-comments {
  margin-top: 30px;
}

.commentario-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 3px solid var(--accent-tertiary);
}

.commentario-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

/* Sort Controls */
.commentario-sort-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 10px 15px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border-left: 3px solid var(--accent-tertiary);
}

.commentario-sort-controls label {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.commentario-sort-select {
  padding: 6px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.commentario-sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Individual Comment */
.commentario-comment {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-tertiary);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.commentario-comment:hover {
  border-left-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Hearted Comment Styling */
.commentario-comment.commentario-hearted {
  border-left: 4px solid var(--accent-video);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.commentario-heart-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-video);
  color: var(--bg-primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
}

.commentario-comment-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.commentario-avatar {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  border: 2px solid var(--bg-tertiary);
  flex-shrink: 0;
}

.commentario-comment-header {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.commentario-author-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.commentario-author {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 600;
}

.commentario-author a {
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.commentario-author a:hover {
  opacity: 0.8;
  border-bottom-color: var(--text-link);
}

.commentario-date {
  font-size: 13px;
  color: var(--text-secondary);
}

.commentario-comment-content {
  margin: 12px 0;
  line-height: 1.6;
  color: var(--text-primary);
}

.commentario-comment-content p {
  margin: 0 0 10px 0;
}

.commentario-comment-content p:last-child {
  margin-bottom: 0;
}

.commentario-comment-content a {
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.commentario-comment-content a:hover {
  opacity: 0.8;
  border-bottom-color: var(--text-link);
}

.commentario-comment-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 10px 0;
  border: 2px solid var(--bg-tertiary);
}

.commentario-comment-content code {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 0.1em 0.2em;
  border-radius: 3px;
  font-family: monospace;
  font-size: 13px;
}

.commentario-comment-content pre {
  background: var(--bg-primary);
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.4;
}

.commentario-comment-content pre code {
  padding: 0;
  background: none;
  color: var(--text-primary);
}

.commentario-comment-content blockquote {
  margin: 10px 0;
  padding-left: 15px;
  border-left: 3px solid var(--accent-tertiary);
  color: var(--text-secondary);
}

.commentario-comment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
}

.commentario-vote-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.commentario-btn-vote {
  padding: 4px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}

.commentario-btn-vote:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

.commentario-btn-upvote.active {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  color: var(--bg-primary);
}

.commentario-btn-downvote.active {
  background: var(--accent-video);
  border-color: var(--accent-video);
  color: var(--bg-primary);
}

.commentario-score {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0 8px;
}

.commentario-action-buttons {
  display: flex;
  gap: 10px;
}

.commentario-btn-reply,
.commentario-btn-toggle {
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.commentario-btn-reply:hover,
.commentario-btn-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
  color: var(--accent);
}

/* Replies */
.commentario-replies {
  margin-top: 15px;
}

.commentario-replies.commentario-collapsed {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .commentario-wrapper {
    padding: 0;
  }

  .commentario-form-row {
    grid-template-columns: 1fr;
  }

  .commentario-comment {
    padding: 12px;
  }

  .commentario-comment[style*="margin-left"] {
    margin-left: 15px !important;
  }

  .commentario-comment-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .commentario-vote-buttons {
    justify-content: center;
  }

  .commentario-action-buttons {
    justify-content: center;
  }

  .commentario-avatar {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .commentario-form {
    padding: 15px;
  }

  .commentario-btn-submit,
  .commentario-btn-cancel {
    width: 100%;
  }

  .commentario-form-actions {
    flex-direction: column;
  }
}
