/* === 卡片樣式 === */
.thread-card, .filter-card, .comment-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.2s ease;
}

.thread-card {
  max-width: 600px;
  padding: 1.5rem;
  margin: 1rem auto;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.select-index {
    display: none;
    position: absolute;
    top: 5px;
    left: 5px;
    width: 24px;
    height: 24px;
    background: #0aa1ff;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    line-height: 22px;
    z-index: 2;
}
.thread-card.selected .select-index {
    display: block;
}

.thread-card:hover {
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
}

.thread-card.selected {
    border: 2px solid #0aa1ff;
}

/* === 標頭與作者 === */
.thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.thread-author-group {
  display: flex;
  align-items: center;
  min-width: 0;
}

.thread-avatar {
  width: 40px;
  height: 40px;
  background: #2b6cb0;
  border-radius: 50%;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.thread-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.thread-author {
  color: #000;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.thread-content.no-click a {
    pointer-events: none;
    cursor: default;
}

.thread-content.no-click a:hover {
    text-decoration: none;
}


.thread-category {
  color: #69c;
  font-size: 1rem;
  white-space: nowrap;
}

.portfolio-content {
  display: flex;
  justify-content:space-between;
  width: 100%;
  position: relative;
}

.portfolio-more {
    padding: 0.5rem;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  align-items: center;
}

/* === 卡片區塊結構 === */
.thread-meta, .thread-header, .thread-footer {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  font-size: 1rem;
}
.thread-footer {
  justify-content: space-between;
  margin-left: 48px;
}
.thread-time {
  white-space: nowrap;
  color: #999;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* === 貼文內文與標籤 === */
.thread-content {
  max-width: 100%;
  font-size: 1rem;
  color: #222;
  line-height: 1.6;
  word-wrap: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  margin-left: 48px;
}
.thread-intro {
  font-size: 1rem;    
}

.thread-tags {
  margin-left: 48px;
  color: #999;
  font-size: 0.9rem;
}

/* === 行動功能列 === */
.thread-actions span {
  margin-left: 0;
  cursor: pointer;
  white-space: nowrap;
  color: #aaa;
}

/* === 遮罩與彈窗 === */
.nsfw-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  color: #333;
  font-weight: bold;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  z-index: 10;
  pointer-events: none;
}
.comment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.comment-box textarea {
  width: 400px;
  height: 200px;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  resize: vertical;
}
.comment-box button {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background-color: #2b6cb0;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.comment-box button:hover {
  background-color: #1a4c8b;
}

/* === 附加樣式 === */
.read-more {
  display: block;
  margin-left: 48px;
  font-size: 1rem;
}

#load-more-spinner {
  text-align: center;
  font-size: 1rem;
  color: #888;
  margin: 1rem 0;
  display: none;
}
#load-trigger {
  height: 10px;
}

.thread-more {
  cursor: pointer;
  user-select: none;
  padding-left: 10px;
}
.bubble-menu {
  position: absolute;
  bottom: 30px;
  right: 20px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 0.5rem 0;
  z-index: 10000;
  display: none;
}
.bubble-menu div {
  padding: 0.5rem 1rem;
  cursor: pointer;
  white-space: nowrap;
}
.bubble-menu div:hover {
  background: #f0f0f0;
}

.select-arrow {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url('/wp-content/themes/blocksy-child/icons/arrow-down.png');
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
  margin-left: 6px;
}

.thread-avatar {
  width: 40px;
  height: 40px;
  background-color: #eee;
  background-size: cover;
  background-position: center;
  border-radius: 50%;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.thread-actions img {
  width: 20px;
  height: 20px;
  cursor: pointer;
  filter: brightness(0) saturate(0) invert(60%) sepia(0%) saturate(0%) hue-rotate(180deg) brightness(95%) contrast(90%);
  transition: filter 0.2s ease;
  vertical-align: middle;
}

.comment-count {
  font-size: 0.75rem;
  margin-left: 2px !important;
  color: #888;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  position: relative;
  transition: background 0.2s ease;
}
.icon-btn:hover {
  background: #eee;
}

.icon-btn img {
  width: 20px;
  height: 20px;
  transition: filter 0.2s ease;
}

/* 按下喜歡 → 粉紅 */
.like-btn.liked img {
  filter: brightness(0) saturate(100%) invert(42%) sepia(64%) saturate(570%) hue-rotate(-20deg) brightness(105%) contrast(102%);
}

.like-count {
  margin-left: 4px;
  font-size: 0.75rem;
  color: #555;
}

.like-btn.liked .like-count {
  color: #DD6D26; /* 按讚後顏色 */
}

/* 按下收藏 → 藍色 */
.icon-btn.icon-saved img {
  filter: brightness(0) saturate(100%) invert(63%) sepia(35%) saturate(593%) hue-rotate(160deg) brightness(93%) contrast(90%) !important;
}

/* tooltip 提示 */
.icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 5px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
  z-index: 10;
}
.icon-btn:hover::after {
  opacity: 1;
}

/* 複製一秒變紅 */
.copy-btn.flash img {
  filter: brightness(0) saturate(100%) invert(45%) sepia(97%) saturate(622%) hue-rotate(-8deg) brightness(104%) contrast(102%);
}

.comment-btn .icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  border-radius: 50%;
  transition: background-color 0.2s;
  position: relative;
}

.comment-btn:hover .icon-wrap {
  background-color: #eee;
}

/* 留言字數限制 */
.char-counter {
  display: block;
  text-align: right;
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.3rem;
  margin-bottom: 0.5rem;
}

#submit-comment {
  background-color: #98C1D9;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}

/* 檢舉樣式 */

.portfolio-more-menu {
  position: absolute;
  right: 1rem;
  bottom: 2rem;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.thread-more-menu {
  position: absolute;
  right: 1rem;
  top: 2rem;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 99;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.portfolio-more-menu button,
.thread-more-menu button {
  background: none;
  border: none;
  text-align: left;
  padding: 10px 16px;
  width: 100%;
  cursor: pointer;
}

.portfolio-more-menu button:hover, 
.thread-more-menu button:hover {
  background: #f0f0f0;
}

.portfolio-more-menu.hidden,
.thread-more-menu.hidden {
  display: none;
}

/* 圖片樣式類別 */
article.thread-card .thread-content img {
  max-width: 100%;
  max-height: 400px;
  display: block;
  margin: 1rem 0;
}

/* === 手機樣式 === */
@media (max-width: 768px) {
  .thread-card {
    max-width: calc(100% - 1.5rem); /* 留白 */
    margin: 1rem auto;              /* 上下間距 + 置中 */
    border-radius: 16px;            /* 保留圓角 */
  }
  
  .thread-content, .read-more, .thread-tags {
    margin-left: 0 !important;
  }
}

/* ---------------------------------- */
    /* 角色暱稱顏色定義 (針對 a.thread-author) */
    /* ---------------------------------- */

/* 網站管理員 (我) - 金色 */
    .thread-author.role-administrator {
        color: #F2A76E !important; 
    }
/* 訂閱者 (贊助商) - 藍色 */
    .thread-author.role-subscriber {
        color: #6A7EC5 !important; 
    }
/* 作者 (一般註冊) - 黑色/預設 */
    .thread-author.role-author {
        color: #333333 !important; 
    }
