/* ============================================
   BLOG POST PAGE STYLES
   Purpose: Individual blog post view with comments
   Mobile-first approach
   ============================================ */

/* ============================================
   BLOG POST CONTAINER
   ============================================ */

.blog-post-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

@media (min-width: 768px) {
  .blog-post-container {
    padding: 40px 20px;
  }
}

/* ============================================
   POST HEADER
   ============================================ */

.post-header {
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
  margin-top: 1em;
}

.post-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 16px;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .post-title {
    font-size: 36px;
  }
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .post-meta {
    font-size: 16px;
  }
}

.post-author {
  font-weight: 600;
  color: var(--text-medium);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.post-tag {
  display: inline-block;
  padding: 4px 12px;
  background-color: var(--bg-light);
  color: var(--text-medium);
  border-radius: var(--radius-small);
  font-size: 12px;
  font-weight: 500;
}

@media (min-width: 768px) {
  .post-tag {
    font-size: 14px;
    padding: 6px 14px;
  }
}

/* ============================================
   POST CONTENT
   ============================================ */

.post-content-section {
  margin-bottom: 48px;
}

.post-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-dark);
}

@media (min-width: 768px) {
  .post-content {
    font-size: 18px;
    line-height: 1.9;
  }
}

.post-content h2 {
  font-size: 24px;
  margin: 32px 0 16px;
  color: var(--text-dark);
}

.post-content h3 {
  font-size: 20px;
  margin: 24px 0 12px;
  color: var(--text-dark);
}

.post-content p {
  margin-bottom: 20px;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-medium);
  margin: 24px 0;
}

.post-content ul,
.post-content ol {
  margin: 20px 0;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content blockquote {
  border-left: 4px solid var(--primary-blue);
  padding-left: 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-medium);
}

/* ============================================
   POST REACTIONS
   ============================================ */

.post-reactions {
  margin-bottom: 48px;
  padding: 24px;
  background-color: var(--bg-light);
  border-radius: var(--radius-medium);
}

@media (min-width: 768px) {
  .post-reactions {
    padding: 32px;
  }
}

.post-reactions h3 {
  font-size: 20px;
  margin: 0 0 20px;
  color: var(--text-dark);
}

@media (min-width: 768px) {
  .post-reactions h3 {
    font-size: 22px;
  }
}

.reactions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 768px) {
  .reactions-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
  }
}

.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background-color: var(--bg-white);
  border: 2px solid var(--bg-light);
  border-radius: var(--radius-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

@media (min-width: 768px) {
  .reaction-btn {
    padding: 20px 16px;
  }
}

.reaction-btn:hover {
  border-color: var(--primary-blue);
  transform: translateY(-2px);
}

.reaction-btn.active {
  border-color: var(--primary-blue);
  background-color: rgba(91, 141, 219, 0.1);
}

.reaction-btn.pulse {
  animation: pulse 0.3s ease;
}

.reaction-icon {
  font-size: 28px;
}

@media (min-width: 768px) {
  .reaction-icon {
    font-size: 32px;
  }
}

.reaction-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-medium);
}

@media (min-width: 768px) {
  .reaction-label {
    font-size: 14px;
  }
}

.reaction-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-blue);
}

@media (min-width: 768px) {
  .reaction-count {
    font-size: 16px;
  }
}

.reactions-login-prompt {
  text-align: center;
  padding: 20px;
}

.reactions-login-prompt a {
  color: var(--primary-blue);
  text-decoration: underline;
}

/* ============================================
   COMMENTS SECTION
   ============================================ */

.post-comments {
  margin-bottom: 48px;
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.comments-header h3 {
  font-size: 22px;
  margin: 0;
  color: var(--text-dark);
}

@media (min-width: 768px) {
  .comments-header h3 {
    font-size: 24px;
  }
}

.comments-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.sort-select {
  padding: 6px 12px;
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-small);
  background-color: var(--bg-white);
  font-size: 14px;
  cursor: pointer;
}

/* ============================================
   COMMENT FORM (Top-Level)
   ============================================ */

.comment-form {
  margin-bottom: 32px;
  padding: 20px;
  background-color: var(--bg-light);
  border-radius: var(--radius-medium);
}

@media (min-width: 768px) {
  .comment-form {
    padding: 24px;
  }
}

.comment-form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-circle);
  background-color: var(--primary-blue);
  color: var(--text-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

@media (min-width: 768px) {
  .comment-avatar {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

.comment-username {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 14px;
}

@media (min-width: 768px) {
  .comment-username {
    font-size: 16px;
  }
}

.comment-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-small);
  font-family: var(--font-family);
  font-size: 15px;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

@media (min-width: 768px) {
  .comment-textarea {
    font-size: 16px;
    padding: 14px;
  }
}

.comment-textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.comment-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.char-count {
  font-size: 12px;
  color: var(--text-light);
}

@media (min-width: 768px) {
  .char-count {
    font-size: 14px;
  }
}

.char-count.warning {
  color: var(--warning-yellow);
}

.char-count.danger {
  color: var(--error-red);
}

.comments-login-prompt {
  text-align: center;
  padding: 32px;
  background-color: var(--bg-light);
  border-radius: var(--radius-medium);
}

.comments-login-prompt a {
  color: var(--primary-blue);
  text-decoration: underline;
}

.comments-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}

/* ============================================
   COMMENT THREAD (Nested Structure)
   ============================================ */

.comments-list {
  margin-top: 24px;
}

.comment-thread {
  margin-bottom: 16px;
}

.comment-thread[data-level="0"] {
  margin-bottom: 24px;
}

/* Indentation for nested replies */
.comment-thread[data-level="1"] {
  margin-left: 24px;
}

.comment-thread[data-level="2"] {
  margin-left: 24px;
}

.comment-thread[data-level="3"] {
  margin-left: 24px;
}

.comment-thread[data-level="4"] {
  margin-left: 24px;
}

.comment-thread[data-level="5"] {
  margin-left: 24px;
}

.comment-thread[data-level="6"] {
  margin-left: 24px;
}

.comment-thread[data-level="7"] {
  margin-left: 24px;
}

@media (min-width: 768px) {
  .comment-thread[data-level="1"] {
    margin-left: 40px;
  }

  .comment-thread[data-level="2"] {
    margin-left: 40px;
  }

  .comment-thread[data-level="3"] {
    margin-left: 40px;
  }

  .comment-thread[data-level="4"] {
    margin-left: 40px;
  }

  .comment-thread[data-level="5"] {
    margin-left: 40px;
  }

  .comment-thread[data-level="6"] {
    margin-left: 40px;
  }

  .comment-thread[data-level="7"] {
    margin-left: 40px;
  }
}

/* ============================================
   COMMENT ITEM
   ============================================ */

.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background-color: var(--bg-white);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-medium);
}

@media (min-width: 768px) {
  .comment-item {
    padding: 16px;
    gap: 16px;
  }
}

/* ============================================
   COMMENT VOTING (Left Side)
   ============================================ */

.comment-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 32px;
}

@media (min-width: 768px) {
  .comment-vote {
    min-width: 40px;
  }
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-light);
  padding: 4px;
  transition: all var(--transition-fast);
  line-height: 1;
}

@media (min-width: 768px) {
  .vote-btn {
    font-size: 20px;
  }
}

.vote-btn:hover {
  color: var(--primary-blue);
}

.vote-btn.vote-up.active {
  color: var(--primary-blue);
  font-weight: bold;
}

.vote-btn.vote-down.active {
  color: var(--error-red);
  font-weight: bold;
}

.vote-score {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
}

@media (min-width: 768px) {
  .vote-score {
    font-size: 14px;
  }
}

.vote-score-readonly {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}

@media (min-width: 768px) {
  .vote-score-readonly {
    font-size: 14px;
  }
}

/* ============================================
   COMMENT CONTENT (Right Side)
   ============================================ */

.comment-content-wrapper {
  flex: 1;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.comment-date {
  font-size: 12px;
  color: var(--text-light);
}

@media (min-width: 768px) {
  .comment-date {
    font-size: 14px;
  }
}

.comment-edited {
  font-size: 11px;
  color: var(--text-light);
  font-style: italic;
}

@media (min-width: 768px) {
  .comment-edited {
    font-size: 12px;
  }
}

.comment-body {
  margin-bottom: 8px;
}

.comment-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dark);
  margin: 0;
  word-wrap: break-word;
}

@media (min-width: 768px) {
  .comment-text {
    font-size: 16px;
    line-height: 1.7;
  }
}

/* ============================================
   COMMENT ACTIONS
   ============================================ */

.comment-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.comment-action-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

@media (min-width: 768px) {
  .comment-action-btn {
    font-size: 13px;
  }
}

.comment-action-btn:hover {
  color: var(--primary-blue);
}

.comment-action-btn.delete-btn:hover {
  color: var(--error-red);
}

.collapse-icon {
  font-weight: bold;
}

/* ============================================
   REPLY FORM (Inline)
   ============================================ */

.comment-reply-form {
  margin-top: 12px;
  padding: 12px;
  background-color: var(--bg-light);
  border-radius: var(--radius-small);
}

@media (min-width: 768px) {
  .comment-reply-form {
    padding: 16px;
  }
}

.reply-form-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.reply-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-small);
  font-family: var(--font-family);
  font-size: 14px;
  resize: vertical;
}

@media (min-width: 768px) {
  .reply-textarea {
    font-size: 15px;
    padding: 12px;
  }
}

.reply-textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.reply-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
  flex-wrap: wrap;
}

.reply-char-count {
  font-size: 11px;
  color: var(--text-light);
}

@media (min-width: 768px) {
  .reply-char-count {
    font-size: 12px;
  }
}

.reply-char-count.warning {
  color: var(--warning-yellow);
}

.reply-char-count.danger {
  color: var(--error-red);
}

/* ============================================
   EDIT FORM (Inline)
   ============================================ */

.comment-edit-form {
  margin-top: 8px;
}

.comment-edit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-small);
  font-family: var(--font-family);
  font-size: 14px;
  resize: vertical;
}

@media (min-width: 768px) {
  .comment-edit-textarea {
    font-size: 15px;
    padding: 12px;
  }
}

.comment-edit-textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.comment-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ============================================
   COLLAPSED COMMENTS
   ============================================ */

.comment-thread.collapsed > .comment-replies {
  display: none;
}

.comment-thread.collapsed .collapse-icon::before {
  content: '+';
}

/* ============================================
   HIDDEN STATE
   ============================================ */

.hidden {
  display: none !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.animate-in {
  animation: fadeIn 0.5s ease forwards;
}


/* ============================================
   NEW COMMENT HIGHLIGHT
   ============================================ */

.comment-new {
  animation: highlightNew 5s ease;
}

@keyframes highlightNew {
  0% {
    background-color: rgba(91, 141, 219, 0.2);
  }
  100% {
    background-color: transparent;
  }
}