/**
 * 동네보험 — 보험소식 공개 페이지 스타일  v10
 * v7: 카드형 리스트 + 공지 앰버 배경
 * v8: 2컬럼 사이드바 레이아웃 + hero→intro 전환 + 좌측 바 제거 + 프리뷰 텍스트
 * v9: 사이드바 기간 필터 탭(전체/오늘/3일/7일) 스타일
 * v10: 인기 게시물 동적 헤더 (서브타이틀 + 라이브 도트), 수동 기간 탭 제거
 */

/* ── 페이지 배경 ── */
body {
  background: #F5F7FA;
}

/* ═══ Intro 밴드 (QnA intro와 동일 구조) ═══ */
.news-intro {
  background: #fff;
  border-bottom: 1px solid var(--border, #E2E8F0);
  padding: 20px 16px;
}

.news-intro__inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.news-intro__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.news-intro__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #EBF2FF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.news-intro__title {
  font-size: 18px;
  font-weight: 800;
  color: #1C1F26;
  letter-spacing: -0.4px;
  margin: 0 0 2px;
}

.news-intro__sub {
  font-size: 13px;
  color: #6B7280;
  margin: 0;
}

/* ═══ 2컬럼 레이아웃 ═══ */
.news-layout {
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

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

.news-sidebar {
  width: 264px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 768px) {
  .news-layout {
    flex-direction: column;
  }
  .news-sidebar {
    width: 100%;
  }
}

@media (min-width: 480px) {
  .news-layout {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* ═══ Filter Tabs ═══ */
.news-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.news-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.news-filter-tab {
  padding: 6px 16px;
  border-radius: var(--radius-full, 9999px);
  border: 1.5px solid var(--border, #E2E8F0);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  background: #fff;
  color: #64748B;
  transition: all 0.15s;
  white-space: nowrap;
}

.news-filter-tab:hover {
  border-color: #3272c7;
  color: #3272c7;
}

.news-filter-tab.active {
  background: #3272c7;
  border-color: #3272c7;
  color: #fff;
}

/* ═══ Search ═══ */
.news-search {
  position: relative;
}

.news-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary, #94A3B8);
  pointer-events: none;
}

.news-search__input {
  width: 100%;
  padding: 9px 36px 9px 38px;
  border: 1.5px solid var(--border, #E2E8F0);
  border-radius: 10px;
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  outline: none;
  box-sizing: border-box;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.news-search__input:focus {
  border-color: #3272c7;
  box-shadow: 0 0 0 3px rgba(50,114,199,0.1);
}

.news-search__clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══ 목록 래퍼 ═══ */
#newsList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px; /* CLS: 비동기 로딩 전 높이 예약 */
}

/* ═══ Card ═══ */
.news-card {
  display: block;
  background: #fff;
  border: 1px solid #E8EFF6;
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.18s, border-color 0.18s;
  animation: cardFadeUp 0.35s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.news-card:hover {
  box-shadow: 0 3px 14px rgba(50,114,199,0.1);
  border-color: #C7DCFF;
}

/* 공지 카드: 앰버 배경 */
.news-card--notice {
  background: #FFF9F0;
  border-color: #FCDEA5;
}

.news-card--notice:hover {
  border-color: #c9892a;
  box-shadow: 0 3px 14px rgba(201,137,42,0.1);
}

@keyframes cardFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 카드 상단: 태그 + 핀 */
.news-card__top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

/* 태그 뱃지 */
.news-card__tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.1px;
}

.news-card__tag--tip {
  background: #EBF2FF;
  color: #3272c7;
  border: 1px solid #BDD4F8;
}

.news-card__tag--news {
  background: #F0EDF9;
  color: #6B5FA6;
  border: 1px solid #CFC8EF;
}

.news-card__tag--notice {
  background: #FFF3DC;
  color: #c9892a;
  border: 1px solid #F5D9A0;
}

.news-card__pin {
  display: inline-flex;
  align-items: center;
  color: #DC2626;
  opacity: 0.85;
}

.news-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #0F172A);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.25px;
  margin-bottom: 5px;
}

/* ★ 프리뷰 텍스트 */
.news-card__preview {
  font-size: 12.5px;
  color: #64748B;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.news-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.news-card__meta {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-tertiary, #94A3B8);
}

.news-card__arrow {
  color: #CBD5E1;
  flex-shrink: 0;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.news-card:hover .news-card__arrow {
  color: #3272c7;
}

/* ═══ 사이드바 공통 ═══ */
.sidebar-box {
  background: #fff;
  border: 1px solid #E8EFF6;
  border-radius: 12px;
  overflow: hidden;
}

.sidebar-box__head {
  padding: 12px 16px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-box__head svg {
  color: #3272c7;
  flex-shrink: 0;
}

/* 동적 타이틀 + 서브타이틀 컨테이너 */
.sidebar-head-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-head-title {
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-box__subtitle {
  font-size: 11px;
  color: #94A3B8;
  font-weight: 400;
  line-height: 1;
}

/* 라이브 업데이트 표시 도트 */
.sidebar-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2e9e6e;
  flex-shrink: 0;
  animation: livePulse 2.4s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46,158,110,0.4); opacity: 1; }
  50%       { box-shadow: 0 0 0 5px rgba(46,158,110,0); opacity: 0.7; }
}

/* 인기기사 목록 */
.popular-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #F8FAFC;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}

.popular-item:last-child {
  border-bottom: none;
}

.popular-item:hover {
  background: #F8FAFC;
}

.popular-rank {
  font-size: 15px;
  font-weight: 800;
  color: #E2E8F0;
  width: 18px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

.popular-rank.top {
  color: #3272c7;
}

.popular-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-views {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 3px;
}

/* 사이드바 로딩/에러 */
.sidebar-loading {
  padding: 20px;
  text-align: center;
  color: #94A3B8;
  font-size: 12px;
}

/* ═══ Detail ═══ */
.news-detail {
  animation: cardFadeUp 0.3s ease;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E8EFF6;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.news-detail__header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #E2E8F0);
  margin-bottom: 24px;
}

.news-detail__tag {
  display: inline-flex;
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.news-detail__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  margin: 0 0 12px;
}

.news-detail__meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-tertiary, #94A3B8);
}

.news-detail__content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  word-break: keep-all;
  margin-bottom: 32px;
}

.news-detail__content p {
  margin: 0 0 12px;
}

/* 이전/다음 */
.news-detail__nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border, #E2E8F0);
  padding-top: 16px;
  margin-bottom: 16px;
}

.news-detail__nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  border: 1px solid #E8EFF6;
  background: var(--bg-secondary, #F5F7FA);
  transition: background 0.15s, border-color 0.15s;
}

.news-detail__nav-item:hover {
  background: #EFF4FE;
  border-color: #3272c7;
}

.news-detail__nav-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  min-width: 36px;
}

.news-detail__nav-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-detail__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
}

.news-detail__back:hover {
  background: var(--bg-secondary, #F5F7FA);
}

/* ═══ Loading ═══ */
.news-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.news-loading__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border, #E2E8F0);
  border-top-color: #3272c7;
  border-radius: 50%;
  animation: newsSpin 0.6s linear infinite;
}

@keyframes newsSpin { to { transform: rotate(360deg); } }

/* ═══ Empty ═══ */
.news-empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-tertiary, #94A3B8);
}

.news-empty__text {
  font-size: 14px;
  margin-top: 12px;
}

/* ═══ Pagination ═══ */
.news-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 0 8px;
}

.news-pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: #475569;
}

.news-pagination button:hover:not(:disabled) {
  background: var(--bg-secondary, #F5F7FA);
}

.news-pagination button.active {
  background: #3272c7;
  border-color: #3272c7;
  color: #fff;
  font-weight: 700;
}

.news-pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ═══ 상세 뷰 detail-layout (사이드바 없이 단일 컬럼) ═══ */
.news-detail-layout {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

@media (min-width: 480px) {
  .news-detail-layout {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* ═══ Responsive ═══ */
@media (max-width: 480px) {
  .news-detail {
    padding: 16px;
  }
  .news-detail__title {
    font-size: 19px;
  }
}
