/* SteigenFlow Overlays — Cookie Banner + Lead Capture Modal
   Loaded on every page. Depends on tokens.css for --sf-* variables.
   ─────────────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════════
   COOKIE BANNER
   ═══════════════════════════════════════════════════════════════ */

#sf-cookie {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 980;
  background: rgba(8, 13, 27, 0.97);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 18px 40px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: #fff;
  transform: translateY(0);
  transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2px emerald line — brand signature */
#sf-cookie::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #10B981;
}

#sf-cookie.is-hidden {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

.sf-cookie-mark {
  flex-shrink: 0;
  width: 3px;
  height: 36px;
  background: #10B981;
  border-radius: 2px;
}

.sf-cookie-text {
  flex: 1;
  min-width: 0;
}

.sf-cookie-text strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
  color: #fff;
}

.sf-cookie-text p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
  margin: 0;
}

.sf-cookie-text a {
  color: #10B981;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 180ms ease;
}

.sf-cookie-text a:hover { color: #34D399; }

.sf-cookie-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.sf-cookie-accept,
.sf-cookie-decline {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 7px;
  transition: opacity 200ms ease, transform 200ms ease, background 200ms ease;
  letter-spacing: -0.01em;
}

.sf-cookie-accept {
  background: #10B981;
  color: #fff;
  height: 38px;
  padding: 0 20px;
}

.sf-cookie-accept:hover {
  background: #059669;
  transform: translateY(-1px);
}

.sf-cookie-decline {
  background: transparent;
  color: rgba(255, 255, 255, 0.42);
  height: 38px;
  padding: 0 12px;
}

.sf-cookie-decline:hover {
  color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 640px) {
  #sf-cookie {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 20px 28px;
    gap: 14px;
  }

  .sf-cookie-mark { display: none; }

  .sf-cookie-actions {
    width: 100%;
  }

  .sf-cookie-accept {
    flex: 1;
    justify-content: center;
    display: flex;
    align-items: center;
    text-align: center;
  }
}


/* ═══════════════════════════════════════════════════════════════
   LEAD CAPTURE MODAL
   ═══════════════════════════════════════════════════════════════ */

#sf-lead-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 13, 27, 0.80);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

#sf-lead-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

#sf-lead-modal {
  background: #fff;
  color: #0F172A;
  border-radius: 22px;
  width: 100%;
  max-width: 500px;
  padding: 40px;
  position: relative;
  transform: translateY(24px) scale(0.97);
  transition: transform 380ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow:
    0 40px 100px rgba(8, 13, 27, 0.36),
    0 0 0 1px rgba(8, 13, 27, 0.06);
  max-height: 90vh;
  overflow-y: auto;
}

#sf-lead-overlay.is-open #sf-lead-modal {
  transform: translateY(0) scale(1);
}

/* 4px emerald stripe — matches brand signature */
.sf-lead-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #059669;
  border-radius: 22px 22px 0 0;
}

/* Close button */
.sf-lead-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  background: #F1F5F9;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  font-family: inherit;
  transition: background 180ms ease, color 180ms ease;
  flex-shrink: 0;
}

.sf-lead-close:hover {
  background: #E2E8F0;
  color: #0F172A;
}

/* Header */
.sf-lead-eyebrow {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #059669;
  font-weight: 500;
  margin-bottom: 10px;
  padding-right: 40px;
}

.sf-lead-title {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: #0F172A;
  margin-bottom: 6px;
}

.sf-lead-sub {
  font-size: 13px;
  color: #64748B;
  line-height: 1.55;
  margin-bottom: 26px;
}

/* Form */
.sf-lead-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sf-lead-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.sf-lead-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sf-lead-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #475569;
}

.sf-lead-label .req {
  color: #059669;
  margin-left: 1px;
}

.sf-lead-input,
.sf-lead-select {
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: #0F172A;
  background: #fff;
  transition: border-color 200ms ease, box-shadow 200ms ease;
  outline: none;
  width: 100%;
}

.sf-lead-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
  color: #0F172A;
}

.sf-lead-select option[value=""] { color: #94A3B8; }

.sf-lead-input:focus,
.sf-lead-select:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.sf-lead-input::placeholder {
  color: #CBD5E1;
}

.sf-lead-input.sf-error,
.sf-lead-select.sf-error {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

/* Submit */
.sf-lead-submit {
  margin-top: 6px;
  height: 48px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 200ms ease, transform 200ms ease, opacity 200ms ease;
  width: 100%;
}

.sf-lead-submit:hover {
  background: #047857;
  transform: translateY(-1px);
}

.sf-lead-submit:active { transform: translateY(0); }

.sf-lead-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.sf-lead-submit .sf-arrow {
  display: inline-block;
  transition: transform 200ms ease;
}

.sf-lead-submit:hover:not(:disabled) .sf-arrow {
  transform: translateX(3px);
}

/* Skip */
.sf-lead-skip {
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  color: #94A3B8;
  line-height: 1.5;
}

.sf-lead-skip a {
  color: #94A3B8;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 180ms ease;
}

.sf-lead-skip a:hover { color: #475569; }

/* Sending state */
.sf-lead-sending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  color: #64748B;
  font-size: 13px;
  gap: 16px;
}

.sf-lead-spinner {
  width: 30px;
  height: 30px;
  border: 2px solid #E2E8F0;
  border-top-color: #059669;
  border-radius: 50%;
  animation: sf-spin 650ms linear infinite;
  flex-shrink: 0;
}

@keyframes sf-spin {
  to { transform: rotate(360deg); }
}

.sf-lead-privacy {
  font-size: 12px;
  color: #64748b;
  margin: 12px 0 0;
  line-height: 1.5;
}
.sf-lead-privacy a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Mobile */
@media (max-width: 560px) {
  #sf-lead-modal {
    padding: 32px 20px;
    border-radius: 18px;
  }

  .sf-lead-row {
    grid-template-columns: 1fr;
  }

  .sf-lead-title { font-size: 20px; }
}


/* ═══════════════════════════════════════════════════════════════
   CAL.COM INLINE EMBED OVERLAY
   Phase 2: opens after the lead form submits.
   Cal.com injects an <iframe> into #sf-cal-embed — this overlay
   is never blocked by popup-blockers because it is part of the page.
   ═══════════════════════════════════════════════════════════════ */

#sf-cal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1010;
  background: rgba(8, 13, 27, 0.86);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

#sf-cal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

#sf-cal-panel {
  background: #fff;
  color: #0F172A;
  border-radius: 24px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: translateY(32px) scale(0.97);
  transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow:
    0 56px 140px rgba(8, 13, 27, 0.48),
    0 0 0 1px rgba(8, 13, 27, 0.06);
}

#sf-cal-overlay.is-open #sf-cal-panel {
  transform: translateY(0) scale(1);
}

/* 4px emerald top stripe — brand signature */
.sf-cal-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #059669;
  border-radius: 24px 24px 0 0;
  z-index: 1;
}

/* Header */
.sf-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px 20px;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
  margin-top: 4px;
}

.sf-cal-header-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sf-cal-eyebrow {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #059669;
  font-weight: 500;
}

.sf-cal-headline {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: #0F172A;
  line-height: 1.2;
}

/* Close button */
.sf-cal-close {
  width: 32px;
  height: 32px;
  background: #F1F5F9;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  font-family: inherit;
  transition: background 180ms ease, color 180ms ease;
  flex-shrink: 0;
}

.sf-cal-close:hover {
  background: #E2E8F0;
  color: #0F172A;
}

/* Body — scrollable, contains the Cal iframe */
.sf-cal-body {
  flex: 1;
  overflow-y: auto;
  min-height: 520px;
}

#sf-cal-embed {
  width: 100%;
  min-height: 520px;
}

/* Cal.com injects a wrapper div + iframe — ensure both fill the container */
#sf-cal-embed > div,
#sf-cal-embed iframe {
  width: 100% !important;
  min-height: 520px !important;
  border: none !important;
  display: block !important;
}

/* Mobile — slide up from bottom */
@media (max-width: 640px) {
  #sf-cal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  #sf-cal-panel {
    border-radius: 24px 24px 0 0;
    max-height: 92vh;
    transform: translateY(100%);
  }

  #sf-cal-overlay.is-open #sf-cal-panel {
    transform: translateY(0);
  }

  .sf-cal-header {
    padding: 24px 20px 16px;
  }

  .sf-cal-headline {
    font-size: 16px;
  }
}
