/* CSS 변수 정의 */
:root {
  --brand-primary: #667eea;
  --brand-secondary: #764ba2;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --card-bg: #ffffff;
  --shadow-light: rgba(0, 0, 0, 0.08);
}

/* 상단 네비게이션 바 */
.detail-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.detail-nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.nav-btn i {
  font-size: 14px;
}

.back-btn {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.back-btn:hover {
  background: var(--brand-secondary);
  border-color: var(--brand-secondary);
  color: white;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}

.nav-brand:hover {
  color: var(--brand-primary);
}

.nav-brand i {
  color: var(--brand-primary);
  font-size: 18px;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .detail-nav-container {
    padding: 10px 16px;
  }

  .nav-btn span,
  .nav-brand span {
    display: none;
  }

  .nav-btn {
    padding: 10px;
    min-width: 40px;
    justify-content: center;
  }

  .nav-btn i {
    font-size: 16px;
  }

  .nav-brand {
    font-size: 14px;
  }
}

.news-detail-container {
  min-height: 80vh;
  padding: 0 0 60px;
  background-color: var(--bg-secondary);
  transition: background-color 0.3s ease;
}

/* 웹뷰 전용 스타일 - 기존 */
.webview-content .news-detail-container {
  padding: 10px 0 20px;
  /* 웹뷰에서는 패딩 줄임 */
  min-height: 100vh;
}

.webview-content .news-article {
  margin-bottom: 20px;
  /* 웹뷰에서는 마진 줄임 */
}

.webview-content .article-header {
  padding: 25px 20px;
  /* 웹뷰에서는 패딩 줄임 */
}

.webview-content .article-content {
  padding: 25px 20px;
  /* 웹뷰에서는 패딩 줄임 */
}

.webview-content .comments-section {
  padding: 25px 20px;
  /* 웹뷰에서는 패딩 줄임 */
}

/* 앱 웹뷰 전용 스타일 - 새로운 방식 */
.app-view .news-detail-container {
  padding: 0 !important;
  min-height: 100vh;
  margin-top: 0 !important;
}

.app-view .container {
  padding: 0 15px !important;
  margin-top: 0 !important;
}

.app-view .news-article {
  margin-bottom: 15px !important;
  border-radius: 8px !important;
  margin-top: 0 !important;
}

.app-view .article-header {
  padding: 15px !important;
}

.app-view .article-content {
  padding: 15px !important;
}

.app-view .comments-section {
  padding: 15px !important;
  border-radius: 8px !important;
  margin-top: 10px !important;
}

/* 앱 웹뷰 모바일 최적화 */
@media (max-width: 768px) {
  .app-view .container {
    padding: 5px 10px !important;
  }

  .app-view .article-header {
    padding: 15px 10px !important;
  }

  .app-view .article-content {
    padding: 15px 10px !important;
  }

  .app-view .comments-section {
    padding: 15px 10px !important;
  }

  .app-view .article-title {
    font-size: 1.4rem !important;
    margin-bottom: 15px !important;
  }

  .app-view .category-badge {
    margin-bottom: 10px !important;
  }
}

/* 앱 웹뷰에서 소셜 공유 버튼 숨기기 */
.app-view .social-share {
  display: none !important;
}

.breadcrumb-nav {
  margin-bottom: 30px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.back-link:hover {
  color: var(--brand-secondary);
  text-decoration: none;
  transform: translateX(-5px);
}

.news-article {
  background: var(--card-bg);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow-light);
  margin-bottom: 40px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.article-header {
  padding: 40px;
  border-bottom: 1px solid var(--border-color);
}

/* 언어 전환 버튼 (상단 가로 스크롤) */
.language-switcher-container {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 20px 0;
  padding: 10px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #8b63ca #f0f0f0;
}

.language-switcher-container::-webkit-scrollbar {
  height: 6px;
}

.language-switcher-container::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 3px;
}

.language-switcher-container::-webkit-scrollbar-thumb {
  background: #8b63ca;
  border-radius: 3px;
}

.language-switcher-container::-webkit-scrollbar-thumb:hover {
  background: #7952b3;
}

.language-switcher {
  display: flex;
  gap: 10px;
  width: max-content;
}

.lang-btn {
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  background: #fff;
  border: 2px solid #e0e0e0;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.lang-btn:hover {
  background: #f8f8f8;
  border-color: #8b63ca;
  color: #333;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.lang-btn.active {
  background: #8b63ca;
  color: #fff;
  border-color: #8b63ca;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(139, 99, 202, 0.3);
}

.lang-btn.active:hover {
  background: #7952b3;
  border-color: #7952b3;
  transform: translateY(-2px);
}

/* 플로팅 액션 버튼 (하단 고정) */
.floating-actions {
  position: fixed;
  bottom: 80px;
  right: 30px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.floating-actions.visible {
  opacity: 1;
  visibility: visible;
}

/* 공통 액션 버튼 스타일 */
.action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
  transform: translateY(-1px);
}

/* 공유하기 버튼 */
.floating-share-btn {
  position: relative;
}

.share-toggle-btn {
  background: #8b63ca;
}

.share-menu {
  position: absolute;
  bottom: 58px;
  right: 0;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  gap: 6px;
  min-width: 50px;
}

.share-menu.active {
  display: flex;
}

.share-menu .share-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-menu .share-btn.facebook {
  background: #1877f2;
}

.share-menu .share-btn.twitter {
  background: #1da1f2;
}

.share-menu .share-btn.kakao {
  background: #fee500;
  color: #000;
}

.share-menu .share-btn.copy-link {
  background: #666;
}

.share-menu .share-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-menu .share-btn::after {
  display: none;
}

/* Top 버튼 */
.top-btn {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.top-btn:hover {
  background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
}

/* 커스텀 상단 스크롤바 */
.custom-scrollbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: rgba(240, 240, 240, 0.95);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.custom-scrollbar.visible {
  opacity: 1;
}

.scrollbar-track {
  width: 100%;
  height: 100%;
  background: #e0e0e0;
  position: relative;
}

.scrollbar-thumb {
  height: 100%;
  background: #8b63ca;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  position: absolute;
  left: 0;
  top: 0;
  box-shadow: 0 0 8px rgba(139, 99, 202, 0.4);
}

.scrollbar-thumb:hover {
  background: #7952b3;
  box-shadow: 0 0 12px rgba(139, 99, 202, 0.6);
}

.scrollbar-thumb.dragging {
  background: #6941a5;
  box-shadow: 0 0 16px rgba(139, 99, 202, 0.8);
}

/* 기본 세로 스크롤바 숨기기 */
body {
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

html {
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

.category-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  color: var(--bg-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.article-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 0 0 25px 0;
  transition: color 0.3s ease;
}

.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e9ecef;
}

.meta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.3s ease;
}
