/* ==========================================================================
   match.nlink.kr - Monochrome & Glassmorphism O2O Platform Stylesheet
   Mobile-First Native App UX + Modern Accordion + Modal Scroll Containment
   ========================================================================== */

:root {
  --bg: #090d16;
  --bg-card: rgba(17, 24, 39, 0.82);
  --bg-elevated: rgba(30, 41, 59, 0.72);
  --bg-glass: rgba(15, 23, 42, 0.88);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.18);
  --sky: #38bdf8;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --purple: #a855f7;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Native App Touch UX (Prevent Chrome Touch-to-Search & Callout) */
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(16, 185, 129, 0.10), transparent 36%),
    radial-gradient(circle at 88% 12%, rgba(56, 189, 248, 0.09), transparent 38%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  min-height: 100vh;
}

input, textarea, select, [contenteditable="true"], .selectable, .selectable-text {
  -webkit-user-select: text;
  user-select: text;
}

/* Modern Web Guidance: prevent-page-scroll-under-modal-dialog */
dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Sticky Top Navigation (z-index: 30) */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(9, 13, 22, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Dual-Mode Pill Switcher (Client <-> Partner) */
.mode-switcher {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.mode-btn.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #06130e;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.35);
}

.mode-btn.partner-mode-btn.active {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #04131d;
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.35);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  border: 1px solid var(--border-strong);
  background: rgba(30, 41, 59, 0.65);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

.pill-btn:hover, .pill-btn.active {
  border-color: var(--accent);
  color: #fff;
  background: rgba(16, 185, 129, 0.16);
}

/* Main Container */
.main-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 64px;
}

/* Hero Banner & KPI Strip */
.hero-card {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.92), rgba(15, 23, 42, 0.85));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-headline {
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}

.hero-sub {
  font-size: 13.5px;
  color: var(--text-sub);
  margin: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.kpi-item {
  background: rgba(9, 13, 22, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 3px 0 2px;
}

.kpi-desc {
  font-size: 11px;
  color: #34d399;
}

/* Reassurance Banner (심리적 인지 부하 해소 배너) */
.reassurance-banner {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.5;
}

.reassurance-banner.sky {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Section Layout Grid */
.two-col-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
  align-items: start;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
}

.panel-title {
  font-size: 16.5px;
  font-weight: 800;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(9, 13, 22, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Buttons */
.btn-primary {
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #04130d;
  font-weight: 800;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.btn-primary.sky {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #04121d;
}

.btn-primary:hover {
  opacity: 0.94;
}

.btn-primary:active {
  transform: scale(0.985);
}

.btn-secondary {
  border: 1px solid var(--border-strong);
  background: rgba(30, 41, 59, 0.75);
  color: var(--text);
  font-weight: 700;
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

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

/* Modern Collapsible Accordion ("접힘도 예쁘고, 펼침도 완벽하게") */
details.modern-accordion {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  margin: 12px 0;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

details.modern-accordion[open] {
  border-color: rgba(56, 189, 248, 0.42);
  background: rgba(15, 23, 42, 0.95);
}

details.modern-accordion > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-sub);
  user-select: none;
}

details.modern-accordion > summary::-webkit-details-marker {
  display: none;
}

details.modern-accordion > summary .chevron-svg {
  width: 16px;
  height: 16px;
  transition: transform 0.22s ease;
  color: var(--text-muted);
  flex-shrink: 0;
}

details.modern-accordion[open] > summary {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

details.modern-accordion[open] > summary .chevron-svg {
  transform: rotate(180deg);
  color: var(--sky);
}

.accordion-body {
  padding: 14px;
}

/* Upload Dropzone for Business Registration Certificate */
.cert-dropzone {
  border: 1.5px dashed rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.06);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.cert-dropzone:hover, .cert-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(14, 165, 233, 0.12);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip-btn {
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--sky);
  color: #fff;
}

/* Feed Cards (Requests, Quotes, Partners, Escrows) */
.feed-card {
  background: rgba(9, 13, 22, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 12px;
  transition: border-color 0.18s ease;
}

.feed-card:hover {
  border-color: var(--border-strong);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-sub);
  border: 1px solid var(--border);
}

.tag-badge.emerald {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.tag-badge.sky {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

.tag-badge.amber {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.tag-badge.purple {
  background: rgba(168, 85, 247, 0.14);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.35);
}

/* 3-Step Escrow Stepper */
.escrow-stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.escrow-step-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.escrow-step-box.done {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.1);
}

.escrow-step-box.active {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(56, 189, 248, 0.12);
}

/* Modals (z-index: 100, direct children of body) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 7, 14, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  background: #111827;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  overscroll-behavior: contain;
}

.modal-close-x {
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-sub);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Toast Notification (z-index: 9999) */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 440px);
}

.toast-msg {
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

/* PWA Update Banner */
#pwa-update-banner {
  display: none;
  background: rgba(56, 189, 248, 0.14);
  border-bottom: 1px solid rgba(56, 189, 248, 0.4);
  padding: 8px 16px;
  text-align: center;
  font-size: 12.5px;
  color: #e0f2fe;
}

/* Responsive Mobile Optimization */
@media (max-width: 860px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .escrow-stepper {
    grid-template-columns: 1fr;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}
