/**
 * Villa Taradis — MotoPress calendar + booking form modernization
 *
 * Applied GLOBALLY on every page where MotoPress renders a calendar:
 *   - Single room page (sidebar)
 *   - Search shortcodes ([mphb_availability_search], [mphb_search_results])
 *   - Checkout form
 *   - Group availability calendar
 *   - Popup datepickers (attached to any input)
 *
 * IMPORTANT: Do NOT touch `display`, `width`, or `aspect-ratio` of date
 * `<a>` and `<span>` elements — kbwood-datepick's click handler relies on
 * a specific DOM structure (outer `<a class="dpTIMESTAMP">` containing an
 * optional inner `<span class="mphb-date-cell__price">`). Breaking the flex
 * model breaks clicks. We only adjust colors, borders, radius and padding.
 */

/* ---------------------------------------------------------------------------
 *  Brand tokens on every MPHB container
 * ------------------------------------------------------------------------- */
.mphb-calendar,
.datepick,
.datepick-popup,
.mphb_sc_availability-form,
.mphb-search-form,
.mphb-checkout-form {
  --villa-olive: #7A8F6A;
  --villa-olive-dark: #5d7152;
  --villa-olive-soft: rgba(122, 143, 106, 0.18);
  --villa-terra: #C7774D;
  --villa-terra-dark: #a85e38;
  --villa-terra-soft: rgba(199, 119, 77, 0.14);
  --villa-cream-50: #FAF6F1;
  --villa-cream-100: #F3EADE;
  --villa-cream-200: #E7D8C9;
  --villa-cream-500: #A89582;
  --villa-graphite: #2F2F2F;
  --villa-serif: "Cormorant Garamond", Georgia, serif;
  --villa-sans: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ===========================================================================
 *  FORM WRAPPERS (availability form, search, checkout)
 * =========================================================================== */
.mphb_sc_availability-form,
form.mphb_sc_availability-form,
.mphb-search-form,
.mphb-checkout-form {
  font-family: var(--villa-sans);
  color: var(--villa-graphite);
}

/* Labels — small, uppercase, muted */
.mphb_sc_availability-form label,
.mphb-search-form label,
.mphb-checkout-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--villa-cream-500);
  margin-bottom: 6px;
}

/* Field groups — tighter gap */
.mphb_sc_availability-form > p,
.mphb_sc_availability-form > div {
  margin: 0 0 14px 0;
}

/* Text inputs, selects — flat, modern, rounded */
.mphb_sc_availability-form input[type="text"],
.mphb_sc_availability-form input[type="number"],
.mphb_sc_availability-form input[type="email"],
.mphb_sc_availability-form input[type="tel"],
.mphb_sc_availability-form select,
.mphb-search-form input[type="text"],
.mphb-search-form input[type="number"],
.mphb-search-form select,
.mphb-checkout-form input[type="text"],
.mphb-checkout-form input[type="email"],
.mphb-checkout-form input[type="tel"],
.mphb-checkout-form input[type="number"],
.mphb-checkout-form select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background-color: #FAF6F1;
  border: 1px solid #E7D8C9;
  border-radius: 10px;
  font-family: var(--villa-sans);
  font-size: 14px;
  color: var(--villa-graphite);
  box-shadow: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
  line-height: 44px;
}

.mphb_sc_availability-form input:hover,
.mphb_sc_availability-form select:hover,
.mphb-search-form input:hover,
.mphb-search-form select:hover,
.mphb-checkout-form input:hover,
.mphb-checkout-form select:hover {
  border-color: #d9c5ad;
}

.mphb_sc_availability-form input:focus,
.mphb_sc_availability-form select:focus,
.mphb-search-form input:focus,
.mphb-search-form select:focus,
.mphb-checkout-form input:focus,
.mphb-checkout-form select:focus {
  outline: none;
  background-color: #fff;
  border-color: #7A8F6A;
  box-shadow: 0 0 0 3px rgba(122, 143, 106, 0.15);
}

/* Custom select chevron */
.mphb_sc_availability-form select,
.mphb-search-form select,
.mphb-checkout-form select {
  padding-right: 36px;
  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='%237A8F6A' 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 12px;
}

/* Submit buttons — terracotta brand CTA */
.mphb_sc_availability-form input[type="submit"],
.mphb_sc_availability-form button[type="submit"],
.mphb_sc_availability-form-check-availability,
.mphb-search-form input[type="submit"],
.mphb-search-form button[type="submit"],
.mphb-checkout-form input[type="submit"],
.mphb-checkout-form button[type="submit"] {
  width: 100%;
  height: 52px;
  margin-top: 8px;
  padding: 0 24px;
  background-color: #C7774D;
  border: 0;
  border-radius: 12px;
  font-family: var(--villa-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px -8px rgba(199, 119, 77, 0.45);
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.mphb_sc_availability-form input[type="submit"]:hover,
.mphb_sc_availability-form button[type="submit"]:hover,
.mphb_sc_availability-form-check-availability:hover,
.mphb-search-form input[type="submit"]:hover,
.mphb-search-form button[type="submit"]:hover,
.mphb-checkout-form input[type="submit"]:hover,
.mphb-checkout-form button[type="submit"]:hover {
  background-color: #a85e38;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px -10px rgba(199, 119, 77, 0.55);
}

.mphb_sc_availability-form input[type="submit"]:active,
.mphb_sc_availability-form button[type="submit"]:active {
  transform: translateY(0);
}

/* ===========================================================================
 *  CALENDAR — kbwood datepick
 *  Rules target ONLY container, nav, headers and COLORS of day cells.
 *  DO NOT alter display/width of <a> / <span> inside td (breaks clicks).
 * =========================================================================== */

/* ------- Outer container (both inline and popup) ------------------------ */
.mphb-calendar .datepick,
.datepick-popup .datepick {
  width: 100%;
  max-width: 100%;
  padding: 14px 12px 10px;
  background-color: #fff;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 10px 30px -10px rgba(47, 47, 47, 0.12);
  font-family: var(--villa-sans);
  font-size: 13px;
  color: var(--villa-graphite);
}

.datepick-popup {
  padding: 0;
  background: transparent;
  border: 0;
}

/* ------- Nav row (prev/next arrows) ------------------------------------- */
.mphb-calendar .datepick-nav,
.datepick-popup .datepick-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 10px;
  background: transparent;
  border: 0;
  border-bottom: 0;
}

.mphb-calendar .datepick-nav a,
.datepick-popup .datepick-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background-color: #FAF6F1;
  color: var(--villa-graphite);
  font-size: 0; /* hide default text label */
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.mphb-calendar .datepick-nav a:hover,
.datepick-popup .datepick-nav a:hover {
  background-color: #F3EADE;
  color: #5d7152;
}

/* Chevron glyphs via pseudo-element (no icon font needed) */
.mphb-calendar .datepick-nav .datepick-cmd-prev::before,
.datepick-popup .datepick-nav .datepick-cmd-prev::before {
  content: "";
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 3px;
}

.mphb-calendar .datepick-nav .datepick-cmd-next::before,
.datepick-popup .datepick-nav .datepick-cmd-next::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: 3px;
}

.mphb-calendar .datepick-nav a.datepick-disabled,
.datepick-popup .datepick-nav a.datepick-disabled {
  background-color: transparent;
  opacity: 0.35;
  cursor: not-allowed;
}

/* ------- Month header (Month Year) -------------------------------------- */
.mphb-calendar .datepick-month-header,
.datepick-popup .datepick-month-header {
  padding: 8px 0 14px;
  background: transparent;
  border: 0;
  border-bottom: 0;
  font-family: var(--villa-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--villa-graphite);
  text-align: center;
  text-transform: none;
  line-height: 1.2;
  height: auto;
}

.mphb-calendar .datepick-month-header select,
.mphb-calendar .datepick-month-header input,
.datepick-popup .datepick-month-header select,
.datepick-popup .datepick-month-header input {
  background: transparent;
  border: 0;
  font-family: var(--villa-serif);
  font-size: 18px;
  color: var(--villa-graphite);
  height: auto;
  padding: 2px 4px;
  width: auto;
  box-shadow: none;
}

/* ------- Month body (grid) ---------------------------------------------- */
.mphb-calendar .datepick-month,
.datepick-popup .datepick-month {
  width: 100%;
  padding: 0;
  border: 0;
}

.mphb-calendar .datepick-month table,
.datepick-popup .datepick-month table {
  width: 100%;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 2px;
}

/* Day-of-week row */
.mphb-calendar .datepick-month thead th,
.datepick-popup .datepick-month thead th {
  padding: 6px 0 8px;
  background: transparent;
  border: 0;
  font-family: var(--villa-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--villa-cream-500);
}

.mphb-calendar .datepick-month thead th a,
.datepick-popup .datepick-month thead th a {
  color: var(--villa-cream-500);
  background: transparent;
  cursor: default;
  text-decoration: none;
  box-shadow: none;
}

/* ------- Day cells: color-only rules, NO layout changes ----------------- */
.mphb-calendar .datepick-month tbody td,
.datepick-popup .datepick-month tbody td {
  padding: 0;
  background: transparent;
  border: 0;
  text-align: center;
}

/* Base style for <a> (clickable) and <span> (non-clickable) day elements.
 * We ONLY tweak color, radius, font and transition. Size/display untouched. */
.mphb-calendar .datepick-month tbody td a,
.mphb-calendar .datepick-month tbody td span,
.datepick-popup .datepick-month tbody td a,
.datepick-popup .datepick-month tbody td span {
  border: 0;
  border-radius: 999px;
  font-family: var(--villa-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--villa-graphite);
  background-color: transparent;
  text-decoration: none;
  transition: background-color 0.16s ease, color 0.16s ease;
}

/* Hover on CLICKABLE dates only (<a>) */
.mphb-calendar .datepick-month tbody td a:hover,
.datepick-popup .datepick-month tbody td a:hover {
  background-color: #F3EADE;
  color: #5d7152;
}

/* Today — subtle ring */
.mphb-calendar .datepick-month tbody td .datepick-today,
.datepick-popup .datepick-month tbody td .datepick-today {
  box-shadow: inset 0 0 0 1.5px #E7D8C9;
  font-weight: 600;
  color: var(--villa-graphite);
}

/* Selectable (available) dates — plain graphite */
.mphb-calendar .datepick-month td .mphb-selectable-date,
.datepick-popup .mphb-datepick-popup .datepick-month td .mphb-selectable-date {
  color: var(--villa-graphite);
  background-color: transparent;
}

/* Past dates */
.mphb-calendar .datepick-month td .mphb-past-date,
.datepick-popup .mphb-datepick-popup .datepick-month td .mphb-past-date {
  color: #c9bfb3;
  background-color: transparent;
  text-decoration: none;
  cursor: not-allowed;
}

/* Booked / unavailable dates — diagonal stroke */
.mphb-calendar .datepick-month td .mphb-booked-date,
.mphb-calendar .datepick-month td .mphb-mark-as-unavailable,
.datepick-popup .mphb-datepick-popup .datepick-month td .mphb-booked-date {
  color: #c7a697;
  background-image: linear-gradient(
    to top right,
    transparent calc(50% - 1px),
    #e7bfac calc(50% - 1px),
    #e7bfac calc(50% + 1px),
    transparent calc(50% + 1px)
  );
  text-decoration: none;
  cursor: not-allowed;
}

/* Out of season */
.mphb-calendar .datepick-month td .mphb-out-of-season-date {
  color: #c9bfb3;
  text-decoration: line-through;
  opacity: 0.8;
}

/* Hover-highlight (date under cursor during range pick) — olive soft */
.mphb-calendar .datepick-month td a.datepick-highlight,
.datepick-popup .datepick-month td a.datepick-highlight {
  background-color: #E7D8C9;
  color: #5d7152;
}

/* SELECTED dates (final pick) — terracotta brand accent */
.mphb-calendar .datepick-month td .datepick-selected,
.mphb-calendar .datepick-month td .mphb-selected-date,
.mphb-calendar .datepick-month td .mphb-selected-date--check-in,
.mphb-calendar .datepick-month td .mphb-selected-date--check-out,
.datepick-popup .datepick-month td .datepick-selected,
.datepick-popup .mphb-datepick-popup .datepick-month td .mphb-selected-date,
.datepick-popup .mphb-datepick-popup .datepick-month td .mphb-selected-date--check-in,
.datepick-popup .mphb-datepick-popup .datepick-month td .mphb-selected-date--check-out {
  background-color: #C7774D;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px -4px rgba(199, 119, 77, 0.5);
  text-decoration: none;
}

/* Mid-range between check-in and check-out — soft olive wash */
.mphb-calendar .datepick-month td .mphb-check-in-date,
.datepick-popup .mphb-datepick-popup .datepick-month td .mphb-check-in-date {
  background-color: rgba(122, 143, 106, 0.18);
  color: #5d7152;
  text-decoration: none;
  box-shadow: none;
}

/* Inner price span under a <a> — keep visible but small */
.mphb-calendar .datepick-month td a .mphb-date-cell__price,
.mphb-calendar .datepick-month td span .mphb-date-cell__price,
.datepick-popup .datepick-month td a .mphb-date-cell__price,
.datepick-popup .datepick-month td span .mphb-date-cell__price {
  display: block;
  font-family: var(--villa-sans);
  font-size: 9px;
  font-weight: 500;
  color: var(--villa-cream-500);
  margin-top: 1px;
  line-height: 1;
  pointer-events: none; /* never steal clicks from <a> */
}

/* ------- Control bar (Today / Clear) ------------------------------------ */
.mphb-calendar .datepick-ctrl,
.datepick-popup .datepick-ctrl {
  margin-top: 10px;
  padding: 10px 0 4px;
  background: transparent;
  border: 0;
  border-top: 1px solid #E7D8C9;
  display: flex;
  gap: 8px;
  height: auto;
  line-height: 1;
}

.mphb-calendar .datepick-ctrl::before,
.datepick-popup .datepick-ctrl::before {
  display: none;
}

.mphb-calendar .datepick-ctrl .datepick-cmd,
.datepick-popup .datepick-ctrl .datepick-cmd {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  line-height: 1;
  padding: 0 12px;
  background-color: #FAF6F1;
  border: 0;
  border-radius: 8px;
  font-family: var(--villa-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--villa-cream-500);
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
  width: auto;
}

.mphb-calendar .datepick-ctrl .datepick-cmd:hover,
.datepick-popup .datepick-ctrl .datepick-cmd:hover {
  background-color: #F3EADE;
  color: #5d7152;
}

/* Selected-dates summary ("Check-in: Fri, Apr 12 ...") */
.mphb-calendar__selected-dates,
.datepick-popup .mphb-calendar__selected-dates {
  padding: 10px 4px;
  font-family: var(--villa-sans);
  font-size: 12px;
  color: var(--villa-cream-500);
  text-align: center;
}

/* Loading overlay */
.mphb-calendar.mphb-loading::after {
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 16px;
}
