/* ==========================================================================
   HUG 사내벤처 '채권회수 쉼표' - 공식 모던 포털 & 채무자 마이페이지
   (줄바꿈 방지 슬림 헤더, 다건 채무 관리, 상환일자 계산기, 4대 신청 탭 & 서식자료실)
   ========================================================================== */

:root {
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;

  /* HUG Brand Identity Colors */
  --hug-navy: #004b93;         /* HUG Deep Navy */
  --hug-navy-dark: #003366;
  --hug-ocean: #00a3e0;        /* HUG Ocean Blue */
  --hug-green: #00a651;        /* HUG Safe Green */
  --hug-green-light: #e6f7ef;
  --hug-yellow: #ffb800;       /* Gold / Safety */

  /* Surfaces & Clean Text */
  --bg-main: #f2f4f6;
  --bg-card: #ffffff;
  --bg-card-glass: rgba(255, 255, 255, 0.94);
  --bg-subtle: #f9fafb;
  --bg-hover: #e5e8eb;

  --border-color: #e5e8eb;
  --border-strong: #d1d6db;

  --text-primary: #191f28;
  --text-secondary: #4e5968;
  --text-muted: #8b95a1;
  --text-inverse: #ffffff;

  --accent-rose: #f04452;
  --accent-emerald: #00a651;
  --accent-blue: #3182f6;

  /* Shadows */
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 16px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 16px 32px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 20px 40px -6px rgba(0, 75, 147, 0.16);

  /* Rounded Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg-main: #0c1118;
  --bg-card: #141c27;
  --bg-card-glass: rgba(20, 28, 39, 0.94);
  --bg-subtle: #1c2736;
  --bg-hover: #263548;

  --border-color: #263548;
  --border-strong: #384c66;

  --text-primary: #f9fafb;
  --text-secondary: #b0b8c1;
  --text-muted: #6b7684;
  --text-inverse: #0c1118;

  --hug-navy: #38a3f8;
  --hug-ocean: #2dd4bf;
  --hug-green: #34d399;
  --hug-green-light: #064e3b;

  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 16px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 32px -4px rgba(0, 0, 0, 0.5);
  --shadow-float: 0 20px 40px -6px rgba(0, 0, 0, 0.6);
}

/* Base Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   1. Header & Navigation (줄바꿈 원천 차단 - Single-line No-Wrap)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 12px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
  cursor: pointer;
}

.logo-badge {
  background: var(--hug-navy);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.logo-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--hug-navy);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Menu Tabs - 절대 줄바꿈 없음 */
.nav-scroll-wrap {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 0;
}

.nav-scroll-wrap::-webkit-scrollbar {
  display: none;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  white-space: nowrap;
}

.nav-tab-item {
  padding: 8px 13px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
}

.nav-tab-item:hover {
  color: var(--hug-navy);
  background-color: var(--bg-hover);
}

.nav-tab-item.active {
  color: var(--hug-navy);
  background-color: rgba(0, 75, 147, 0.08);
  border-color: rgba(0, 75, 147, 0.15);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-normal);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--hug-navy);
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 75, 147, 0.2);
}

.btn-primary:hover {
  background: var(--hug-navy-dark);
}

.btn-green {
  background: var(--hug-green);
  color: #fff;
}

.btn-green:hover {
  background: #008f45;
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn-auth-badge {
  background: rgba(0, 166, 81, 0.1);
  color: var(--hug-green);
  border: 1px solid rgba(0, 166, 81, 0.2);
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-weight: 800;
}

/* ==========================================================================
   2. Multi-View Routing System
   ========================================================================== */
.app-view {
  display: none;
  padding: 32px 0 64px 0;
}

.app-view.active {
  display: block;
  animation: viewFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.view-header {
  margin-bottom: 28px;
  text-align: left;
}

.view-eyebrow {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--hug-navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.view-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.view-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   3. [서비스 소개] 탭 및 핵심 키워드 경쟁 매트릭스 테이블
   ========================================================================== */
.about-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
  border-radius: var(--radius-xl);
  padding: 36px;
  border: 1px solid rgba(0, 75, 147, 0.1);
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}

[data-theme="dark"] .about-hero-card {
  background: linear-gradient(135deg, #141c27 0%, #1a293b 100%);
}

.keyword-matrix-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  margin-bottom: 36px;
}

.keyword-matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 780px;
}

.keyword-matrix-table th, .keyword-matrix-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
}

.keyword-matrix-table th {
  background: var(--bg-subtle);
  font-weight: 900;
  color: var(--text-secondary);
  white-space: nowrap;
}

.keyword-matrix-table tr.highlight-us td {
  background: rgba(0, 75, 147, 0.04);
  font-weight: 700;
}

.keyword-matrix-table tr.highlight-us td:first-child {
  border-left: 4px solid var(--hug-navy);
}

.badge-kw {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge-kw-navy { background: rgba(0, 75, 147, 0.1); color: var(--hug-navy); }
.badge-kw-green { background: var(--hug-green-light); color: var(--hug-green); }
.badge-kw-rose { background: rgba(240, 68, 82, 0.1); color: var(--accent-rose); }

/* ==========================================================================
   4. [채무자 마이페이지] 다건 채무 선택기 & 상환일자 계산기
   ========================================================================== */
.multi-debt-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.debt-selector-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.debt-selector-card:hover {
  border-color: var(--hug-navy);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.debt-selector-card.active {
  border-color: var(--hug-navy);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(0, 75, 147, 0.03) 100%);
  box-shadow: 0 4px 12px rgba(0, 75, 147, 0.15);
}

.debt-selector-card.active::before {
  content: '선택됨 ●';
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--hug-navy);
}

.debt-card-guarantee {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--hug-ocean);
  margin-bottom: 4px;
}

.debt-card-property {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.debt-card-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 3대 채무 세분화 카드 (구상채권, 이자, 소송대지급금) */
.debt-3type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 800px) {
  .debt-3type-grid {
    grid-template-columns: 1fr;
  }
}

.debt-3type-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: left;
}

.debt-3type-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.debt-3type-amount {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.debt-3type-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 상환일자별 실시간 계산기 Box */
.repayment-date-calc-box {
  background: linear-gradient(135deg, rgba(0, 75, 147, 0.05), rgba(0, 166, 81, 0.05));
  border: 1.5px solid rgba(0, 75, 147, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
}

.date-calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.date-input-field {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--hug-navy);
  background: var(--bg-card);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  outline: none;
}

.calc-live-badge {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ==========================================================================
   5. [4대 신청 탭 및 양식 자료실]
   ========================================================================== */
.app-forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.app-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.app-form-card:hover {
  border-color: var(--hug-navy);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.form-category-tag {
  align-self: flex-start;
  background: rgba(0, 75, 147, 0.08);
  color: var(--hug-navy);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.form-card-title {
  font-size: 1.15rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.form-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 18px;
}

/* Document Download Center */
.doc-download-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-download-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  transition: all var(--transition-fast);
}

.doc-download-item:hover {
  border-color: var(--hug-green);
  background: var(--bg-subtle);
}

/* MyPage Sub Navigation */
.mypage-subnav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

@media (max-width: 960px) {
  .mypage-subnav {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 600px) {
  .mypage-subnav {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mypage-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mypage-nav-btn:hover {
  border-color: var(--hug-navy);
}

.mypage-nav-btn.active {
  background: var(--hug-navy);
  color: #fff;
  border-color: var(--hug-navy);
  box-shadow: 0 4px 10px rgba(0, 75, 147, 0.2);
}

.mypage-nav-btn.active .mypage-btn-sub {
  color: rgba(255, 255, 255, 0.8);
}

.mypage-btn-title {
  font-size: 0.95rem;
  font-weight: 800;
}

.mypage-btn-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mypage-panel {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.mypage-panel.active {
  display: block;
  animation: viewFadeIn 0.25s ease;
}

/* Modal for Online Application */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.app-modal-overlay.active {
  display: flex;
}

.app-modal-box {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  padding: 32px;
  box-shadow: var(--shadow-float);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--hug-navy);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(0, 75, 147, 0.1);
}

/* Calculator & Roadmap & MD Layout */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

@media (max-width: 900px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-md);
}

.calc-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border-strong);
  outline: none;
  cursor: pointer;
  accent-color: var(--hug-navy);
}

.md-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-height: 650px;
}

@media (max-width: 860px) {
  .md-layout {
    grid-template-columns: 1fr;
  }
}

.md-sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-color);
  padding: 20px;
}

.md-search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  margin-bottom: 14px;
}

.md-file-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 4px;
}

.md-file-item:hover, .md-file-item.active {
  background: var(--bg-card);
  color: var(--hug-navy);
  box-shadow: var(--shadow-sm);
}

.md-content-pane {
  padding: 36px 44px;
  overflow-y: auto;
  max-height: 800px;
}

/* Markdown typography */
.markdown-body {
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.markdown-body h1 {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
  color: var(--hug-navy);
}

.markdown-body h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-top: 28px;
  margin-bottom: 14px;
}

.markdown-body h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 20px;
  margin-bottom: 10px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.markdown-body table th, .markdown-body table td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
}

.markdown-body table th {
  background: var(--bg-subtle);
  font-weight: 800;
}

.markdown-body pre {
  background: #111827;
  color: #f9fafb;
  padding: 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 18px 0;
}

/* Footer */
.app-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 36px 0;
  margin-top: auto;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}
