/* =========================================================
   Crossdeira Booking Plugin – Airbnb/Smily-style booking UI
   Popup-mode: opens as overlay when BOOK NOW is clicked.
   ========================================================= */
:root {
  --cd-bg: #ffffff;
  --cd-bg-soft: #f7f7f7;
  --cd-text: #222222;
  --cd-text-muted: #717171;
  --cd-border: #dddddd;
  --cd-border-strong: #b0b0b0;
  --cd-accent: #c2410c;
  --cd-accent-soft: #fff1e6;
  --cd-accent-strong: #9a3412;
  --cd-range: #fef3ec;
  --cd-blocked-bg: #ededed;
  --cd-blocked-text: #b0b0b0;
  --cd-success: #137333;
  --cd-danger: #b00020;
  --cd-shadow: 0 6px 24px rgba(0,0,0,0.08);
  --cd-radius: 14px;
  --cd-radius-sm: 8px;
  --cd-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
             Arial, "Noto Sans", sans-serif;
}

.cd-popup-overlay, .cd-popup-overlay *,
.cd-form-overlay, .cd-form-overlay *,
#cd-booking-inline, #cd-booking-inline * { box-sizing: border-box; }
.cd-popup-overlay button, .cd-form-overlay button,
#cd-booking-inline button { font-family: inherit; cursor: pointer; }

/* Inline mount on the page */
#cd-booking-inline {
  max-width: 1180px;
  margin: 0 auto;
  font-family: var(--cd-font);
  color: var(--cd-text);
  line-height: 1.4;
  padding: 0 20px;
}
#cd-booking-inline .cd-header { padding-right: 0; }

/* ===== Outer popup overlay (wraps the entire widget) ===== */
.cd-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  z-index: 2000;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}
.cd-popup-overlay.open { display: block; }

.cd-popup-shell {
  position: relative;
  max-width: 1180px;
  margin: 24px auto;
  background: var(--cd-bg-soft);
  border-radius: var(--cd-radius);
  box-shadow: 0 24px 70px rgba(0,0,0,0.3);
  font-family: var(--cd-font);
  color: var(--cd-text);
  line-height: 1.4;
}
@media (max-width: 720px) {
  .cd-popup-shell { margin: 0; border-radius: 0; min-height: 100vh; }
}

.cd-popup-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  background: white; border: 1px solid var(--cd-border);
  display: grid; place-items: center; cursor: pointer;
  z-index: 5;
  transition: all 0.15s ease;
}
.cd-popup-close:hover { background: var(--cd-bg-soft); border-color: var(--cd-text); }
.cd-popup-close svg { width: 18px; height: 18px; }

.cd-container { padding: 28px 20px 40px; }

.cd-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap; padding-right: 48px;
}
.cd-brand { display: flex; align-items: center; gap: 12px; }
.cd-brand-name { font-weight: 700; font-size: 18px; letter-spacing: 0.3px; }
.cd-brand-sub { color: var(--cd-text-muted); font-size: 13px; }
.cd-header-right { display: flex; align-items: center; gap: 14px; }
.cd-lang-switcher {
  border: 1px solid var(--cd-border);
  background: white;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--cd-text);
  cursor: pointer;
}
.cd-lang-switcher:hover { border-color: var(--cd-text); }

.cd-main {
  display: grid; grid-template-columns: 1fr 360px; gap: 28px;
  background: var(--cd-bg); border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius); padding: 28px; box-shadow: var(--cd-shadow);
}
@media (max-width: 920px) { .cd-main { grid-template-columns: 1fr; padding: 18px; } }

.cd-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cd-cal-title { font-size: 22px; font-weight: 700; margin: 0; }
.cd-cal-sub { color: var(--cd-text-muted); font-size: 14px; margin-top: 4px; }
.cd-nav { display: flex; gap: 8px; }
.cd-nav button {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--cd-border); background: white;
  transition: all 0.15s ease; display: grid; place-items: center;
}
.cd-nav button:hover:not(:disabled) { border-color: var(--cd-text); background: var(--cd-bg-soft); }
.cd-nav button:disabled { opacity: 0.35; cursor: not-allowed; }
.cd-nav svg { width: 16px; height: 16px; }

.cd-months { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 720px) { .cd-months { grid-template-columns: 1fr; gap: 24px; } }
.cd-month-title { text-align: center; font-size: 16px; font-weight: 700; margin: 0 0 14px 0; text-transform: capitalize; }
.cd-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.cd-weekday { text-align: center; font-size: 11px; color: var(--cd-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 0; }
.cd-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.cd-day {
  aspect-ratio: 1 / 1;
  border-radius: var(--cd-radius-sm);
  background: transparent;
  border: 1px solid transparent;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4px 2px;
  cursor: default;
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.cd-day-num { font-size: 15px; font-weight: 600; line-height: 1; }

.cd-day.empty { background: transparent; pointer-events: none; }

.cd-day.available { cursor: pointer; }
.cd-day.available:hover { border-color: var(--cd-text); transform: scale(1.03); }

.cd-day.blocked, .cd-day.past {
  color: var(--cd-blocked-text);
  cursor: not-allowed;
  text-decoration: line-through;
  background: var(--cd-blocked-bg);
}

.cd-day.available.checkout-only {
  background: linear-gradient(to bottom right,
    white 0%, white 48%,
    var(--cd-blocked-bg) 52%, var(--cd-blocked-bg) 100%);
  color: var(--cd-text);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--cd-border);
}
.cd-day.available.checkout-only:hover {
  border-color: var(--cd-accent);
  background: linear-gradient(to bottom right,
    var(--cd-accent-soft) 0%, var(--cd-accent-soft) 48%,
    var(--cd-blocked-bg) 52%, var(--cd-blocked-bg) 100%);
}

.cd-day.in-range { background: var(--cd-range); border-radius: 0; }
.cd-day.range-start {
  background: var(--cd-accent); color: white;
  border-radius: var(--cd-radius-sm) 0 0 var(--cd-radius-sm);
}
.cd-day.range-end {
  background: var(--cd-accent); color: white;
  border-radius: 0 var(--cd-radius-sm) var(--cd-radius-sm) 0;
}
.cd-day.range-start.range-end { border-radius: var(--cd-radius-sm); }
.cd-day.available.checkout-only.range-end {
  background: linear-gradient(to bottom right,
    var(--cd-accent) 0%, var(--cd-accent) 48%,
    var(--cd-blocked-bg) 52%, var(--cd-blocked-bg) 100%);
  color: white;
}
.cd-day.today .cd-day-num::after {
  content: ''; display: block;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--cd-accent); margin: 2px auto 0;
}
.cd-day.today.range-start .cd-day-num::after,
.cd-day.today.range-end .cd-day-num::after { background: white; }

.cd-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--cd-border);
  font-size: 12px; color: var(--cd-text-muted);
}
.cd-legend-item { display: flex; align-items: center; gap: 6px; }
.cd-swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--cd-border); }
.cd-swatch.free { background: white; }
.cd-swatch.selected { background: var(--cd-accent); border-color: var(--cd-accent); }
.cd-swatch.range { background: var(--cd-range); border-color: var(--cd-range); }
.cd-swatch.checkout-only {
  background: linear-gradient(to bottom right,
    white 0%, white 48%,
    var(--cd-blocked-bg) 52%, var(--cd-blocked-bg) 100%);
}
.cd-swatch.blocked { background: var(--cd-blocked-bg); position: relative; }
.cd-swatch.blocked::after {
  content: ''; position: absolute; left: 2px; right: 2px; top: 50%;
  height: 1px; background: var(--cd-blocked-text);
}

/* ===== Sidebar ===== */
.cd-sidebar {
  position: sticky; top: 20px; align-self: start;
  border: 1px solid var(--cd-border); border-radius: var(--cd-radius);
  padding: 22px; box-shadow: var(--cd-shadow); background: white;
}
@media (max-width: 920px) { .cd-sidebar { position: static; } }
.cd-price-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 14px; }
.cd-price-head .price { font-size: 22px; font-weight: 700; }
.cd-price-head .per { color: var(--cd-text-muted); font-size: 14px; }

.cd-date-pickers {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--cd-border-strong); border-radius: var(--cd-radius-sm);
  overflow: hidden; margin-bottom: 6px;
}
.cd-date-cell { padding: 10px 12px; border-right: 1px solid var(--cd-border); }
.cd-date-cell:last-child { border-right: none; }
.cd-date-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--cd-text); }
.cd-date-time { font-size: 10px; color: var(--cd-text-muted); font-weight: 500; margin-top: 1px; }
.cd-date-value { margin-top: 4px; font-size: 14px; color: var(--cd-text-muted); }
.cd-date-value.set { color: var(--cd-text); font-weight: 500; }

.cd-summary { margin-top: 14px; }
.cd-summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.cd-summary-row.total {
  border-top: 1px solid var(--cd-border);
  margin-top: 10px; padding-top: 12px;
  font-weight: 700; font-size: 16px;
}
.cd-summary-empty { color: var(--cd-text-muted); font-size: 13px; padding: 10px 0 4px; }

.cd-cta {
  display: block; width: 100%; padding: 14px; margin-top: 16px;
  background: linear-gradient(135deg, var(--cd-accent), #ea580c);
  color: white; border: none; border-radius: var(--cd-radius-sm);
  font-size: 16px; font-weight: 700;
  transition: all 0.15s ease;
}
.cd-cta:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(194, 65, 12, 0.25); }
.cd-cta:disabled { opacity: 0.55; cursor: not-allowed; background: var(--cd-text-muted); }
.cd-reset {
  margin-top: 10px; background: transparent; border: none;
  color: var(--cd-text-muted); font-size: 13px;
  text-decoration: underline; width: 100%; padding: 6px;
}
.cd-reset:hover { color: var(--cd-text); }

.cd-hint {
  margin-top: 14px; padding: 10px 12px;
  background: var(--cd-accent-soft); border-radius: var(--cd-radius-sm);
  font-size: 13px; color: var(--cd-accent-strong);
}
.cd-hint.warn { background: #fef2f2; color: var(--cd-danger); }

/* ===== Inner form modal ===== */
.cd-form-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none; align-items: center; justify-content: center;
  z-index: 2100; padding: 20px;
}
.cd-form-overlay.open { display: flex; }
.cd-form-modal {
  background: white; border-radius: var(--cd-radius);
  max-width: 520px; width: 100%; padding: 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.3);
  max-height: 90vh; overflow-y: auto;
  font-family: var(--cd-font);
  color: var(--cd-text);
}
.cd-form-modal h2 { margin: 0 0 6px; font-size: 22px; }
.cd-form-modal .desc { color: var(--cd-text-muted); font-size: 14px; margin: 0 0 18px; }
.cd-form-row { margin-bottom: 14px; }
.cd-form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.cd-form-row input, .cd-form-row textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--cd-border); border-radius: var(--cd-radius-sm);
  font-size: 14px; font-family: inherit;
  transition: border-color 0.15s ease;
}
.cd-form-row input:focus, .cd-form-row textarea:focus {
  outline: none; border-color: var(--cd-accent);
  box-shadow: 0 0 0 3px rgba(194,65,12,0.15);
}
.cd-form-row textarea { resize: vertical; min-height: 80px; }
.cd-recap {
  background: var(--cd-bg-soft); padding: 16px;
  border-radius: var(--cd-radius-sm); margin-bottom: 18px; font-size: 14px;
}
.cd-recap-row { display: flex; justify-content: space-between; padding: 3px 0; }
.cd-recap-row.total {
  font-weight: 700; border-top: 1px solid var(--cd-border);
  margin-top: 6px; padding-top: 8px;
}
.cd-consent {
  display: flex; gap: 8px; font-size: 13px;
  margin: 4px 0 14px; align-items: flex-start;
}
.cd-consent input { width: auto; margin-top: 3px; }
.cd-consent a { color: var(--cd-accent); }

.cd-modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.cd-modal-actions button {
  flex: 1; padding: 12px;
  border-radius: var(--cd-radius-sm); font-size: 15px;
  font-weight: 600; border: 1px solid var(--cd-border);
  background: white; transition: all 0.15s ease;
  text-align: center; color: var(--cd-text);
}
.cd-modal-actions .primary { background: var(--cd-accent); color: white; border-color: var(--cd-accent); }
.cd-modal-actions .primary:hover:not(:disabled) { background: var(--cd-accent-strong); }
.cd-modal-actions .primary:disabled { opacity: 0.6; cursor: wait; }
.cd-modal-actions .ghost:hover { background: var(--cd-bg-soft); }
.cd-error { color: var(--cd-danger); font-size: 13px; margin-top: 4px; }

.cd-success-screen { text-align: center; padding: 10px 0 4px; }
.cd-success-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: #e6f4ea; color: var(--cd-success);
  display: grid; place-items: center; margin: 0 auto 14px;
}
.cd-success-icon svg { width: 32px; height: 32px; }

/* Spinner */
.cd-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; vertical-align: -2px;
  animation: cd-spin 0.7s linear infinite; margin-right: 8px;
}
@keyframes cd-spin { to { transform: rotate(360deg); } }

.cd-loading {
  text-align: center; padding: 60px 20px;
  color: var(--cd-text-muted); font-size: 14px;
}
