/* ==========================================================================
   K-BizPulse Lead - 대한민국 최고급 B2B 영업 리드 레이더 SaaS 스타일시트
   ========================================================================== */

:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-glass: rgba(30, 41, 59, 0.5);
  
  --border-color: rgba(51, 65, 85, 0.6);
  --border-glow: rgba(16, 185, 129, 0.35);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-emerald: #10b981;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-rose: #f43f5e;
  --accent-gold: #f59e0b;
  
  --font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------
   Header
------------------------------------------------------------- */
.b2b-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.b2b-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.b2b-logo-badge {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  flex-shrink: 0;
}

.b2b-title {
  min-width: 0;
}

.b2b-title h1 {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.b2b-title p {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.live-radar-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 7px 13px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  height: 34px;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  animation: radarPulse 1.5s infinite;
  flex-shrink: 0;
}

@keyframes radarPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* -------------------------------------------------------------
   Navigation Tabs
------------------------------------------------------------- */
.b2b-navigation {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  background: #0b1120;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.nav-tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-tab-btn:hover {
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-primary);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

/* -------------------------------------------------------------
   Main Viewport
------------------------------------------------------------- */
.app-viewport {
  flex: 1;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

/* -------------------------------------------------------------
   KPI Stat Banner
------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-val {
  font-size: 26px;
  font-weight: 900;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

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

/* -------------------------------------------------------------
   Content Box & Cards
------------------------------------------------------------- */
.content-box {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  padding-bottom: 14px;
}

.box-title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* -------------------------------------------------------------
   Filter Bar
------------------------------------------------------------- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.filter-select, .filter-input {
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.2s ease;
}

.filter-select:focus, .filter-input:focus {
  border-color: var(--accent-emerald);
}

.btn-csv-download {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-csv-download:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #10b981, #34d399);
}

/* -------------------------------------------------------------
   Lead Card Grid
------------------------------------------------------------- */
.lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 18px;
}

.lead-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.lead-card:hover {
  transform: translateY(-3px);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.12);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.lead-title-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lead-store-name {
  font-size: 15.5px;
  font-weight: 800;
  color: #ffffff;
}

.lead-type-tag {
  font-size: 11.5px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.lead-badge-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lead-dday-pill {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.lead-score-pill {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
}

.lead-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(11, 17, 32, 0.6);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11.5px;
}

.lead-info-item span:first-child {
  color: var(--text-muted);
  margin-right: 4px;
}

.lead-address {
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lead-needs-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.need-tag {
  background: rgba(51, 65, 85, 0.5);
  color: #e2e8f0;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10.5px;
}

.lead-action-bar {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.btn-proposal-modal {
  flex: 1;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: white;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.btn-proposal-modal:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
}

.btn-bookmark {
  background: rgba(51, 65, 85, 0.5);
  border: 1px solid var(--border-color);
  color: #f1f5f9;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.btn-bookmark.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fbbf24;
}

/* -------------------------------------------------------------
   Proposal Modal & Scripts
------------------------------------------------------------- */
.b2b-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.b2b-modal-container {
  background: #0f172a;
  color: #f8fafc;
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.b2b-modal-header {
  background: #090d16;
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.b2b-modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.b2b-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vendor-selector-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.vendor-chip-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vendor-chip-btn.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  border-color: #10b981;
  color: #6ee7b7;
}

.script-box {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  position: relative;
}

.script-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #38bdf8;
}

.btn-copy-script {
  background: rgba(51, 65, 85, 0.7);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-copy-script:hover {
  background: #10b981;
}

.script-content {
  font-family: monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #e2e8f0;
}

.b2b-modal-footer {
  background: #090d16;
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-color);
}

/* -------------------------------------------------------------
   Responsive Mobile Design
------------------------------------------------------------- */
@media (max-width: 860px) {
  .b2b-header {
    padding: 10px 14px;
    gap: 8px;
  }

  .b2b-brand {
    gap: 8px;
  }

  .b2b-title h1 {
    font-size: 16px;
    gap: 6px;
  }

  .b2b-title p {
    display: none; /* 모바일/태블릿에서는 긴 45자 설명문을 숨겨 헤더 버튼이 찌그러지지 않고 1열로 깔끔히 정렬 */
  }

  .app-viewport {
    padding: 14px 12px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 12px 14px;
  }

  .kpi-val {
    font-size: 20px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .btn-csv-download {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .lead-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  .lead-card {
    padding: 16px;
  }

  .b2b-modal-backdrop {
    padding: 8px;
  }

  .b2b-modal-container {
    max-height: 94vh;
  }

  .b2b-modal-header {
    padding: 12px 16px;
  }

  .b2b-modal-header h3 {
    font-size: 13.5px;
  }

  .b2b-modal-body {
    padding: 14px 12px;
    gap: 12px;
  }

  .vendor-chip-btn {
    padding: 6px 11px;
    font-size: 11px;
  }

  .script-box {
    padding: 12px;
  }

  .script-content {
    font-size: 11.5px;
  }

  .b2b-modal-footer {
    padding: 10px 14px;
  }
}

@media (max-width: 520px) {
  .b2b-header {
    padding: 8px 10px;
    gap: 6px;
  }

  .b2b-logo-badge {
    width: 34px;
    height: 34px;
    font-size: 17px;
    border-radius: 8px;
  }

  .b2b-title h1 {
    font-size: 14px;
    gap: 4px;
  }

  .b2b-title h1 span {
    font-size: 9px !important;
    padding: 1px 5px !important;
  }

  .b2b-header-actions {
    gap: 5px;
  }

  .btn-kakao-header {
    padding: 6px 9px;
    font-size: 11px;
    height: 32px;
  }

  .live-radar-pill {
    padding: 6px 8px;
    font-size: 10.5px;
    height: 32px;
  }

  .live-radar-text {
    display: none;
  }

  .live-radar-pill::after {
    content: '전국 수신';
  }
}

@media (max-width: 380px) {
  .btn-kakao-text {
    display: none;
  }

  .btn-kakao-header::after {
    content: '카톡 알림';
  }
}

/* -------------------------------------------------------------
   Option C: KakaoTalk Real-time Alert & Webhook Styles
------------------------------------------------------------- */
.btn-kakao-header {
  background: #fee500;
  color: #191919;
  border: 1px solid #e5ce00;
  padding: 7px 13px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(254, 229, 0, 0.25);
  white-space: nowrap;
  flex-shrink: 0;
  height: 34px;
}

.btn-kakao-header:hover {
  background: #fada0a;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(254, 229, 0, 0.4);
}

.btn-kakao-alert {
  flex: 1;
  background: #fee500;
  color: #191919;
  border: 1px solid #e5ce00;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-kakao-alert:hover {
  background: #fada0a;
  box-shadow: 0 0 10px rgba(254, 229, 0, 0.35);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #10b981;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(16, 185, 129, 0.3);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastFadeIn 0.3s ease forwards;
  pointer-events: auto;
}

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

.kakao-config-input {
  width: 100%;
  background: #090d16;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.kakao-config-input:focus {
  border-color: #fee500;
}
