/* frontend/assets/css/style.css */
/* v2.3 - TOP 뉴스 가로 레이아웃 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========================================
   헤더
   ======================================== */
.header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 8px 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.header-links a {
  margin-left: 15px;
  color: #666;
}

.header-links a:hover {
  color: #c00;
}

.header-logo {
  text-align: center;
  padding: 20px 0;
  position: relative;
}

.header-logo .logo {
  max-height: 80px;
}

.header-sub-links {
  position: absolute;
  right: 0;
  bottom: 20px;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-sub-links .divider {
  color: #ccc;
}

.header-sub-links a {
  color: #555;
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f9f9f9;
  transition: all 0.2s;
  font-weight: 500;
}

.header-sub-links a:hover {
  background: #c00;
  color: #fff;
  border-color: #c00;
}

.nav-main {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 8px 0;
  border-top: 2px solid #333;
  border-bottom: 1px solid #ddd;
}

.nav-main a {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  border-radius: 3px;
  transition: all 0.2s;
}

.nav-main a:hover,
.nav-main a.active {
  background: #c00;
  color: #fff;
}

/* ========================================
   메인 콘텐츠 - 1:2:1 고정 비율 (변경 금지)
   ======================================== */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 15px;
}

/* 핵심: 1:2:1 비율 고정 */
.content-wrapper.layout-1-2-1 {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 20px;
}

/* 왼쪽 컬럼 (1) */
.column-left {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* 중앙 컬럼 (2) */
.column-center {
  min-width: 0;
}

/* 오른쪽 컬럼 (1) */
.column-right {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* ========================================
   사이드바 박스 (라파뉴스, 기획기사, 중독이슈 공통)
   ======================================== */
.sidebar-box {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
}

.sidebar-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ff9800;
  padding: 8px 12px;
}

.sidebar-box-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.sidebar-more {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

.sidebar-more:hover {
  color: #fff;
}

.sidebar-box-content {
  padding: 10px;
}

/* 사이드바 아이템 (공통) */
.sidebar-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

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

.sidebar-rank {
  font-size: 15px;
  font-weight: 700;
  color: #c00;
  width: 20px;
  flex-shrink: 0;
}

.sidebar-item-content {
  flex: 1;
  min-width: 0;
}

.sidebar-item-title {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  display: block;
  line-height: 1.4;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sidebar-item-title:hover {
  color: #c00;
}

.sidebar-item-meta {
  font-size: 10px;
  color: #888;
}

.no-articles-small {
  font-size: 12px;
  color: #888;
  text-align: center;
  padding: 15px 5px;
}

/* ========================================
   섹션 공통
   ======================================== */
.section {
  background: #fff;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #c00;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.more-link {
  font-size: 12px;
  color: #666;
}

.more-link:hover {
  color: #c00;
}

/* ========================================
   TOP 뉴스 - 가로 레이아웃 (1:3 비율 - 이미지:내용)
   ======================================== */
.top-news-section {
  background: #e3f2fd;
}

.top-news-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.top-news-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 16px;
  padding: 15px;
  border-bottom: 1px solid #ccc;
  background: #fff;
  min-height: 160px;
}

.top-news-card:last-child {
  border-bottom: none;
}

.top-news-card.main {
  background: #f8f9fa;
}

.top-news-image-wrap {
  flex: 1;
  min-width: 120px;
  max-width: 160px;
  overflow: hidden;
  border-radius: 4px;
  background: #f0f0f0;
}

.top-news-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-news-content {
  flex: 3;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-news-title {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 6px;
  max-height: 2.8em;
}

.top-news-title:hover {
  color: #c00;
}

.top-news-meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.top-news-summary {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  flex: 1;
}

.top-news-more {
  font-size: 13px;
  color: #c00;
  text-decoration: none;
  font-weight: 500;
  align-self: flex-start;
  margin-top: auto;
  padding-top: 6px;
}

.top-news-more:hover {
  text-decoration: underline;
}

/* ========================================
   기사 카드 (메인 페이지 카테고리별)
   ======================================== */
.articles-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-card {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.article-card:last-child {
  border-bottom: none;
}

.article-thumb {
  width: 90px;
  height: 65px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  background: #f0f0f0;
}

.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.article-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  display: block;
  margin-bottom: 4px;
  line-height: 1.4;
}

.article-title:hover {
  color: #c00;
}

.article-meta {
  font-size: 11px;
  color: #888;
  margin-bottom: 5px;
}

.article-summary {
  font-size: 12px;
  color: #555;
  line-height: 1.5;
  margin-bottom: 6px;
}

.article-summary[data-collapsed="true"] p {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.article-summary p {
  margin-bottom: 3px;
}

.article-actions {
  display: flex;
  gap: 6px;
}

.btn-toggle,
.btn-source {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toggle {
  background: #f0f0f0;
  border: 1px solid #ddd;
  color: #555;
}

.btn-toggle:hover {
  background: #e0e0e0;
}

.btn-source {
  background: #c00;
  border: none;
  color: #fff;
  text-decoration: none;
}

.btn-source:hover {
  background: #a00;
}

/* ========================================
   전용 페이지 (카테고리, 라파뉴스, 기획기사)
   ======================================== */
.special-page {
  background: #fff;
  padding: 25px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.special-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  padding-bottom: 10px;
  margin-bottom: 5px;
  border-bottom: 3px solid #c00;
}

.special-page-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 20px;
}

.special-articles-list {
  display: flex;
  flex-direction: column;
}

/* 전체 기사 카드 */
.full-article-card {
  display: flex;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.full-article-card:last-child {
  border-bottom: none;
}

.full-article-image {
  width: 150px;
  height: 100px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #f0f0f0;
}

.full-article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.full-article-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  display: block;
  margin-bottom: 5px;
  line-height: 1.4;
}

.full-article-title:hover {
  color: #c00;
}

.full-article-meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.full-article-summary {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
  margin-bottom: 10px;
}

.full-article-summary[data-collapsed="true"] p {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.full-article-summary p {
  margin-bottom: 4px;
}

/* ========================================
   푸터
   ======================================== */
.footer {
  background: #333;
  color: #fff;
  text-align: center;
  padding: 15px;
  margin-top: 20px;
  font-size: 12px;
}

/* ========================================
   유틸리티
   ======================================== */
.no-articles {
  text-align: center;
  color: #888;
  padding: 20px;
  font-size: 13px;
}

/* ========================================
   반응형
   ======================================== */
@media (max-width: 1024px) {
  .content-wrapper.layout-1-2-1 {
    grid-template-columns: 1fr 2fr;
  }
  
  .column-right {
    display: none;
  }
  
  .top-news-image-wrap {
    min-width: 100px;
    max-width: 140px;
    height: 100px;
  }
}

@media (max-width: 768px) {
  .content-wrapper.layout-1-2-1 {
    grid-template-columns: 1fr;
  }
  
  .column-left {
    display: none;
  }
  
  .nav-main {
    flex-wrap: wrap;
    gap: 3px;
  }
  
  .nav-main a {
    padding: 5px 8px;
    font-size: 12px;
  }
  
  /* TOP 뉴스 모바일: 세로 레이아웃 */
  .top-news-card {
    flex-direction: column;
  }
  
  .top-news-image-wrap {
    width: 100%;
    height: 200px;
  }
  
  .top-news-summary {
    -webkit-line-clamp: 4;
  }
}

@media (max-width: 500px) {
  .article-card {
    flex-direction: column;
  }
  
  .article-thumb {
    width: 100%;
    height: 140px;
  }
  
  .full-article-card {
    flex-direction: column;
  }
  
  .full-article-image {
    width: 100%;
    height: 160px;
  }
}

/* 중독백과 용어 자동 링크 스타일 */
.enc-term-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted #8a6d3b;
  cursor: pointer;
}
.enc-term-link:hover {
  border-bottom-style: solid;
  background: rgba(138, 109, 59, 0.08);
}

/* 중독백과 한/영 토글 */
.enc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.enc-lang {
  display: inline-flex;
  gap: 4px;
  font-size: 13px;
}
.enc-lang a {
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 14px;
  text-decoration: none;
  color: #555;
  background: #fff;
}
.enc-lang a.active {
  background: #111;
  color: #fff;
  border-color: #111;
}
.enc-lang a:hover {
  border-color: #111;
}