/* ===== CSS VARIABLES ===== */
:root {
  /* Light mode variables */
  --primary-blue: #0066ff;
  --primary-dark: #003dd1;
  --secondary-blue: #f0f4ff;
  --accent-blue: #3b82f6;
  --success-green: #10b981;
  --warning-orange: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --text-primary: #1a1d29;
  --text-secondary: #5A6573;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --border-light: #e8eaed;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
}

/* Dark mode */
:root[data-theme="dark"] {
  --primary-blue: #3b82f6;
  --primary-dark: #60a5fa;
  --secondary-blue: #1e293b;
  --accent-blue: #60a5fa;
  --success-green: #059669;
  --warning-orange: #d97706;
  --gray-50: #0f172a;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-600: #94a3b8;
  --gray-800: #e2e8f0;
  --gray-900: #f1f5f9;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --border-light: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* ===== BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans KR', 'Inter', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  padding-top: 70px; /* For main-nav */
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HEADER STYLES ===== */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  min-height: 200px;
  position: relative;
  padding: 15px 24px 0;
}

.header-content {
  position: relative;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Header Mobile Bar */
.header-bar-mobile {
  display: none;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 8px;
  margin-bottom: 16px;
}

/* Header Logo */
.header-logo {
  position: absolute;
  top: 15px;
  left: 20px;
  height: 36px;
}

/* Header Publisher */
.header-publisher {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 16px;
  color: var(--text-primary);
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
}

/* Main Logo Section */
.logo-section {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 4px auto 0;
}

.logo-section img {
  max-width: 380px;
  width: 80vw;
  height: auto;
  display: block;
}

/* Header Date */
.header-date {
  position: static;
  transform: none;
  width: 100%;
  text-align: center;
  margin: 12px 0 0px;
}

.date-week-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* ===== PDF DOWNLOAD SECTION ===== */
.pdf-download {
  margin: 32px auto 24px;
  display: flex;
  justify-content: center;
}

.pdf-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.pdf-box:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pdf-content-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pdf-icon {
  width: 34px;
  height: 34px;
  opacity: 0.78;
}

.pdf-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 2px;
  text-decoration: underline;
  text-underline-offset: 4px;


}

.pdf-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: justify;
}

/* ===== NEWS GRID ===== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 32px;
  margin: 38px 0 64px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.news-card:hover {
  box-shadow: var(--shadow-lg);
}

.news-image {
  width: 100%;
  height: 240px;
  overflow: hidden;
  position: relative;
}

.news-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
}

.news-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.news-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.news-category {
  display: inline-flex;
  align-items: center;
  background: var(--secondary-blue);
  color: var(--primary-blue);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  padding: 6px 12px;
  margin-bottom: 16px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.news-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.news-summary {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}

.news-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.news-link {
  background: var(--gradient-primary);
  color: white;
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
}

.news-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.3);
}

.news-link::after {
  content: "→";
  font-size: 16px;
  transition: var(--transition);
}

.news-link:hover::after {
  transform: translateX(4px);
}

/* ===== FOOTER STYLES ===== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  padding: 18px 0 10px;
  text-align: center;
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
}

.footer-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.footer-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}

.footer-copyright {
  color: var(--text-muted);
  font-size: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  margin-top: 24px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.news-card {
  animation: fadeInUp 0.6s ease-out forwards;
}

.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }
.news-card:nth-child(4) { animation-delay: 0.4s; }
.news-card:nth-child(5) { animation-delay: 0.5s; }
.news-card:nth-child(6) { animation-delay: 0.6s; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 700px) {
  body {
    padding-top: 48px; /* nav 높이와 일치, header와 딱 붙게 */
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header {
    min-height: 250px;
    padding: 15px 16px 0;
  }

  .header-content {
    min-height: auto;
  }

  /* Show mobile bar, hide desktop elements */
  .header-bar-mobile {
    display: flex;
  }

  .header-logo:not(.in-bar),
  .header-publisher:not(.in-bar) {
    display: none;
  }

  .header-logo.in-bar {
    position: static;
    height: 30px;
    margin: 0;
  }

  .header-publisher.in-bar {
    position: static;
    font-size: 15px;
    margin-right: 12px;
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
  }

  /* Logo section adjustments */
  .logo-section {
    position: static;
    transform: none;
    margin: 4px auto 0;
    padding-top: 0;
  }

  .logo-section img {
    max-width: 280px;
    width: 98vw;
  }

  /* Header date adjustments */
  .header-date {
    position: static;
    transform: none;
    width: 100%;
    text-align: center;
    margin: 12px 0 0px;
  }

  .date-week-text {
    font-size: 19px;
  }

  /* News grid adjustments */
  .news-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .news-content {
    padding: 20px;
  }

  .news-image {
    height: 200px;
  }

  /* PDF download adjustments */
  .pdf-download {
    max-width: 100%;
    width: 100%;
  }

  .pdf-box {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .logo-section img {
    max-width: 260px;
    width: 95vw;
  }

  .header-publisher.in-bar {
    font-size: 12px;
    margin-right: 6px;
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
  }
}

@media (min-width: 769px) {
  .logo-section img {
    max-width: 380px;
    width: 95vw;
  }
}

/* ===== 플로팅 SNS UI ===== */
.floating-sns {
  position: fixed;
  right: 40px;
  bottom: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sns-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s, transform 0.2s, background 0.2s;
  border: none;
  padding: 0;
  background: #fff;
}
.sns-btn.insta {
  background: linear-gradient(135deg, #E1306C 0%, #F56040 100%);
}
.sns-btn.youtube {
  background: #FF0000;
}
.sns-btn.naver {
  background: #03C75A;
}
.sns-btn img {
  width: 34px;
  height: 34px;
  filter: brightness(0) invert(1);
  display: block;
}
.sns-btn:hover {
  box-shadow: 0 0 0 6px rgba(0,0,0,0.08);
  transform: translateY(-2px) scale(1.07);
}
.sns-btn:active,
.sns-btn:focus {
  /* 클릭/포커스 효과도 제거 */
  box-shadow: none;
  transform: none;
  outline: none;
}
.sns-btn.naver img {
  width: 28px;
  height: 28px;
}

@media (max-width: 600px) {
  .floating-sns {
    right: 18px;
    bottom: 16px;
    gap: 14px;
  }
  .sns-btn {
    width: 52px;
    height: 52px;
  }
  .sns-btn img {
    width: 28px;
    height: 28px;
  }
  .sns-btn.naver img {
    width: 22px;
    height: 22px;
  }
} /* <<<-- 올바른 위치로 이동한 닫는 중괄호 -->>> */

/* ===== 챗봇 UI 스타일 ===== */

/* 챗봇 버튼 스타일 */
.sns-btn.chatbot {
  background: var(--gradient-primary);
  position: relative;
  overflow: hidden;
}

.sns-btn.chatbot::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.sns-btn.chatbot:hover::before {
  transform: translateX(100%);
}

/* 챗봇 컨테이너 */
.chatbot-container {
  position: fixed;
  right: 40px;
  bottom: 120px;
  width: 380px;
  height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-container.active {
  display: flex;
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* 챗봇 헤더 */
.chatbot-header {
  background: var(--gradient-primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}

.chatbot-icon {
  font-size: 18px;
}

.chatbot-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 메시지 영역 */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-primary);
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 메시지 스타일 */
.message {
  max-width: 85%;
  margin-bottom: 12px;
}

.bot-message {
  align-self: flex-start;
}

.user-message {
  align-self: flex-end;
}

.message-content {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.bot-message .message-content {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 6px;
}

.user-message .message-content {
  background: var(--gradient-primary);
  color: white;
  border-bottom-right-radius: 6px;
}

/* 로딩 애니메이션 */
.loading-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  max-width: 85%;
}

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dot {
  width: 6px;
  height: 6px;
  background: var(--primary-blue);
  border-radius: 50%;
  animation: loadingDot 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 입력 영역 */
.chatbot-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  display: flex;
  gap: 12px;
  align-items: center;
}

#chatbot-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  background: var(--bg-primary);
}

#chatbot-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

#chatbot-send {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 60px;
}

#chatbot-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

#chatbot-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 챗봇 모바일 반응형 */
@media (max-width: 600px) {
  .chatbot-container {
    right: 18px;
    bottom: 90px;
    width: calc(100vw - 36px);
    max-width: 350px;
    height: 450px;
  }
  
  .chatbot-messages {
    padding: 16px;
  }
  
  .chatbot-input-area {
    padding: 12px 16px;
  }
  
  #chatbot-input {
    font-size: 16px; /* iOS 줌 방지 */
  }
}

@media (max-width: 480px) {
  .chatbot-container {
    width: calc(100vw - 24px);
    right: 12px;
    height: 400px;
  }
}