/* Resources: Library, News, TB Clip */
.resources-intro {
  margin-bottom: 24px;
  max-width: none;
}

.resources-intro p {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

/* 영문 모드: 긴 문장은 가로 스크롤 대신 줄바꿈 */
body.lang-en .resources-intro p {
  white-space: normal;
  overflow-x: visible;
  overflow-y: visible;
}

.resources-intro .en { margin-bottom: 6px; }
.resources-intro .ko { font-size: 0.95em; color: var(--color-text-muted); }

/* Tabs / filters */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tabs .tab-btn {
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.tabs .tab-btn:hover,
.tabs .tab-btn.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(183, 28, 28, 0.25);
}

.tabs .tab-btn:hover i,
.tabs .tab-btn:hover .icon-wrap,
.tabs .tab-btn:hover span,
.tabs .tab-btn.active i,
.tabs .tab-btn.active .icon-wrap,
.tabs .tab-btn.active span {
  color: #fff !important;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 24px;
}

.filter-bar input[type="search"],
.filter-bar select {
  padding: 6px 10px;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  height: 40px;
}

.filter-bar input[type="search"] {
  min-width: 200px;
}

.filter-bar .btn {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 16px;
  padding-right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* flex 항목(아이콘·라벨)의 광학적 중심을 맞춤 (한글 기준선이 낮게 잡히는 보정) */
  line-height: 1;
  font-size: 0.95rem;
}

/* Font Awesome 글리프를 정사각 영역 중앙에 고정 (before 기준선 흔들림 감소) */
.filter-bar .btn > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.125em;
  height: 1.125em;
  flex-shrink: 0;
  font-size: 1em;
  line-height: 1;
}

.filter-bar .btn > .en,
.filter-bar .btn > .ko {
  display: inline-block;
  line-height: 1;
  /* 아이콘 대비 라벨이 아래로 치우치는 현상 보정 */
  transform: translateY(-0.09em);
  margin: 0;
  padding: 0;
}

/* List — 카드형으로 아래에서 재정의 */

/* ── 뉴스 카드 (썸네일 있을 때 가로 레이아웃) ── */
.news-card-list .news-item.has-thumb {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.news-thumb-wrap {
  flex-shrink: 0;
  width: 160px;
}

.news-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.news-body {
  flex: 1;
  min-width: 0;
}

@media (max-width: 600px) {
  .news-card-list .news-item.has-thumb { flex-direction: column; }
  .news-thumb-wrap { width: 100%; }
  .news-thumb      { height: 180px; }
}

/* ── 페이지 타이틀 + 버튼 행 ── */
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.page-title-row .page-title { margin-bottom: 0; }

.page-title-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.unsub-intro {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text);
}

.unsub-optional {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.9em;
}

.unsub-reason-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  color: var(--color-text);
  min-height: 44px;
  cursor: pointer;
}

.unsub-reason-hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.unsub-reason-note-wrap {
  margin-top: 0;
}

.unsub-textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 10px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}

.unsub-done .unsub-success-text {
  margin: 0.75rem 0 0;
  line-height: 1.65;
  text-align: center;
}

/* ── TB Clip 갤러리 ── */
.tbclip-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.tbclip-card {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(139,0,0,0.04);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.15s;
}
.tbclip-card:hover {
  box-shadow: 0 4px 20px rgba(139,0,0,0.1);
  transform: translateY(-3px);
}

.tbclip-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.tbclip-thumb {
  position: relative;
  width: 100%;
  height: 160px;
  background: var(--color-bg-alt);
  overflow: hidden;
}
.tbclip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.tbclip-card:hover .tbclip-thumb img { transform: scale(1.04); }

.tbclip-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--color-primary);
  opacity: 0.25;
}

.tbclip-video-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(183,28,28,0.85);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.tbclip-body {
  padding: 14px 16px;
  flex: 1;
}
.tbclip-volume {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin: 0 0 6px;
  font-weight: 500;
}
.tbclip-title {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
  line-height: 1.45;
}
.tbclip-desc {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
}

.tbclip-card-footer {
  border-top: 1px solid var(--color-border-light);
  padding: 10px 16px;
}
.tbclip-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.15s;
}
.tbclip-dl-btn:hover { color: var(--color-primary-dark); text-decoration: underline; }

/* ── TB Clip 상세 ── */
.tbclip-detail-thumb {
  margin: 0 0 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 400px;
}
.tbclip-detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tbclip-video-wrap {
  position: relative;
  padding-top: 56.25%; /* 16:9 */
  margin-bottom: 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
}
.tbclip-video-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

.tbclip-content {
  line-height: 1.85;
  margin-bottom: 28px;
}
.tbclip-content .ko { margin-bottom: 16px; }
.tbclip-content .en { font-size: 0.95em; color: var(--color-text-muted); }

.tbclip-content .tbclip-rich img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 12px 0;
}
.tbclip-content .tbclip-rich ul,
.tbclip-content .tbclip-rich ol {
  padding-left: 1.35em;
  margin: 0.75em 0;
}
.tbclip-content .tbclip-rich h2,
.tbclip-content .tbclip-rich h3,
.tbclip-content .tbclip-rich h4 {
  margin: 1.1em 0 0.45em;
  line-height: 1.35;
}
.tbclip-content .tbclip-rich p { margin: 0 0 0.75em; }
.tbclip-content .tbclip-rich a {
  color: var(--color-primary, #b71c1c);
  text-decoration: underline;
}
.tbclip-content .tbclip-rich blockquote {
  margin: 0.75em 0;
  padding: 8px 0 8px 16px;
  border-left: 4px solid var(--color-border, #e8d4d4);
  color: var(--color-text-muted);
}

.attach-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── 구독 모달 ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.is-open { display: flex; }

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.22s ease;
}
.modal-overlay--sm .modal-box { max-width: 420px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-header h2, .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--color-text-muted);
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.modal-close-btn:hover { background: var(--color-bg-alt); color: var(--color-text); }

.modal-body { padding: 24px; }

/* 구독 폼 */
.subscribe-form .form-group {
  margin-bottom: 18px;
}
.subscribe-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}
.subscribe-form label em {
  font-weight: 400;
  color: var(--color-text-muted);
  font-style: normal;
  font-size: 0.85em;
}
.subscribe-form input[type="text"],
.subscribe-form input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.subscribe-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(183,28,28,0.1);
}

.form-group--privacy {
  background: var(--color-bg-alt);
  padding: 14px;
  border-radius: var(--radius);
}
.privacy-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.85rem;
  font-weight: 400 !important;
  cursor: pointer;
  line-height: 1.6;
}
.privacy-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 3px;
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}
.privacy-view-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0 0;
  display: block;
}

.btn-block { width: 100%; justify-content: center; }

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.required { color: var(--color-primary); margin-left: 2px; }

/* 완료 / 중복 메시지 */
.subscribe-done,
.subscribe-dup {
  text-align: center;
  padding: 32px 16px;
}
.subscribe-done i { color: #16a34a; margin-bottom: 16px; display: block; }
.subscribe-done p { font-size: 0.95rem; line-height: 1.7; margin: 0; }
.subscribe-dup  i { color: var(--color-primary); margin-bottom: 12px; display: block; }
.subscribe-dup  p { font-size: 0.95rem; margin: 0; }

/* 개인정보 테이블 */
.privacy-content { font-size: 0.88rem; }
.privacy-table {
  width: 100%;
  border-collapse: collapse;
}
.privacy-table th,
.privacy-table td {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  text-align: left;
  line-height: 1.5;
}
.privacy-table th {
  background: var(--color-bg-alt);
  font-weight: 600;
  font-size: 0.83rem;
}

@media (max-width: 600px) {
  .tbclip-gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .tbclip-thumb   { height: 130px; }
  .modal-box      { max-width: 100%; border-radius: var(--radius); }
  .modal-body     { padding: 16px; }
}

.tbclip-card .meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ── 목록 아이템 (카드형, 전체 내용 표시) ── */
.list-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: none;
}

.list-item {
  display: block;
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: 0 2px 12px rgba(139,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.15s;
}

.list-item:hover {
  box-shadow: 0 4px 24px rgba(139,0,0,0.09);
  transform: translateY(-2px);
}

/* 상단 메타 행 */
.list-item-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.list-item-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.list-item-badge.reports { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.list-item-badge.guides  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.list-item-badge.events  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.list-item-badge.media   { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }

.list-item-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.83rem;
  color: var(--color-text-muted);
}

.list-item-source {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-left: auto;
}

/* 제목 */
.list-item-title {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  clear: both;
}

.list-item-title-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.list-item-title-link:hover .ko,
.list-item-title-link:hover .en {
  text-decoration: underline;
}
.list-item-title .ko {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.5;
}
.list-item-title .en {
  display: block;
  font-size: 1.02rem;
  color: var(--color-text);
  font-weight: 600;
  margin-top: 3px;
  font-style: normal;
}

/* 요약 */
.list-item-summary {
  display: block;
  width: 100%;
  clear: both;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-primary-light);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.list-item-summary .ko {
  display: block;
  font-size: 0.93rem;
  line-height: 1.75;
  color: var(--color-text);
  margin: 0 0 6px;
}
.list-item-summary .en {
  display: block;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--color-text-muted);
  margin: 0;
}

/* 액션 버튼 */
.list-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}

.action-btn--file {
  background: #fef2f2;
  color: var(--color-primary);
  border: 1px solid #fecaca;
}
.action-btn--file:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.action-btn--link {
  background: var(--color-bg-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.action-btn--link:hover {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.btn-xs { padding: 4px 10px; font-size: 0.78rem; }

/* 결과 건수 */
.result-count {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 64px 0;
  color: var(--color-text-muted);
}
.empty-state i { margin-bottom: 16px; display: block; opacity: 0.4; }

/* DB 오류 */
.db-error-notice {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.db-error-notice pre { width: 100%; margin-top: 8px; font-size: 0.8rem; }

/* 페이지네이션 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: all 0.15s;
}
.page-btn:hover { background: var(--color-bg-alt); border-color: var(--color-primary); color: var(--color-primary); }
.page-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 700; }

/* Detail page */
.detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}
.detail-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.detail-meta-badge.reports { background: #fef2f2; color: #b91c1c; }
.detail-meta-badge.guides  { background: #eff6ff; color: #1d4ed8; }
.detail-meta-badge.events  { background: #f0fdf4; color: #15803d; }
.detail-meta-badge.media   { background: #faf5ff; color: #7e22ce; }

.detail-title-en {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin: -12px 0 24px;
  font-style: italic;
}

.detail-summary {
  line-height: 1.8;
  margin-bottom: 20px;
}
.detail-summary .ko { margin-bottom: 8px; }
.detail-summary .en { font-size: 0.95em; color: var(--color-text-muted); }

.detail-body {
  max-width: none;
  width: 100%;
}

/* 본문 영역 배경을 흰색으로 고정 */
.detail-body .tbclip-rich {
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  width: 100%;
  box-sizing: border-box;
}

.detail-body .attachments {
  margin-top: 24px;
  padding: 20px;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--color-border-light);
}

.attach-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--color-primary);
}
.attach-link:hover { text-decoration: underline; }

.no-attach {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 16px;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.detail-back {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border-light);
}

@media (max-width: 640px) {
  .news-list .list-item {
    grid-template-columns: 1fr;
  }
  .news-list .list-item .thumb {
    width: 100%;
    height: 120px;
  }
  .tabs .tab-btn { padding: 8px 12px; font-size: 0.82rem; }
  .pagination { gap: 4px; }
  .page-btn { min-width: 32px; height: 32px; font-size: 0.82rem; }
}

@media (max-width: 640px) {
  .news-list .list-item {
    grid-template-columns: 1fr;
  }

  .news-list .list-item .thumb {
    width: 100%;
    height: 120px;
  }
}
