/*
 * Wedza date picker: replaces the browser's own date popup in the Partner
 * Portal and the admin panel. Colours follow the Wedza design system tokens;
 * dark mode follows html[data-theme="dark"], which both panels set.
 */
:root {
  --wzdp-paper: #ffffff;
  --wzdp-ink: #16202e;
  --wzdp-ink-2: #3b3f4c;
  --wzdp-muted: #6b7080;
  --wzdp-line: rgba(18, 19, 26, 0.08);
  --wzdp-line-2: rgba(18, 19, 26, 0.14);
  --wzdp-on-ink: #ffffff;
  --wzdp-accent: #fe545a;
  --wzdp-accent-text: #dd444c;
  --wzdp-accent-soft: #ffeeee;
  --wzdp-accent-tint: #fff6f7;
  --wzdp-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(22, 32, 46, 0.06);
  --wzdp-display: "Bricolage Grotesque", Inter, ui-sans-serif, system-ui, sans-serif;
  --wzdp-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

html[data-theme="dark"] {
  --wzdp-paper: #171a21;
  --wzdp-ink: #eceef3;
  --wzdp-ink-2: #c5c9d3;
  --wzdp-muted: #8f95a4;
  --wzdp-line: rgba(255, 255, 255, 0.08);
  --wzdp-line-2: rgba(255, 255, 255, 0.15);
  --wzdp-on-ink: #11131a;
  --wzdp-accent-text: #fe878c;
  --wzdp-accent-soft: #45262c;
  --wzdp-accent-tint: #2c1f26;
  --wzdp-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ---------- The field ---------- */
.wzdp-wrap { position: relative; display: block; min-width: 0 }
.wzdp-wrap.inline { display: inline-block; min-width: 170px; vertical-align: middle }
/* The real input stays for forms, validation and existing code; it sits under the field, unseen. */
.wzdp-wrap > input.wzdp-native {
  position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important;
  opacity: 0 !important; pointer-events: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
}
.wzdp-field {
  display: flex !important; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  font: inherit; -webkit-appearance: none; appearance: none;
}
.wzdp-field .wzdp-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.wzdp-field .wzdp-text.is-empty { color: var(--wzdp-muted) }
.wzdp-field svg { width: 18px; height: 18px; flex: none; color: var(--wzdp-muted); transition: color .15s }
.wzdp-field:hover svg, .wzdp-field[aria-expanded="true"] svg { color: var(--wzdp-accent) }
.wzdp-field[disabled] { cursor: not-allowed; opacity: .6 }

/* ---------- The popup ---------- */
.wzdp-pop {
  position: fixed; z-index: 10060; width: 312px; padding: 14px; box-sizing: border-box;
  background: var(--wzdp-paper); color: var(--wzdp-ink); border: 1px solid var(--wzdp-line); border-radius: 20px;
  box-shadow: var(--wzdp-shadow); font-family: var(--wzdp-sans); font-size: 14px; line-height: 1.3;
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top center;
  transition: opacity .16s ease, transform .2s cubic-bezier(.2, .8, .2, 1);
}
.wzdp-pop.up { transform-origin: bottom center; transform: translateY(6px) scale(.98) }
.wzdp-pop.open { opacity: 1; transform: none }
.wzdp-pop *, .wzdp-pop *::before, .wzdp-pop *::after { box-sizing: border-box }
.wzdp-pop button { font: inherit; color: inherit; background: none; border: 0; margin: 0; cursor: pointer; -webkit-appearance: none; appearance: none }
.wzdp-pop button:focus-visible { outline: 2px solid var(--wzdp-accent); outline-offset: 2px }

.wzdp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px }
.wzdp-title {
  flex: 1; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 12px;
  font-family: var(--wzdp-display) !important; font-size: 16.5px !important; font-weight: 700 !important; letter-spacing: -.02em; text-align: left;
}
.wzdp-title svg { width: 16px; height: 16px; color: var(--wzdp-muted); transition: transform .2s }
.wzdp-title[aria-expanded="true"] svg { transform: rotate(180deg) }
.wzdp-title:hover { background: var(--wzdp-accent-tint) }
.wzdp-nav { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px !important; border: 1px solid var(--wzdp-line-2) !important; color: var(--wzdp-ink-2) !important }
.wzdp-nav:hover:not([disabled]) { background: var(--wzdp-accent-tint) !important; border-color: var(--wzdp-accent) !important; color: var(--wzdp-accent) !important }
.wzdp-nav[disabled] { opacity: .35; cursor: default }
.wzdp-nav svg { width: 17px; height: 17px }

.wzdp-dow, .wzdp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px }
.wzdp-dow span { height: 26px; display: grid; place-items: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--wzdp-muted) }
.wzdp-day {
  position: relative; height: 38px; border-radius: 12px; font-size: 14px !important; font-weight: 600 !important;
  font-variant-numeric: tabular-nums; color: var(--wzdp-ink) !important; transition: background .12s, color .12s, transform .12s;
}
.wzdp-day:hover:not([disabled]):not(.sel) { background: var(--wzdp-accent-tint) !important; color: var(--wzdp-accent-text) !important }
.wzdp-day:active:not([disabled]) { transform: scale(.94) }
.wzdp-day.out { color: var(--wzdp-muted) !important; opacity: .55; font-weight: 500 !important }
.wzdp-day.today:not(.sel) { color: var(--wzdp-accent-text) !important; box-shadow: inset 0 0 0 1.5px var(--wzdp-accent) }
.wzdp-day.sel { background: var(--wzdp-ink) !important; color: var(--wzdp-on-ink) !important }
.wzdp-day.sel::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--wzdp-accent) }
.wzdp-day.busy:not(.sel) { color: #c2410c !important; text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: color-mix(in srgb, #c2410c 55%, transparent) }
.wzdp-day.busy::before { content: ""; position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #e5484d }
.wzdp-day.busy:hover:not([disabled]):not(.sel) { background: #fdece6 !important; color: #c2410c !important }
html[data-theme="dark"] .wzdp-day.busy:not(.sel) { color: #f87171 !important }
html[data-theme="dark"] .wzdp-day.busy:hover:not([disabled]):not(.sel) { background: rgba(248, 113, 113, .14) !important }
.wzdp-legend { display: flex; justify-content: center; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--wzdp-muted) }
.wzdp-legend span { display: inline-flex; align-items: center; gap: 6px }
.wzdp-legend span::before { content: ""; width: 7px; height: 7px; border-radius: 50% }
.wzdp-legend .b::before { background: #e5484d }
.wzdp-day.limited::before { content: ""; position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b }
.wzdp-legend .p::before { background: #f59e0b }
.wzdp-legend .l::before { display: none }
.wzdp-legend .f::before { background: var(--wzdp-line-2); box-shadow: inset 0 0 0 1.5px var(--wzdp-muted) }
.wzdp-day[disabled] { opacity: .28; cursor: not-allowed; text-decoration: line-through; text-decoration-thickness: 1px }

.wzdp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0 2px }
.wzdp-month { height: 46px; border-radius: 14px; font-weight: 600 !important; color: var(--wzdp-ink) !important }
.wzdp-month:hover:not([disabled]):not(.sel) { background: var(--wzdp-accent-tint) !important; color: var(--wzdp-accent-text) !important }
.wzdp-month.now:not(.sel) { box-shadow: inset 0 0 0 1.5px var(--wzdp-accent); color: var(--wzdp-accent-text) !important }
.wzdp-month.sel { background: var(--wzdp-ink) !important; color: var(--wzdp-on-ink) !important }
.wzdp-month[disabled] { opacity: .3; cursor: not-allowed }

.wzdp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--wzdp-line) }
.wzdp-chip {
  height: 32px; padding: 0 14px !important; border-radius: 999px !important; font-size: 13px !important; font-weight: 700 !important;
  background: var(--wzdp-accent-soft) !important; color: var(--wzdp-accent-text) !important;
}
.wzdp-chip:hover:not([disabled]) { filter: brightness(.97) }
.wzdp-chip[disabled] { opacity: .4; cursor: not-allowed }
.wzdp-link { height: 32px; padding: 0 10px !important; border-radius: 999px !important; font-size: 13px !important; font-weight: 600 !important; color: var(--wzdp-muted) !important }
.wzdp-link:hover { color: var(--wzdp-ink) !important; background: var(--wzdp-accent-tint) !important }
.wzdp-picked { font-size: 12.5px; color: var(--wzdp-muted); flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }

/* Phones: a sheet from the bottom of the screen. */
.wzdp-back { position: fixed; inset: 0; z-index: 10059; background: rgba(15, 10, 16, 0.4); opacity: 0; transition: opacity .2s }
.wzdp-back.open { opacity: 1 }
@media (max-width: 560px) {
  .wzdp-pop { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: 100%; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(24px) }
  .wzdp-pop.up { transform: translateY(24px) }
  .wzdp-pop.open { transform: none }
  .wzdp-day { height: 44px }
}

/* Phone on its side: the same bottom sheet, centred, with shorter days so the whole month fits. */
@media (max-height: 500px) {
  .wzdp-pop { top: auto !important; bottom: 0 !important; width: 360px; max-height: calc(100dvh - 8px); overflow-y: auto; border-radius: 22px 22px 0 0; padding: 12px 16px calc(10px + env(safe-area-inset-bottom)); transform: translateY(24px) }
  .wzdp-pop.up { transform: translateY(24px) }
  .wzdp-pop.open { transform: none }
  .wzdp-day { height: 30px }
}
@media (max-height: 500px) and (min-width: 561px) {
  .wzdp-pop { left: calc(50% - 180px) !important; right: auto !important }
}

/* The day number and its availability label (the label shows only in the cells look below). */
.wzdp-day b { font-weight: inherit; display: block; line-height: 1.1 }
.wzdp-day .wzdp-note { display: none }

/* ---------- Partner Portal: the Partner app's calendar ----------
 * html[data-wzdp="cells"]: bigger days, each tinted by availability with a
 * short label under the number (Free, 1 left, Full), today ringed, the
 * chosen day filled coral, and a dot legend. */
html[data-wzdp="cells"] {
  --wzdp-ok: #15803d; --wzdp-ok-bg: #e8f7ee;
  --wzdp-warn: #b45309; --wzdp-warn-bg: #fef4e2;
  --wzdp-full-bg: #eef0f4;
}
html[data-wzdp="cells"][data-theme="dark"] {
  --wzdp-ok: #34d399; --wzdp-ok-bg: rgba(52, 211, 153, .14);
  --wzdp-warn: #fbbf24; --wzdp-warn-bg: rgba(251, 191, 36, .14);
  --wzdp-full-bg: #232733;
}
html[data-wzdp="cells"] .wzdp-pop { width: 392px; padding: 16px }
html[data-wzdp="cells"] .wzdp-title { justify-content: center; text-align: center }
html[data-wzdp="cells"] .wzdp-head { gap: 4px }
html[data-wzdp="cells"] .wzdp-head .wzdp-nav[data-act="prev"] { order: -1 }
html[data-wzdp="cells"] .wzdp-nav { border: 0 !important }
html[data-wzdp="cells"] .wzdp-dow span { font-size: 11px; letter-spacing: .08em }
html[data-wzdp="cells"] .wzdp-days { gap: 4px }
html[data-wzdp="cells"] .wzdp-day { height: 50px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 15px !important; font-weight: 700 !important }
html[data-wzdp="cells"] .wzdp-day .wzdp-note { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .01em; line-height: 1.1 }
html[data-wzdp="cells"] .wzdp-day.out { visibility: hidden }
html[data-wzdp="cells"] .wzdp-day::before { display: none }
html[data-wzdp="cells"] .wzdp-day.free:not(.sel) { background: var(--wzdp-ok-bg) !important; color: var(--wzdp-ink) !important }
html[data-wzdp="cells"] .wzdp-day.free .wzdp-note { color: var(--wzdp-ok) }
html[data-wzdp="cells"] .wzdp-day.limited:not(.sel) { background: var(--wzdp-warn-bg) !important; color: var(--wzdp-ink) !important }
html[data-wzdp="cells"] .wzdp-day.limited .wzdp-note { color: var(--wzdp-warn) }
html[data-wzdp="cells"] .wzdp-day.busy:not(.sel) { background: var(--wzdp-full-bg) !important; color: var(--wzdp-muted) !important }
html[data-wzdp="cells"] .wzdp-day.busy b { text-decoration: line-through; text-decoration-thickness: 1.5px }
html[data-wzdp="cells"] .wzdp-day.busy:not(.sel) { text-decoration: none }
html[data-wzdp="cells"] .wzdp-day.busy .wzdp-note { color: var(--wzdp-muted) }
html[data-wzdp="cells"] .wzdp-day.sel { background: var(--wzdp-accent) !important; color: #fff !important }
html[data-wzdp="cells"] .wzdp-day.sel .wzdp-note { color: #fff }
html[data-wzdp="cells"] .wzdp-day.sel::after { display: none }
html[data-wzdp="cells"] .wzdp-day.today:not(.sel) { box-shadow: inset 0 0 0 1.5px var(--wzdp-accent) }
html[data-wzdp="cells"] .wzdp-day[disabled] { opacity: .35; text-decoration: none }
html[data-wzdp="cells"] .wzdp-legend { gap: 14px; font-size: 11.5px }
html[data-wzdp="cells"] .wzdp-legend .f::before { background: var(--wzdp-ok); box-shadow: none }
html[data-wzdp="cells"] .wzdp-legend .p::before { background: var(--wzdp-warn) }
html[data-wzdp="cells"] .wzdp-legend .b::before { background: var(--wzdp-muted) }
@media (max-width: 560px) {
  html[data-wzdp="cells"] .wzdp-pop { width: 100% }
  html[data-wzdp="cells"] .wzdp-day { height: 54px }
}
@media (max-height: 500px) {
  html[data-wzdp="cells"] .wzdp-day { height: 36px }
  html[data-wzdp="cells"] .wzdp-day .wzdp-note { display: none }
}

@media (prefers-reduced-motion: reduce) {
  .wzdp-pop, .wzdp-pop.up, .wzdp-day, .wzdp-back { transition: opacity .12s ease !important; transform: none !important }
}
