/* 首頁樣式 */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

main {
  width: 100%;
  padding: 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #5e81ac;
  text-decoration: none;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-link {
  color: #5e81ac;
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover {
  text-decoration: underline;
}

.user-info {
  font-size: 0.9rem;
  color: #4c566a;
}

.user-name {
  font-weight: 500;
  color: #5e81ac;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.status-verified {
  background: #a3be8c;
  color: #2e3440;
}

.status-unverified {
  background: #ebcb8b;
  color: #2e3440;
}

.group-btn {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  margin-left: 0.5rem;
  background: #5e81ac;
  color: #eceff4;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.group-btn:hover {
  background: #81a1c1;
}

/* 卡片模式 */
.article-list {
  margin-top: 1rem;
  width: 100%;
}

.article-list.card-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.article-list.card-view .article-item {
  position: relative;
  padding: 1.25rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 卡片模式：標籤區域在上方左對齊 */
.article-list.card-view .article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-self: flex-start;
  pointer-events: none;
}

/* 卡片模式：標題區域在下方右對齊 */
.article-list.card-view .article-title {
  text-align: right;
  align-self: flex-end;
  margin-bottom: 0;
}

.article-list.card-view .article-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

/* 封面圖樣式 */
.article-list.card-view .article-item.has-cover {
  min-height: 180px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.article-list.card-view .article-item.has-cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0) 100%);
  z-index: 1;
}

.article-list.card-view .article-item.has-cover .article-meta,
.article-list.card-view .article-item.has-cover .article-title {
  position: relative;
  z-index: 2;
}

/* 有封面圖的卡片：標題白色 */
.article-card-link.has-cover .article-title {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.article-card-link.has-cover:hover .article-title {
  color: #eceff4;
}

/* 列表模式：不顯示封面圖背景 */
.article-list.list-view .article-item.has-cover {
  background-image: none !important;
}

/* 列表模式 */
.article-list.list-view {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

.article-list.list-view .article-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e9f0;
  transition: background-color 0.15s;
}

.article-list.list-view .article-item:last-child {
  border-bottom: none;
}

.article-list.list-view .article-item:hover {
  background: #f8f9fb;
}

.article-list.list-view .article-content {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.article-list.list-view .article-title {
  margin: 0;
}

.article-list.list-view .article-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
  flex: 1;
  pointer-events: none;
}

/* 兩欄式列表模式 */
.article-list.two-column-view {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 1rem 1.25rem;
  column-count: 2;
  column-gap: 2rem;
}

.article-list.two-column-view .article-item {
  break-inside: avoid;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e5e9f0;
  transition: background-color 0.15s;
}

.article-list.two-column-view .article-item:hover {
  background: #f8f9fb;
}

.article-list.two-column-view .article-item.has-cover {
  background-image: none !important;
}

.article-list.two-column-view .article-content {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.article-list.two-column-view .article-title {
  margin: 0;
}

.article-list.two-column-view .article-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

/* 響應式：小螢幕時改為單欄 */
@media (max-width: 768px) {
  .article-list.two-column-view {
    column-count: 1;
  }
}

.article-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: #2e3440;
  margin-bottom: 0.5rem;
}

.article-title a {
  color: inherit;
  text-decoration: none;
}

/* 讓整個 article-item 可點擊 */
.article-item {
  position: relative;
  cursor: pointer;
}

/* 卡片模式：整個卡片是 <a> 連結 */
.article-card-link {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.article-card-link .article-title {
  color: #2e3440;
}

.article-card-link:hover .article-title {
  color: #5e81ac;
}

/* 列表/兩欄模式：stretched-link 讓連結覆蓋整個容器 */
.stretched-link::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
}

.article-title a:hover {
  color: #5e81ac;
}

.article-meta {
  font-size: 0.8rem;
  color: #4c566a;
}

.article-meta span {
  margin-right: 1rem;
}

.access-level {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
}

.access-public { background: #a3be8c; color: #2e3440; }
.access-group { background: #81a1c1; color: #eceff4; }
.access-admin { background: #bf616a; color: #eceff4; }

/* 文章標籤樣式 */
.article-tag {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #4c566a;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #4c566a;
}

.error-message {
  background: #bf616a;
  color: #eceff4;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.site-footer {
  padding: 1.5rem 0;
  text-align: center;
  color: #4c566a;
  font-size: 0.85rem;
}

.site-footer a {
  color: #5e81ac;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.article-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.article-actions {
  display: flex;
  gap: 0.5rem;
}

.edit-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: #5e81ac;
  color: #eceff4;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.edit-btn:hover {
  background: #81a1c1;
}

/* 批次操作區塊 */
.batch-actions {
  display: none;
  margin-bottom: 1rem;
  padding: 1rem;
  background: #e5e9f0;
  border-radius: 8px;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.batch-actions.show {
  display: flex;
}

.batch-actions .selected-count {
  font-size: 0.9rem;
  color: #4c566a;
  font-weight: 500;
}

.batch-actions sl-button {
  --sl-input-height-small: 32px;
}

/* 文章列表 checkbox */
.article-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.article-content {
  flex: 1;
}

.select-all-row {
  display: none;
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  background: #f8f9fa;
  border-radius: 4px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #4c566a;
}

.select-all-row.show {
  display: flex;
}

/* 首頁區塊樣式 */
.homepage-section {
  margin-bottom: 2rem;
  width: 100%;
}

.section-header {
  margin-bottom: 1rem;
}

.section-header h3 {
  font-size: 1.1rem;
  color: #2e3440;
  margin: 0;
}

.section-header .section-desc {
  font-size: 0.85rem;
  color: #4c566a;
  margin-top: 0.25rem;
}

.error-page {
  text-align: center;
  padding: 3rem;
}

.error-page h2 {
  color: #bf616a;
  margin-bottom: 1rem;
}

.error-page p {
  color: #4c566a;
  margin-bottom: 1.5rem;
}

.error-page a {
  color: #5e81ac;
}
