/**
 * 설치 희망자 프리미엄 UX 레이어
 * 입력 여정 · 히어로 · 체크리스트 · 웰컴 · CTA 시각 강화
 * @see docs/CUSTOMER_REPORT_DESIGN_SPEC.md
 */

/* ── Aurora backdrop (입력·결과 공통) ─────────────────────────── */

body[data-role="customer"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(ellipse 55% 45% at 8% 12%, rgba(34, 197, 94, 0.14), transparent 58%),
    radial-gradient(ellipse 50% 40% at 92% 18%, rgba(37, 99, 235, 0.16), transparent 55%),
    radial-gradient(ellipse 45% 35% at 50% 100%, rgba(251, 191, 36, 0.1), transparent 60%);
  animation: cxe-aurora-shift 18s ease-in-out infinite alternate;
}

body[data-role="customer"].view-input::before {
  opacity: 0.72;
}

body[data-role="customer"][data-result-status="approved"]::before {
  background:
    radial-gradient(ellipse 55% 45% at 10% 15%, rgba(34, 197, 94, 0.2), transparent 58%),
    radial-gradient(ellipse 50% 40% at 90% 20%, rgba(16, 185, 129, 0.12), transparent 55%),
    radial-gradient(ellipse 45% 35% at 50% 100%, rgba(52, 211, 153, 0.08), transparent 60%);
}

body[data-role="customer"][data-result-status="conditional"]::before {
  background:
    radial-gradient(ellipse 55% 45% at 10% 15%, rgba(251, 191, 36, 0.18), transparent 58%),
    radial-gradient(ellipse 50% 40% at 90% 20%, rgba(217, 119, 6, 0.12), transparent 55%);
}

body[data-role="customer"][data-result-status="rejected"]::before {
  background:
    radial-gradient(ellipse 55% 45% at 10% 15%, rgba(148, 163, 184, 0.14), transparent 58%),
    radial-gradient(ellipse 50% 40% at 90% 20%, rgba(100, 116, 139, 0.1), transparent 55%);
}

@keyframes cxe-aurora-shift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(1.5%, -1%, 0) scale(1.03); }
}

/* ── 헤더 — 글래스 + 브랜드 강조 ─────────────────────────────── */

body[data-role="customer"] > header.hero {
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.88) 100%);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 12px 40px -16px rgba(37, 99, 235, 0.18);
}

body[data-role="customer"] .hero-brand-tagline {
  color: var(--accent, #2563eb);
}

body[data-role="customer"] .page-switch {
  background: rgba(241, 245, 249, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

body[data-role="customer"] .page-btn.active {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* ── 고객 입력 — 가치 제안 헤드라인 ─────────────────────────── */

body[data-role="customer"] .customer-input-value-prop {
  margin: 0 0 1.15rem;
  padding: 0 0 1.1rem;
  border-bottom: 1px solid rgba(191, 219, 254, 0.45);
}

body[data-role="customer"] .customer-input-value-prop__title {
  margin: 0 0 0.55rem;
  font-size: clamp(1.35rem, 4.2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: #0f172a;
}

body[data-role="customer"] .customer-input-value-prop__title .customer-input-value-prop__accent {
  color: #1d4ed8;
}

body[data-role="customer"] .customer-input-value-prop__lead {
  margin: 0;
  font-size: clamp(0.92rem, 2.8vw, 1rem);
  line-height: 1.55;
  font-weight: 500;
  color: #475569;
}

/* ── 설치 유형 카드 — 글로우 강화 ───────────────────────────── */

body[data-role="customer"] .input-install-type-top {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.15rem 1.15rem;
  border-radius: var(--radius-xl, 16px);
  border: 1px solid rgba(191, 219, 254, 0.55);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.92) 100%);
  box-shadow:
    var(--crd-shadow-ambient, 0 24px 48px -12px rgba(15, 23, 42, 0.08)),
    var(--crd-shadow-contact, 0 4px 12px -2px rgba(15, 23, 42, 0.1)),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body[data-role="customer"] .customer-install-type-question {
  font-size: 1.2rem;
}

body[data-role="customer"] .customer-install-btn--active {
  animation: cxe-install-pulse 2.4s ease-in-out infinite;
}

@keyframes cxe-install-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2), 0 0 0 4px rgba(37, 99, 235, 0.14), 0 16px 36px -14px rgba(37, 99, 235, 0.35); }
  50% { box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.28), 0 0 0 6px rgba(37, 99, 235, 0.18), 0 20px 44px -12px rgba(37, 99, 235, 0.42); }
}

/* ── 주소 검색 — 바깥 패널 박스 없이 검색창·좌표조회만 ───────── */

body[data-role="customer"] #addressSearchShell,
body[data-role="customer"] #addressSearchShell.address-search-shell--above-map {
  position: relative;
  z-index: 1;
  margin: 0.35rem 0 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  scroll-margin-top: 0.85rem;
}

body[data-role="customer"] #addressSearchShell.address-search-shell--above-map:focus-within,
body[data-role="customer"] #addressSearchShell.address-search-shell--above-map.is-focused,
body[data-role="customer"] #addressSearchShell.address-search-shell--above-map.is-typing,
body[data-role="customer"] #addressSearchShell:focus-within,
body[data-role="customer"] #addressSearchShell.is-focused,
body[data-role="customer"] #addressSearchShell.is-busy {
  border: none;
  background: transparent;
  box-shadow: none;
  transform: none;
}

body[data-role="customer"] #addressSearchShell .address-search-shell__search-bar .address-search-shell__input-row {
  min-height: 3.9rem;
  padding-inline: 1.15rem 1.2rem;
  border: 2.5px solid #2563eb;
  border-radius: 14px;
  background: #fff;
  box-shadow:
    0 8px 22px rgba(37, 99, 235, 0.16),
    0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

body[data-role="customer"] #addressSearchShell .address-search-shell__search-bar .address-search-shell__input-row:hover {
  border-color: #1d4ed8;
  box-shadow:
    0 10px 26px rgba(37, 99, 235, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

body[data-role="customer"] #addressSearchShell.address-search-shell--above-map:focus-within .address-search-shell__input-row,
body[data-role="customer"] #addressSearchShell.address-search-shell--above-map.is-focused .address-search-shell__input-row,
body[data-role="customer"] #addressSearchShell.address-search-shell--above-map.is-typing .address-search-shell__input-row {
  border-color: #1d4ed8;
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.2),
    0 10px 26px rgba(37, 99, 235, 0.18);
}

body[data-role="customer"] #addressSearchShell .address-search-shell__input-icon {
  color: #1d4ed8;
  width: 1.35rem;
  height: 1.35rem;
}

body[data-role="customer"] #addressSearchShell .address-search-shell__input-icon svg {
  width: 22px;
  height: 22px;
}

body[data-role="customer"] #addressSearchShell .address-search-shell__input-row #addressInput {
  min-height: 2.7rem;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #0f172a;
}

body[data-role="customer"] #addressSearchShell .address-search-shell__input-row #addressInput::placeholder {
  font-weight: 500;
  color: #64748b;
}

body[data-role="customer"] #addressSearchShell .address-search-shell__coord-btn {
  min-height: 3.9rem;
  padding-inline: 1.2rem;
  border-width: 2.5px;
  border-color: #2563eb;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e3a8a;
  background: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.16);
}

/* ── 분석 실행 버튼 ──────────────────────────────────────────── */

body[data-role="customer"] #runBtn:not(.customer-run-btn--hidden) {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 45%, #3b82f6 100%) !important;
  border: none !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.42) !important;
}

body[data-role="customer"] #runBtn:not(.customer-run-btn--hidden)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: cxe-run-shimmer 3.5s ease-in-out infinite;
}

@keyframes cxe-run-shimmer {
  0%, 70%, 100% { transform: translateX(-120%); }
  85% { transform: translateX(120%); }
}

body[data-role="customer"] .crh-kpi-deck {
  padding: 1.1rem 1rem 1.25rem;
  background: linear-gradient(180deg, #f8fafc 0%, #f0f4f9 100%);
}

body[data-role="customer"] .crh-kpi-deck .crh-number-card {
  position: relative;
  overflow: hidden;
  transition:
    transform var(--crd-motion-fast, 150ms ease),
    box-shadow var(--crd-motion-normal, 200ms ease),
    border-color var(--crd-motion-fast, 150ms ease);
}

body[data-role="customer"] .crh-kpi-deck .crh-number-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  opacity: 0.85;
}

body[data-role="customer"] .crh-number-card--capacity::after { background: linear-gradient(90deg, #6366f1, #818cf8); }
body[data-role="customer"] .crh-number-card--cost::after { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
body[data-role="customer"] .crh-number-card--profit::after { background: linear-gradient(90deg, #059669, #34d399); }
body[data-role="customer"] .crh-number-card--payback::after { background: linear-gradient(90deg, #2563eb, #60a5fa); }

body[data-role="customer"] .crh-kpi-deck .crh-number-card[data-glance-card]:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.14);
}

body[data-role="customer"] .crh-kpi-deck .crh-number-value {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body[data-role="customer"] .crh-number-card--profit .crh-number-value {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* KPI 등장 애니메이션 */
body[data-role="customer"] .customer-result-hero[data-status]:not([data-status="idle"]) .crh-number-card {
  animation: cxe-kpi-in 0.45s ease both;
}

body[data-role="customer"] .crh-number-card--capacity { animation-delay: 0.05s; }
body[data-role="customer"] .crh-number-card--cost { animation-delay: 0.1s; }
body[data-role="customer"] .crh-number-card--profit { animation-delay: 0.15s; }
body[data-role="customer"] .crh-number-card--payback { animation-delay: 0.2s; }

@keyframes cxe-kpi-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 결과 탭 · 안내 메시지 ───────────────────────────────────── */

body[data-role="customer"] .result-switch {
  position: relative;
  z-index: 1;
  padding: 0.35rem;
  border-radius: var(--radius-full, 999px);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: var(--crd-shadow-contact, 0 4px 12px -2px rgba(15, 23, 42, 0.1));
  backdrop-filter: blur(8px);
}

body[data-role="customer"] .result-tab-btn.active {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

body[data-role="customer"] .customer-guided-message {
  position: relative;
  z-index: 1;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg, 14px);
  border: 1px solid rgba(191, 219, 254, 0.5);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.95) 0%, rgba(255, 255, 255, 0.92) 100%);
  box-shadow: var(--crd-shadow-contact, 0 4px 12px -2px rgba(15, 23, 42, 0.1));
  font-weight: 600;
  color: #334155;
}

body[data-role="customer"] #customerPdfSection.customer-pdf-block {
  margin-top: 0.5rem;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

body[data-role="customer"] .customer-new-address {
  margin-top: 0;
  padding: 1.25rem 1.15rem 1.35rem;
  border-radius: var(--radius-xl, 16px);
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: linear-gradient(165deg, #eff6ff 0%, #ffffff 55%, #f0fdf4 100%);
  box-shadow:
    0 10px 28px -8px rgba(37, 99, 235, 0.28),
    0 2px 8px rgba(15, 23, 42, 0.06);
  text-align: center;
}

body[data-role="customer"] .customer-new-address__lead {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: #1e3a8a;
  letter-spacing: -0.01em;
}

body[data-role="customer"] .customer-new-address__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 52%, #059669 100%);
  box-shadow:
    0 4px 0 rgba(15, 23, 42, 0.14),
    0 14px 28px -6px rgba(37, 99, 235, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

body[data-role="customer"] .customer-new-address__btn:hover {
  filter: brightness(1.06);
  box-shadow:
    0 5px 0 rgba(15, 23, 42, 0.16),
    0 18px 34px -6px rgba(37, 99, 235, 0.55);
  transform: translateY(-1px);
}

body[data-role="customer"] .customer-new-address__btn:active {
  transform: translateY(1px);
  box-shadow:
    0 2px 0 rgba(15, 23, 42, 0.12),
    0 8px 18px -4px rgba(37, 99, 235, 0.4);
}

body[data-role="customer"] .customer-quote-fab {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #059669 100%) !important;
}

/* ── 웰컴 모달 스텝 카드 ─────────────────────────────────────── */

.customer-welcome-modal__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0 0 1.15rem;
  padding: 0;
  list-style: none;
}

.customer-welcome-modal__step-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.45rem;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid #e2e8f0;
  background: #fff;
  text-align: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.customer-welcome-modal__step-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.customer-welcome-modal__step-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.customer-welcome-modal__step-desc {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #64748b;
}

.customer-welcome-modal__dialog {
  overflow: hidden;
}

.customer-welcome-modal__dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #059669, #2563eb, #f59e0b);
}

.customer-welcome-modal__start {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.32);
}

/* ── 모바일 ──────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .customer-welcome-modal__steps {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .customer-welcome-modal__step-card {
    flex-direction: row;
    text-align: left;
    padding: 0.65rem 0.75rem;
  }
}

body[data-role="customer"] #runBtn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  body[data-role="customer"]::before,
  body[data-role="customer"] .crh-hero-sun,
  body[data-role="customer"] .customer-install-btn--active,
  body[data-role="customer"] #runBtn:not(.customer-run-btn--hidden)::after,
  body[data-role="customer"] .crh-number-card {
    animation: none !important;
  }
}

@media print {
  body[data-role="customer"]::before {
    display: none !important;
  }
}
