/* ===========================
   スレッド詳細ページ専用 CSS
   GirlsChannel風（中央カード＋白背景・グレーヘッダ）
   =========================== */

/* ページ全体 */
body {
  background: #f3f4f6; /* 淡いグレーで全体背景 */
}

/* 読み込み中表示 */
.loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.loading-content {
  text-align: center;
  color: #6b7280;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

.loading-content p {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.thread-detail-container {
  max-width: 800px;
  margin: 0 auto;
  font-family: "Noto Sans JP", sans-serif;
  color: #374151;
  background: #fff;          /* カード本体は白 */
  border-radius: 8px;
  padding: 0 32px 40px;       /* 横に余白を追加 */
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ---------------------------
   ヘッダーバー（戻る・お気に入り等）
--------------------------- */
.thread-header-bar {
  max-width: 800px;
  margin: 0 auto 20px;
  padding: 16px 24px;
  background: #f9fafb;            /* 白より少し濃いグレー */
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
}

.back-btn {
  background-color: #6c757d;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.25s ease;
}
.back-btn:hover { background-color: #5a6268; }

.thread-actions { display: flex; gap: 10px; }

.favorite-btn {
  background-color: #ffc107;
  color: #212529;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.25s ease;
}
.favorite-btn:hover { background-color: #e0a800; }

.comment-nav-btn {
  background-color: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.comment-nav-btn:hover { background-color: #2563eb; transform: translateY(-1px); }

/* ---------------------------
   主コメント（OP）
--------------------------- */
.op-post {
  padding: 24px 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 14px;
  color: #6b7280;
}
.post-number { color: #9ca3af; }

.thread-category {
  background-color: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
}

.thread-title {
  font-size: 20px;
  font-weight: 600;
  margin: 2px 0 6px;
  line-height: 1.4;
}

.post-content {
  line-height: 1.8;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.post-actions { margin-top: 10px; }
.like-btn {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 6px 12px;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.like-btn:hover { background-color: #f8fafc; }
.like-btn i { margin-right: 6px; color: #ef4444; }

/* ---------------------------
   コメント一覧
--------------------------- */
.comments-section {
  margin: 0;
  padding: 0;
  background: #fff;
}


#commentsList .comment-item {
  border-top: 1px solid #e5e7eb;
  padding: 20px 0 20px 16px;  /* ← 左に余白を追加 */
  background: #fff;
}

.inline-ad-container {
  display: none;
  margin: 24px 0;
  text-align: center;
}

.inline-ad-container .adsbygoogle {
  display: block !important;
  width: 100% !important;
}

@media (max-width: 767px) {
  .inline-ad-container {
    display: block;
  }
}

.comment-header {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;  /* ← 左寄せにする */
  gap: 6px;                      /* ← 番号と名前の間の余白を最小化 */
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 6px;
  text-align: left !important;  /* ← 万一centerが残っていても強制上書き */
}

.comment-number {
  color: #9ca3af;
  flex-shrink: 0;                /* 幅を固定せず自動サイズ */
}
/*
.comment-author {
  font-weight: 600;
  color: #374151;
  margin: 0;                     /* 不要な左右余白を消す */
}*/

.comment-author{ display:inline-flex; align-items:center; gap:4px; font-weight:600; }
.badge-admin, .comment-author.badge-admin{
  padding:2px 8px; border-radius:9999px; background:#111; color:#fff; font-weight:700;
}
.anonymous-author{ color:#666; }
.named-author{ color:#222; }


.comment-content {
  margin: 2px 0 10px 0;
  line-height: 1.7;
  white-space: pre-wrap;
  padding-left: 0;             /* ← 本文はヘッダーと揃える */
}

.comment-actions { display: flex; gap: 10px; }

.comment-like-btn,
.comment-reply-btn {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #374151;
  border-radius: 16px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.comment-like-btn:hover,
.comment-reply-btn:hover { background: #f8fafc; }
.comment-like-btn i { color: #ef4444; margin-right: 6px; }
.comment-reply-btn i { margin-right: 6px; }

/* ---------------------------
   返信ページ（replies.html）
--------------------------- */

#repliesList .reply-item {
  border-top: 1px solid #e5e7eb;
  padding: 20px 0 20px 16px;   /* ← 左に余白を追加 */
  background: #fff;
}

.reply-item .comment-header {
  display: flex;
  align-items: center;
  gap: 10px;                    /* 番号と名前の間の余白 */
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 6px;
}

.reply-item .comment-number {
  color: #9ca3af;
  flex-shrink: 0;
}

.reply-item .comment-author {
  font-weight: 600;
  color: #374151;
  margin-left: 4px;
}

.reply-item .comment-content {
  margin: 2px 0 10px 0;
  line-height: 1.7;
  white-space: pre-wrap;
  padding-left: 0;               /* ヘッダーと揃える */
}

/* ---------------------------
   コメントフォーム
--------------------------- */
.comment-form-section {
  border-top: 1px solid #e5e7eb;
  padding: 28px 0 36px;
  background: #fff;
}

.comment-form textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: #fff;
}

.comment-author-selection {
  margin: 10px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.comment-custom-name {
  display: none;
}

.comment-form button {
  background-color: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease, transform 0.08s ease;
}
.comment-form button:hover { background-color: #2563eb; transform: translateY(-1px); }

/* ---------------------------
   画像・タグ
--------------------------- */
.image-gallery {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.gallery-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
}

.thread-hashtags-display { margin-bottom: 8px; }
.thread-hashtag {
  display: inline-block;
  background-color: #f3f4f6;
  color: #374151;
  font-size: 12px;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  border-radius: 12px;
}
/* ===========================
   通常コメント (.comment-item)
   コメント一覧にも左寄せスタイル適用
=========================== */

.comment-item .comment-header {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start !important;
  gap: 6px;                     /* 番号と名前の間の余白 */
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 6px;
  text-align: left !important; /* 万一centerが残っていても強制上書き */
}

.comment-item .comment-number {
  color: #9ca3af;
  flex-shrink: 0;
}

.comment-item .comment-author {
  font-weight: 600;
  color: #374151;
  margin: 0;
}

/* 親コメントの背景を白に */
#parentCommentBox {
  background: #ffffff !important;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px 20px; /* 横方向にも余白を少し広げる */
  margin-bottom: 20px;
}

/* 返信を投稿フォーム - 横幅に余裕を持たせる */
#replyFormSection {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 28px; /* ← 左右paddingを増加 */
  margin-top: 24px;
}

/* 返信コメント内のハートボタンに右余白 */
.reply-item .comment-actions .comment-like-btn,
.comment-item .comment-actions .comment-like-btn {
  margin-right: 16px; /* 右端との距離を確保 */
}

/* コメント全体の左右padding（見た目の窮屈さを軽減） */
.comment-item,
.reply-item {
  padding: 12px 20px; /* ← 横方向に余裕を追加 */
}


/* ---------------------------
   無限返信機能のスタイル
--------------------------- */

/* 返信の階層インデント */
.comment-item {
  margin-bottom: 8px;
}

/* 返信数表示 */
.replies-count {
  font-size: 13px;
  color: #6b7280;
  margin: 8px 0;
  font-weight: 500;
}

/* 返信フォーム */
.reply-form {
  margin-top: 12px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid #3b82f6;
}

.reply-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.reply-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 返信の投稿者選択 */
.reply-author-selection {
  margin: 8px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reply-author-selection label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.reply-custom-name {
  display: none;
  margin-left: 8px;
}

.reply-custom-author {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  width: 120px;
  font-size: 13px;
}

.reply-custom-author:focus {
  outline: none;
  border-color: #3b82f6;
}

/* 返信フォームのボタン */
.reply-form-buttons {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.reply-form-buttons button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.reply-form-buttons button:first-child {
  background-color: #3b82f6;
  color: white;
}

.reply-form-buttons button:first-child:hover {
  background-color: #2563eb;
}

.reply-form-buttons button:last-child {
  background-color: #6c757d;
  color: white;
}

.reply-form-buttons button:last-child:hover {
  background-color: #5a6268;
}

/* 深い階層の返信の背景色を調整 */
.comment-item[style*="margin-left: 40px"] {
  background-color: rgba(59, 130, 246, 0.02);
}

.comment-item[style*="margin-left: 60px"] {
  background-color: rgba(59, 130, 246, 0.04);
}

.comment-item[style*="margin-left: 80px"] {
  background-color: rgba(59, 130, 246, 0.06);
}

/* 階層が深くなるにつれて左のボーダーを追加 */
.comment-item[style*="margin-left: 20px"] {
  border-left: 2px solid #e5e7eb;
  padding-left: 12px;
}

.comment-item[style*="margin-left: 40px"] {
  border-left: 2px solid #d1d5db;
}

.comment-item[style*="margin-left: 60px"] {
  border-left: 2px solid #9ca3af;
}

/* 返信ボタンのスタイル調整 */
.comment-reply-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.comment-reply-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.comment-reply-btn i {
  color: #3b82f6;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  /* モバイルでは階層インデントを少し狭く */
  .comment-item[style*="margin-left"] {
    margin-left: 10px !important;
  }
  
  .replies-container[style*="margin-left"] {
    margin-left: 15px !important;
  }
  
  .reply-form {
    padding: 12px;
  }
  
  .reply-author-selection {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .reply-custom-name {
    margin-left: 0;
    margin-top: 4px;
  }
}

/* 成功/エラーのトースト（既存JS用） */
.success-message, .error-message {
  font-size: 14px;
}

