/* ==========================================================================
   ToolNest Shared Design System - Light / Dark Mode & Modern Glassmorphism
   ========================================================================== */

:root {
  /* Light Theme (Default) */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #4f46e5;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.15);

  --kakao: #fee500;
  --kakao-text: #191919;
  --insta-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);

  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg: #090d16;
  --surface: #111827;
  --surface-alt: #1a2234;
  --border: #1f293d;
  --border-focus: #6366f1;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --primary-light: #1e1b4b;
  --success-light: #064e3b;
  --warning-light: #451a03;
  --danger-light: #450a0a;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
  display: flex;
  flex-direction: column;
}

/* Header & Global Navigation (GNB) */
.gnb {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.gnb-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gnb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.gnb-brand .logo-badge {
  background: var(--primary);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.gnb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

.theme-toggle-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Container */
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  flex: 1;
}

/* Page Header */
.page-header {
  text-align: center;
  margin-bottom: 36px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.page-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 10px;
  line-height: 1.25;
}

.page-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  overflow: hidden;
}

.card-padded {
  padding: 28px;
}

/* Form & Input Components */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.form-label .hint {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-field, .select-field {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.15s ease;
}

.input-field:focus, .select-field:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-lg {
  padding: 15px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Viral SNS Share Bar Component (카톡, 인스타, 링크복사)
   ========================================================================== */
.share-section {
  margin: 32px 0 16px;
  padding: 20px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.share-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.share-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

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

/* 카카오톡 버튼 */
.share-btn-kakao {
  background: #fee500;
  color: #191919;
}
.share-btn-kakao:hover {
  background: #fada0a;
}

/* 인스타그램 버튼 */
.share-btn-insta {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: #ffffff;
}

/* 링크 복사 버튼 */
.share-btn-copy {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-main);
}
.share-btn-copy:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* 더보기 / 네이티브 공유 버튼 */
.share-btn-more {
  background: var(--primary);
  color: #ffffff;
}
.share-btn-more:hover {
  background: var(--primary-hover);
}

/* Floating Share Toast Notification */
.share-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.share-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* SEO & Information Content Section */
.seo-article {
  margin-top: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
}

.seo-article h2 {
  font-size: 1.35rem;
  color: var(--text-main);
  font-weight: 800;
  margin-bottom: 14px;
}

.seo-article h3 {
  font-size: 1.05rem;
  color: var(--primary);
  font-weight: 700;
  margin: 22px 0 8px;
}

.seo-article p {
  margin-bottom: 12px;
}

.seo-article ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 20px 30px;
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--primary);
}

@media (max-width: 768px) {
  .page-title { font-size: 1.75rem; }
  .container { padding: 24px 16px 60px; }
  .card-padded { padding: 20px; }
  .seo-article { padding: 24px; }
  .gnb-nav .nav-link { display: none; }
  .share-buttons { gap: 8px; }
  .share-btn { padding: 8px 12px; font-size: 0.82rem; }
}

/* GNB Dropdown Menu */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.dropdown-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 1000;
  max-height: 420px;
  overflow-y: auto;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 10px 14px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}

.dropdown-menu a:hover, .dropdown-menu a.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ==========================================================================
   AdSense 광고 슬롯 & 관련 도구 추천 섹션 (자동 삽입용)
   ========================================================================== */

/* 광고 슬롯 공통 */
.adsense-slot {
  width: 100%;
  overflow: hidden;
  text-align: center;
  border-radius: var(--radius-md);
}

.adsense-top {
  margin: 0 0 20px 0;
  min-height: 90px;
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

/* 실제 AdSense 승인 후 아래 주석 해제 */
/* .adsense-top { background: none; border: none; } */

.adsense-mid {
  margin: 24px 0;
  min-height: 120px;
}

.adsense-bottom {
  margin: 24px 0 0;
}

/* 관련 도구 추천 섹션 */
.related-tools-section {
  margin: 32px 0 0;
}

.related-tools-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.related-tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.related-tool-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.rtc-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.rtc-name {
  flex: 1;
  line-height: 1.3;
}

.rtc-arrow {
  font-size: 0.9rem;
  color: var(--primary);
  opacity: 0.7;
  flex-shrink: 0;
}

/* FAQ 스타일 (공통) */
.faq-section { margin-top: 28px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-q {
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-alt);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.93rem;
  transition: background 0.12s ease;
}
.faq-q:hover { background: var(--primary-light); color: var(--primary); }
.faq-a {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-muted);
}
.faq-a.open { max-height: 400px; padding: 14px 18px; }

/* Quick Chips (⭐ 즐겨찾기 & 🕒 최근 사용한 도구) */
.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
}
.quick-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.quick-chip.fav {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
}
[data-theme="dark"] .quick-chip.fav {
  background: #451a03;
  color: #fde68a;
  border-color: #d97706;
}

/* 공유 & 인쇄 버튼 스타일 */
.share-btn-fav { background: #f59e0b !important; color: #fff !important; border-color: #f59e0b !important; }
.share-btn-print { background: #0284c7 !important; color: #fff !important; border-color: #0284c7 !important; }
.share-btn-img { background: #8b5cf6 !important; color: #fff !important; border-color: #8b5cf6 !important; }

/* A4 인쇄 / PDF 출력 최적화 스타일 */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .gnb, .site-footer, .share-section, .adsense-slot, .related-tools-section, .dropdown, #themeToggleBtn, .btn, button, input[type=file] {
    display: none !important;
  }
  .container, .card, .card-padded {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .result-hero, .score-hero, .survive-hero {
    background: #f8fafc !important;
    color: #000 !important;
    border: 2px solid #334155 !important;
    page-break-inside: avoid;
  }
  .result-hero * { color: #000 !important; }
  .insurance-table, table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  .insurance-table th, .insurance-table td, table th, table td {
    border: 1px solid #cbd5e1 !important;
    color: #000 !important;
  }
}
