/* ============================================================
   Recotex – Demo 4: 3-Path Popup
   Prefix: .d4-
   ============================================================ */

/* ── Overlay ─────────────────────────────────────────────── */
.d4-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  touch-action: none;
}
.d4-overlay.d4-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Popup (mobile-first = bottom sheet) ─────────────────── */
.d4-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: 10%;
  max-width: 100vw;
  background: #fff;
  font-family: 'DM Sans', system-ui, sans-serif;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 10001;
  overscroll-behavior: contain;
}
.d4-popup *,
.d4-popup *::before,
.d4-popup *::after {
  font-family: inherit;
}
.d4-open .d4-popup {
  transform: translateY(0);
}

/* ── Desktop: centered modal ─────────────────────────────── */
@media (min-width: 641px) {
  .d4-popup {
    top: auto;
    bottom: auto;
    left: 50%;
    right: auto;
    top: 50%;
    width: 620px;
    height: 700px;
    max-height: 88vh;
    border-radius: 24px;
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.20);
  }
  .d4-open .d4-popup {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ── Header ──────────────────────────────────────────────── */
.d4-head {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  position: relative;
}
.d4-handle {
  width: 40px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
}
@media (min-width: 641px) {
  .d4-handle { display: none; }
}
.d4-popup .d4-head-logo {
  height: 16px !important;
  width: auto !important;
  max-width: 120px !important;
  max-height: 16px !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}
.d4-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  margin-left: auto;
  color: #374151;
  transition: background 0.2s ease;
  font-family: inherit;
}
.d4-close:hover { background: #e5e7eb; }

/* ── Body ────────────────────────────────────────────────── */
.d4-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  min-height: 0;
}

/* ── Views ───────────────────────────────────────────────── */
.d4-view {
  display: none;
  padding: 24px 20px 32px;
  animation: d4-in 0.3s ease;
}
.d4-view.d4-active { display: block; }
@keyframes d4-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.d4-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1c1c1c;
  margin-bottom: 4px;
  line-height: 1.25;
}
.d4-sub {
  font-size: 0.82rem;
  color: #9ca3af;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ── Hero header ──────────────────────────────────────────── */
.d4-hero {
  background: #1A3860;
  margin: -24px -20px 20px;
  padding: 28px 24px 24px;
  position: relative;
  overflow: hidden;
}
.d4-hero::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(240, 131, 0, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.d4-hero-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffab3d;
  background: rgba(240, 131, 0, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.d4-hero-title {
  font-family: inherit;
  font-size: 1.55rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 6px;
  font-display: swap;
}
.d4-hero-sub {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  font-weight: 400;
}

.d4-bottom-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding: 12px 0 4px;
  font-size: 0.74rem;
  font-weight: 500;
  color: #9ca3af;
}
.d4-bottom-trust .d4-stars { color: #F08300; }

/* ── Back ────────────────────────────────────────────────── */
.d4-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ca3af;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 16px;
  padding: 0;
  transition: color 0.2s;
}
.d4-back:hover { color: #f08300; }

/* ── Path cards ──────────────────────────────────────────── */
.d4-paths {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.d4-path {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border: 1.5px solid #e8e6e1;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
  position: relative;
  background: #fff;
  box-shadow: 0 2px 8px rgba(26, 56, 96, 0.04);
}
.d4-path:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26, 56, 96, 0.10);
}
.d4-path:active { transform: translateY(0); }

/* Staggered entrance */
.d4-path:nth-child(1) { animation: d4-in 0.35s ease 0.05s both; }
.d4-path:nth-child(2) { animation: d4-in 0.35s ease 0.12s both; }
.d4-path:nth-child(3) { animation: d4-in 0.35s ease 0.19s both; }
.d4-path:nth-child(4) { animation: d4-in 0.35s ease 0.26s both; }

.d4-path--calc {
  border-color: #F08300;
  background: linear-gradient(135deg, #fff8f0 0%, #fff4e0 100%);
}
.d4-path--calc:hover {
  box-shadow: 0 4px 16px rgba(240, 131, 0, 0.15);
}

.d4-path--call {
  border-color: #34c759;
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f9ec 100%);
}
.d4-path--call:hover {
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.18);
}

.d4-path--ask {
  background: #f8f7f4;
  border-color: #e8e6e1;
}
.d4-path--ask:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.d4-path--quote {
  border-color: #234d87;
  background: linear-gradient(135deg, #f0f4fb 0%, #EBF2FF 100%);
}
.d4-path--quote:hover {
  box-shadow: 0 4px 16px rgba(26, 56, 96, 0.15);
}

.d4-path-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.d4-path-icon svg { width: 22px; height: 22px; }
.d4-path-icon--calc  { background: #F08300; color: #fff; }
.d4-path-icon--call  { background: #34c759; color: #fff; }
.d4-path-icon--ask   { background: #e8e6e1; color: #5c5a56; }
.d4-path-icon--quote { background: #1A3860; color: #fff; }

.d4-path-body { flex: 1; min-width: 0; }
.d4-path-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #111110;
  margin-bottom: 3px;
}
.d4-path-desc {
  font-size: 0.76rem;
  color: #5c5a56;
  line-height: 1.45;
}
.d4-path-arrow {
  color: #ccc9c2;
  flex-shrink: 0;
  transition: all 0.2s ease;
  display: grid;
  place-items: center;
}
.d4-path:hover .d4-path-arrow {
  color: #1A3860;
  transform: translateX(2px);
}

.d4-path-tag {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  background: rgba(26, 56, 96, 0.1);
  color: #1A3860;
}

/* ── Calculator choice ───────────────────────────────────── */
.d4-calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.d4-calc-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 24px 14px; border: 1.5px solid #ebebeb; border-radius: 18px;
  cursor: pointer; transition: all 0.2s; background: #fff; text-align: center;
}
.d4-calc-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07); }
.d4-calc-card[data-calc="dak"]:hover { border-color: #f08300; }
.d4-calc-card[data-calc="gevel"]:hover { border-color: #1b3d6e; }
.d4-calc-icon {
  width: 50px; height: 50px; border-radius: 9999px;
  display: grid; place-items: center;
}
.d4-calc-icon svg { width: 24px; height: 24px; }
.d4-calc-icon--dak   { background: #fff4e6; color: #f08300; }
.d4-calc-icon--gevel { background: #eaeff7; color: #1b3d6e; }
.d4-calc-name { font-size: 0.88rem; font-weight: 700; }
.d4-calc-desc { font-size: 0.7rem; color: #9ca3af; }

/* ── Calculator iframe ───────────────────────────────────── */
.d4-iframe-wrap {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
}
.d4-iframe-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
}
.d4-iframe-back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.8rem; font-weight: 600; color: #9ca3af;
  background: none; border: none; cursor: pointer;
  font-family: inherit; padding: 6px 0; transition: color 0.2s;
}
.d4-iframe-back:hover { color: #f08300; }
.d4-iframe-title { font-size: 0.8rem; font-weight: 600; color: #1c1c1c; }
.d4-iframe { flex: 1; width: 100%; border: none; display: block; min-height: 500px; }

/* ── Forms ────────────────────────────────────────────────── */
.d4-call-form { display: flex; flex-direction: column; gap: 12px; }
.d4-input {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid #ccc9c2; border-radius: 10px;
  font-family: inherit; font-size: 0.9rem;
  outline: none; transition: border-color 0.2s;
}
.d4-input:focus { border-color: #1A3860; }
.d4-input::placeholder { color: #b0ada6; }
.d4-select { color: #111110; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235c5a56' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.d4-select:invalid, .d4-select option[value=""][disabled] { color: #b0ada6; }
.d4-btn {
  width: 100%; padding: 14px 24px;
  border: none; border-radius: 12px;
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s; color: #fff;
  letter-spacing: 0.01em;
}
.d4-btn--green { background: #F08300; }
.d4-btn--green:hover { background: #c86c00; }
.d4-btn--green:disabled { opacity: 0.4; cursor: default; }
.d4-btn--blue { background: #1A3860; }
.d4-btn--blue:hover { background: #112544; }
.d4-btn--blue:disabled { opacity: 0.4; cursor: default; }
.d4-privacy { font-size: 0.68rem; color: #c0c5cc; text-align: center; }

/* ── AI chat ─────────────────────────────────────────────── */
.d4-chat { display: flex; flex-direction: column; gap: 10px; }
.d4-msg {
  max-width: 85%; padding: 11px 15px;
  border-radius: 18px; font-size: 0.84rem; line-height: 1.5;
  animation: d4-in 0.3s ease;
}
.d4-msg--bot { background: #f5f5f5; color: #1c1c1c; align-self: flex-start; border-bottom-left-radius: 6px; }
.d4-msg--user { background: #059669; color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.d4-typing {
  display: flex; gap: 4px; padding: 11px 15px;
  background: #f5f5f5; border-radius: 18px; border-bottom-left-radius: 6px;
  align-self: flex-start; animation: d4-in 0.2s ease;
}
.d4-typing span {
  width: 6px; height: 6px; background: #b0b5bc; border-radius: 50%;
  animation: d4-dot 1.2s infinite;
}
.d4-typing span:nth-child(2) { animation-delay: 0.15s; }
.d4-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes d4-dot { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-4px)} }
.d4-quick { display: flex; flex-wrap: wrap; gap: 7px; animation: d4-in 0.3s ease; }
.d4-quick-btn {
  background: #fff; border: 1.5px solid #e8e6e1;
  padding: 10px 16px; border-radius: 9999px;
  font-family: inherit; font-size: 0.8rem; font-weight: 500;
  color: #374151; cursor: pointer; transition: all 0.2s;
}
.d4-quick-btn:hover { border-color: #F08300; color: #F08300; background: #fff8f0; }
.d4-quick-btn:active { transform: scale(0.97); }

/* ── Ask form ────────────────────────────────────────────── */
.d4-ask-form { display: flex; flex-direction: column; gap: 12px; }
.d4-textarea {
  width: 100%; padding: 13px 18px; height: 100px;
  border: 1.5px solid #ebebeb; border-radius: 16px;
  font-family: inherit; font-size: 0.86rem;
  outline: none; transition: border-color 0.2s; resize: none;
}
.d4-textarea:focus { border-color: #1b3d6e; }
.d4-textarea::placeholder { color: #c8ccd2; }

/* ── Service picker ──────────────────────────────────────── */
.d4-service-pick {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.d4-service-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px; border: 1.5px solid #e8e6e1; border-radius: 14px;
  cursor: pointer; background: #fff; transition: all 0.2s;
  font-family: inherit; text-align: center;
}
.d4-service-btn svg { width: 28px; height: 28px; color: #9ca3af; transition: color 0.2s; }
.d4-service-btn span { font-size: 0.84rem; font-weight: 600; color: #5c5a56; transition: color 0.2s; }
.d4-service-btn:hover { border-color: #ccc9c2; }
.d4-service-btn.d4-service-active {
  border-color: #F08300; background: linear-gradient(135deg, #fff8f0 0%, #fff4e0 100%);
  box-shadow: 0 2px 10px rgba(240, 131, 0, 0.12);
}
.d4-service-btn.d4-service-active svg { color: #F08300; }
.d4-service-btn.d4-service-active span { color: #1A3860; }

/* ── Address autocomplete ────────────────────────────────── */
.d4-addr-wrap { position: relative; }
.d4-addr-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0; right: 0;
  background: #fff;
  border: 2px solid #F08300;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}
.d4-addr-option {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer;
  font-size: 0.86rem;
  border-bottom: 1px solid #e8e6e1;
  transition: background 0.15s;
}
.d4-addr-option:last-child { border-bottom: none; }
.d4-addr-option:hover, .d4-addr-option.active { background: #fff4e0; }
.d4-addr-pin { width: 16px; height: 16px; flex-shrink: 0; color: #F08300; }
.d4-addr-text { flex: 1; color: #111110; line-height: 1.3; }

/* ── Thank you ───────────────────────────────────────────── */
.d4-ty { text-align: center; padding: 16px 0; }
.d4-ty-icon {
  width: 56px; height: 56px; background: #ecfdf5;
  border-radius: 50%; display: grid; place-items: center;
  margin: 0 auto 16px;
}
.d4-ty-icon svg { width: 26px; height: 26px; color: #059669; }
.d4-ty-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.d4-ty-sub { font-size: 0.84rem; color: #6b7280; line-height: 1.5; }
.d4-ty-sub strong { color: #1c1c1c; }
.d4-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 16px; }
.d4-chip {
  padding: 5px 12px; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 500; background: #f5f5f5; color: #374151;
}

/* ── Inline / frame mode ────────────────────────────────── */
.d4-inline {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  max-width: 100%;
  border: 1px solid #e8e6e1;
  box-shadow: 0 4px 24px rgba(26, 56, 96, 0.08);
}
.d4-inline *,
.d4-inline *::before,
.d4-inline *::after { font-family: inherit; }
.d4-inline .d4-body {
  overflow-y: auto;
  min-height: 500px;
}
.d4-inline-head {
  padding: 14px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.d4-inline .d4-head-logo {
  height: 16px !important;
  width: auto !important;
  display: block !important;
}
