/* Attuned Ventures — site-wide "Book a call" modal.
 * Matches the dark-themed widget styling on the contact page so the
 * experience is identical wherever a "Book a call" CTA is clicked.
 * Desktop: centered modal. Mobile: bottom sheet. Body scroll locked.
 */

html.av-book-modal-lock,
body.av-book-modal-lock {
  overflow: hidden !important;
  touch-action: none;
}

/* -------- overlay + backdrop -------- */

.av-book-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  isolation: isolate;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.av-book-modal-overlay[hidden] { display: none; }

.av-book-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 10, 0);
  transition: background 0.22s ease;
  pointer-events: auto;
  z-index: 0;
}
.av-book-modal-overlay.is-open .av-book-modal-backdrop {
  background: rgba(5, 6, 10, 0.72);
}

/* -------- panel -------- */

.av-book-modal-panel {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  overflow: hidden;
  background: #111111 !important;
  color: #FFFFFF;
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.32, 1), opacity 0.18s ease;
  outline: none;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}
.av-book-modal-overlay.is-open .av-book-modal-panel {
  transform: translateY(0);
  opacity: 1;
}

/* -------- modal header -------- */

/* Top bar — real flex row at the top of the panel. Holds logo, title,
 * close. No absolute positioning magic; this is the only guaranteed-to-show
 * layout pattern. */
.av-book-modal-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #0B0B0B;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  position: relative;
  min-height: 68px;
  box-shadow: 0 1px 0 rgba(215, 39, 32, 0.18);
}
.av-book-modal-grabber {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}
.av-book-modal-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #D72720 0%, #8E0F0A 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(215, 39, 32, 0.35);
  flex-shrink: 0;
}
.av-book-modal-logo {
  width: 24px;
  height: 24px;
  display: block;
  filter: brightness(0) invert(1);
}
.av-book-modal-logo-wrap.av-book-modal-logo-fallback::after {
  content: "AV";
  font: 800 13px/1 'Inter', system-ui, sans-serif;
  color: #FFFFFF;
  letter-spacing: 0.02em;
}
.av-book-modal-brand-text {
  flex: 1;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}
.av-book-modal-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}
.av-book-modal-close:hover,
.av-book-modal-close:focus-visible {
  background: rgba(215, 39, 32, 0.2);
  border-color: rgba(215, 39, 32, 0.6);
  color: #FFFFFF;
  outline: none;
  transform: scale(1.06);
}
.av-book-modal-close:active { transform: scale(0.94); }

/* -------- scroll body -------- */

.av-book-modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px 22px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0));
  background: transparent;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.av-book-modal-body::-webkit-scrollbar { width: 8px; }
.av-book-modal-body::-webkit-scrollbar-track { background: transparent; }
.av-book-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
.av-book-modal-body::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

/* -------- widget overrides (match contact page dark theme) -------- */

.av-book-modal-body .av-booking {
  --av-primary: #D72720;
  --av-primary-hover: #B11217;
  --av-bg: #111111;
  --av-surface: rgba(255, 255, 255, 0.04);
  --av-border: rgba(255, 255, 255, 0.08);
  --av-text: #FFFFFF;
  --av-text-muted: #B8B8B8;
  --av-radius: 14px;
  --av-shadow: none;
  max-width: 100%;
  margin: 0;
  font-family: inherit;
}
.av-book-modal-body .av-booking .av-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
/* Topic picker above the widget */
.av-book-modal-body .av-book-modal-topic {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.av-book-modal-body .av-book-modal-topic-label {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #B8B8B8;
}
.av-book-modal-body .av-book-modal-topic-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  padding: 11px 38px 11px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B8B8B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}
.av-book-modal-body .av-book-modal-topic-select:hover {
  border-color: rgba(215, 39, 32, 0.4);
  background-color: rgba(255, 255, 255, 0.06);
}
.av-book-modal-body .av-book-modal-topic-select:focus {
  outline: none;
  border-color: #D72720;
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(215, 39, 32, 0.18);
}
.av-book-modal-body .av-book-modal-topic-select option {
  background: #111111;
  color: #FFFFFF;
}
[dir="rtl"] .av-book-modal-body .av-book-modal-topic-select {
  padding: 11px 14px 11px 38px;
  background-position: left 14px center;
}

/* Hide widget's internal header — the modal topbar already shows brand +
 * title, and the duration is visible via the Duration dropdown, so the
 * widget's "Intro Call / With Quinton / 60 min" block is redundant here. */
.av-book-modal-body .av-booking .av-header { display: none; }

/* Duration / Timezone dropdowns */
.av-book-modal-body .av-booking .av-controls {
  gap: 12px;
  margin-bottom: 18px;
}
.av-book-modal-body .av-booking .av-control { gap: 6px; }
.av-book-modal-body .av-booking .av-control > span {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #B8B8B8;
  text-transform: none;
  letter-spacing: normal;
}
.av-book-modal-body .av-booking .av-control select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  padding: 11px 38px 11px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B8B8B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}
[dir="rtl"] .av-book-modal-body .av-booking .av-control select {
  padding: 11px 14px 11px 38px;
  background-position: left 14px center;
}
.av-book-modal-body .av-booking .av-control select:hover {
  border-color: rgba(215, 39, 32, 0.4);
  background-color: rgba(255, 255, 255, 0.06);
}
.av-book-modal-body .av-booking .av-control select:focus {
  outline: none;
  border-color: #D72720;
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(215, 39, 32, 0.18);
}
.av-book-modal-body .av-booking .av-control select option {
  background: #111111;
  color: #FFFFFF;
}

/* Calendar */
.av-book-modal-body .av-booking .av-cal-title {
  color: #FFFFFF;
  font-weight: 600;
}
.av-book-modal-body .av-booking .av-cal-nav {
  background: rgba(255, 255, 255, 0.04);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.av-book-modal-body .av-booking .av-cal-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.av-book-modal-body .av-booking .av-cal-nav:disabled {
  opacity: 0.35;
}
.av-book-modal-body .av-booking .av-cal-dow-cell {
  color: #8A8A8A;
  font-size: 11px;
  font-weight: 600;
}
.av-book-modal-body .av-booking .av-calendar { margin-bottom: 14px; }
.av-book-modal-body .av-booking .av-cal-header { margin-bottom: 6px; }
.av-book-modal-body .av-booking .av-cal-grid { gap: 3px; }
.av-book-modal-body .av-booking .av-cal-cell {
  aspect-ratio: auto;
  height: 44px;
}
.av-book-modal-body .av-booking .av-cal-dow-cell {
  padding: 2px 0 4px;
}
.av-book-modal-body .av-booking .av-cal-day {
  background: rgba(255, 255, 255, 0.03);
  color: #FFFFFF;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
}
.av-book-modal-body .av-booking .av-cal-day:hover:not(.av-disabled) {
  background: rgba(215, 39, 32, 0.15);
  color: #FF3B30;
}
.av-book-modal-body .av-booking .av-cal-day.av-today {
  outline: 1px solid #D72720;
}
.av-book-modal-body .av-booking .av-cal-day.av-selected {
  background: #D72720;
  color: #FFFFFF;
  outline: none;
}
.av-book-modal-body .av-booking .av-cal-day.av-disabled {
  background: transparent;
  color: rgba(255, 255, 255, 0.18);
}

/* Slots */
.av-book-modal-body .av-booking .av-slots { margin-bottom: 16px; }
.av-book-modal-body .av-booking .av-slots h3 {
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.av-book-modal-body .av-booking .av-slot-grid {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 6px;
}
.av-book-modal-body .av-booking .av-slot {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.av-book-modal-body .av-booking .av-slot:hover {
  background: rgba(215, 39, 32, 0.1);
  border-color: rgba(215, 39, 32, 0.45);
  color: #FF3B30;
}
.av-book-modal-body .av-booking .av-slot.av-selected {
  background: #D72720;
  border-color: #D72720;
  color: #FFFFFF;
}
.av-book-modal-body .av-booking .av-muted {
  color: #B8B8B8;
}

/* Form */
.av-book-modal-body .av-booking .av-form {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.av-book-modal-body .av-booking .av-form h3 {
  color: #FFFFFF;
}
.av-book-modal-body .av-booking .av-form label {
  color: #B8B8B8;
}
.av-book-modal-body .av-booking input[type="text"],
.av-book-modal-body .av-booking input[type="email"],
.av-book-modal-body .av-booking textarea {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border-radius: 10px;
}
.av-book-modal-body .av-booking input::placeholder,
.av-book-modal-body .av-booking textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
.av-book-modal-body .av-booking input:focus,
.av-book-modal-body .av-booking textarea:focus {
  border-color: #D72720;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(215, 39, 32, 0.18);
}
.av-book-modal-body .av-booking .av-btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.av-book-modal-body .av-booking .av-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.av-book-modal-body .av-booking .av-attendee-list li {
  background: rgba(255, 255, 255, 0.04);
  color: #FFFFFF;
}
.av-book-modal-body .av-booking .av-chip-remove {
  color: #B8B8B8;
}
.av-book-modal-body .av-booking .av-chip-remove:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}
.av-book-modal-body .av-booking .av-submit {
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(215, 39, 32, 0.28);
}

/* Skeleton loader — dark-theme shimmer that matches the widget's built-in
 * skeleton cells. The widget renders its own skeleton synchronously at mount
 * (see av-booking.js :: viewLoading), so this override just retints the
 * shimmer for the dark modal palette. */
.av-book-modal-body .av-booking .av-skel {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 100%);
  background-size: 200% 100%;
}

/* Fallback skeleton that fills the widget area if AVBooking hasn't mounted
 * yet (edge case: user clicks before deferred scripts finish). Shown only
 * while the widget host is empty — any appended child hides it. */
.av-book-modal-widget:empty {
  display: block;
  min-height: 420px;
  background:
    /* month title bar */
    linear-gradient(90deg, rgba(255,255,255,0.08) 0, rgba(255,255,255,0.08) 140px, transparent 140px) 0 0 / 100% 22px no-repeat,
    /* two control pills */
    linear-gradient(90deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 48%, transparent 48%, transparent 52%, rgba(255,255,255,0.05) 52%) 0 56px / 100% 58px no-repeat,
    /* calendar block */
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.04)) 0 148px / 100% 260px no-repeat;
  border-radius: 12px;
  animation: av-book-modal-shimmer 1.4s ease-in-out infinite alternate;
}
@keyframes av-book-modal-shimmer {
  from { opacity: 0.55; }
  to   { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .av-book-modal-widget:empty { animation: none; opacity: 0.7; }
}

/* Confirmed view */
.av-book-modal-body .av-booking .av-confirmed h2 { color: #FFFFFF; }
.av-book-modal-body .av-booking .av-confirm-date { color: #FFFFFF; }
.av-book-modal-body .av-booking .av-confirm-time { color: #B8B8B8; }

/* Slot-fetch error panel */
.av-book-modal-body .av-booking .av-slots-error .av-error-text { color: #FF3B30; }

/* -------- responsive: desktop centered modal -------- */

@media (min-width: 640px) {
  .av-book-modal-overlay {
    align-items: center;
    padding: 24px;
  }
  .av-book-modal-panel {
    max-width: 680px;
    max-height: min(90vh, 860px);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
    transform: translateY(16px) scale(0.97);
  }
  .av-book-modal-overlay.is-open .av-book-modal-panel {
    transform: translateY(0) scale(1);
  }
  .av-book-modal-grabber { display: none; }
  .av-book-modal-topbar { padding: 16px 20px; min-height: 72px; }
  .av-book-modal-logo-wrap { width: 44px; height: 44px; }
  .av-book-modal-logo { width: 26px; height: 26px; }
  .av-book-modal-close { width: 42px; height: 42px; }
  .av-book-modal-brand-text { font-size: 16px; }
  .av-book-modal-body { padding: 22px 24px 26px; }
}

/* RTL positioning handled inline on each absolute element above */

/* -------- custom combobox (replaces native <select> in modal) -------- */

.av-book-modal-overlay .av-custom-select {
  position: relative;
  width: 100%;
}
.av-book-modal-overlay .av-custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  text-align: start;
}
.av-book-modal-overlay .av-custom-select-trigger:hover {
  border-color: rgba(215, 39, 32, 0.4);
  background-color: rgba(255, 255, 255, 0.06);
}
.av-book-modal-overlay .av-custom-select.av-open .av-custom-select-trigger,
.av-book-modal-overlay .av-custom-select-trigger:focus-visible {
  outline: none;
  border-color: #D72720;
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(215, 39, 32, 0.18);
}
.av-book-modal-overlay .av-custom-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.av-book-modal-overlay .av-custom-select-chevron {
  width: 8px;
  height: 8px;
  margin-left: 10px;
  border-right: 2px solid #B8B8B8;
  border-bottom: 2px solid #B8B8B8;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}
[dir="rtl"] .av-book-modal-overlay .av-custom-select-chevron { margin-left: 0; margin-right: 10px; }
.av-book-modal-overlay .av-custom-select.av-open .av-custom-select-chevron {
  transform: rotate(-135deg) translate(-2px, -2px);
  border-color: #D72720;
}
.av-book-modal-overlay .av-custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  padding: 6px;
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.av-book-modal-overlay .av-custom-select-menu[hidden] { display: none; }
.av-book-modal-overlay .av-custom-select-menu::-webkit-scrollbar { width: 8px; }
.av-book-modal-overlay .av-custom-select-menu::-webkit-scrollbar-track { background: transparent; }
.av-book-modal-overlay .av-custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.av-book-modal-overlay .av-custom-select-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
.av-book-modal-overlay .av-custom-select-option {
  display: block;
  width: 100%;
  text-align: start;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.av-book-modal-overlay .av-custom-select-option:hover,
.av-book-modal-overlay .av-custom-select-option:focus-visible {
  background: rgba(215, 39, 32, 0.16);
  color: #FF3B30;
  outline: none;
}
.av-book-modal-overlay .av-custom-select-option.av-selected {
  background: rgba(215, 39, 32, 0.22);
  color: #FFFFFF;
}
.av-book-modal-overlay .av-custom-select-option.av-selected:hover,
.av-book-modal-overlay .av-custom-select-option.av-selected:focus-visible {
  background: rgba(215, 39, 32, 0.32);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .av-book-modal-backdrop,
  .av-book-modal-panel { transition: none; }
  .av-book-modal-panel { transform: none !important; opacity: 1; }
}
