/* =========================================================
   Uplisting Availability Calendar — v2.5.1
   ========================================================= */

.uplisting-cal {
    --primary:       #145176;
    --primary-dark:  #0d3a55;
    --primary-light: #e8f4fb;
    --range-bg:      #cce7f5;
    --range-border:  #99cfe8;
    --avail-bg:      #e6f5e6;
    --avail-hover:   #c8eac8;
    --avail-text:    #1a5c1a;
    --avail-dark:    #1a691a;
    --booked-bg:     #fde8e8;
    --booked-text:   #9b2a2a;
    --booked-border: #f5c0c0;
    --past-text:     #c4d0d8;
    --border:        #dce6ed;
    --cell-border:   #dce6ed;
    --surface:       #f8fbfd;
    --text-main:     #1e293b;
    --text-muted:    #7a96a4;
    --radius:        10px;
    font-family: inherit;
    max-width: 960px;
    margin: 0 auto;
    color: var(--text-main);
}

/* ── Navigation bar ──────────────────────────────────────── */
.ucal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}
.ucal-nav__btn {
    background: none;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 17px; line-height: 1;
    flex-shrink: 0;
    transition: background .18s, color .18s, opacity .18s;
}
.ucal-nav__btn:hover:not(:disabled) { background: var(--primary); color: #fff; }
.ucal-nav__btn:disabled { opacity: .28; cursor: default; pointer-events: none; }
.ucal-nav__center { display: flex; flex: 1; justify-content: center; align-items: center; }

.ucal-clear-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: border-color .18s, color .18s;
}
.ucal-clear-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Hint text ───────────────────────────────────────────── */
.ucal-hint {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    font-style: italic;
    color: var(--primary);
    min-height: 24px;
    margin-bottom: 12px;
}

/* ── Two-month grid ──────────────────────────────────────── */
#uplisting-months {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}
@media (max-width: 659px) {
    #uplisting-months { grid-template-columns: 1fr; gap: 28px; }
}

/* ── Single month ────────────────────────────────────────── */
.ucal-month__hdr {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: .04em;
    padding: 0 0 10px;
}

/* ── DOW row ─────────────────────────────────────────────── */
.ucal-dow-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 3px;
}
.ucal-dow {
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    padding: 5px 0;
}

/* ── Day grid ────────────────────────────────────────────── */
.ucal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

/* ── Day cell base ───────────────────────────────────────── */
.ucal-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    user-select: none;
    border: 1px solid var(--cell-border);
    border-radius: 6px;
    background: #fff;
}

.ucal-day__inner {
    position: relative;
    z-index: 2;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-main);
    transition: background .13s, color .13s;
}

/* Today dot */
.ucal-day--today .ucal-day__inner::after {
    content: '';
    position: absolute;
    bottom: 2px; left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--primary);
}

/* ── Available ───────────────────────────────────────────── */
.ucal-day--available,
.ucal-day--available-co {
    cursor: pointer;
    background: var(--avail-bg);
}
.ucal-day--available .ucal-day__inner,
.ucal-day--available-co .ucal-day__inner {
    color: var(--avail-text);
}
.ucal-day--available:hover .ucal-day__inner,
.ucal-day--available-co:hover .ucal-day__inner {
    background: var(--avail-hover);
    color: var(--avail-text);
    font-weight: 600;
}

/* ── Past / empty ────────────────────────────────────────── */
.ucal-day--past  { background: #fafbfc; }
.ucal-day--empty { background: #fafbfc; }
.ucal-day--past .ucal-day__inner,
.ucal-day--empty .ucal-day__inner { color: var(--past-text); }

/* ── Unavailable as checkin (min-stay cannot be satisfied) ──
   Green (house is free) but lighter/muted to show the date
   can't be used as a check-in due to minimum stay rules.     */
.ucal-day--unavailable-ci {
    cursor: not-allowed;
    background: #f0faf0;
    border-color: #c8e6c8;
}
.ucal-day--unavailable-ci .ucal-day__inner { color: #6aaa6a; }

/* Tooltip on unavailable-ci days */
.ucal-day--unavailable-ci[data-tooltip] {
    position: relative;
}
.ucal-day--unavailable-ci[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
/* Arrow */
.ucal-day--unavailable-ci[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
    pointer-events: none;
    z-index: 100;
}
/* Clip long tooltips on narrow screens */
@media (max-width: 480px) {
    .ucal-day--unavailable-ci[data-tooltip]:hover::after {
        white-space: normal;
        width: 160px;
        text-align: center;
    }
}

/* ── Unreachable / too-soon (inside min-nights window) ──── */
.ucal-day--unreachable .ucal-day__inner,
.ucal-day--too-soon .ucal-day__inner {
    color: var(--past-text);
}
.ucal-day--too-soon { cursor: not-allowed; }

/* ── Fully blocked interior ──────────────────────────────── */
.ucal-day--blocked {
    cursor: not-allowed;
    background: var(--booked-bg);
    border-color: var(--booked-border);
}
.ucal-day--blocked .ucal-day__inner { color: var(--booked-text); }

/* ── Available-changeover: BOTTOM-LEFT triangle = red (guests out),
   TOP-RIGHT = green (available to check in).                  */
.ucal-day--available-changeover {
    cursor: pointer;
    background: var(--avail-bg);
}
.ucal-day--available-changeover::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(
        to top right,
        var(--booked-bg) 50%,
        transparent 50%
    );
    z-index: 1;
}
.ucal-day--available-changeover .ucal-day__inner { color: var(--avail-text); }
.ucal-day--available-changeover:hover .ucal-day__inner {
    background: var(--avail-hover);
    color: var(--avail-text);
    font-weight: 600;
}

/* ── Booking-start: TOP-RIGHT triangle = red (guests arriving),
   BOTTOM-LEFT = white (morning still free = checkout point).  */
.ucal-day--booking-start {
    cursor: default;
    background: #f0faf0;
}
.ucal-day--booking-start::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(
        to bottom left,
        var(--booked-bg) 50%,
        transparent 50%
    );
    z-index: 1;
}
.ucal-day--booking-start .ucal-day__inner { color: var(--text-main); }

/* booking-start-co: same visual but selectable as checkout */
.ucal-day--booking-start-co {
    cursor: pointer;
    background: #f0faf0;
}
.ucal-day--booking-start-co::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(
        to bottom left,
        var(--booked-bg) 50%,
        transparent 50%
    );
    z-index: 1;
}
.ucal-day--booking-start-co .ucal-day__inner { color: var(--text-main); }
.ucal-day--booking-start-co:hover .ucal-day__inner {
    background: var(--avail-hover);
    color: var(--avail-text);
    font-weight: 600;
}

/* ── Booking-end: solid red (last night, guests leave tomorrow) */
.ucal-day--booking-end {
    cursor: default;
    background: var(--booked-bg);
    border-color: var(--booked-border);
}
.ucal-day--booking-end .ucal-day__inner { color: var(--booked-text); }

/* ── In range (confirmed selection) ─────────────────────── */
.ucal-day--in-range {
    background: var(--range-bg);
    border-color: var(--range-border);
}
.ucal-day--in-range .ucal-day__inner { color: var(--primary-dark); }

/* ── Hover range preview ─────────────────────────────────── */
.ucal-day--hover-range {
    background: var(--primary-light);
    border-color: var(--range-border);
}
.ucal-day--hover-range .ucal-day__inner { color: var(--primary); }

/* ── Hover end ───────────────────────────────────────────── */
.ucal-day--hover-end { cursor: pointer; }
.ucal-day--hover-end .ucal-day__inner {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    opacity: .7;
}

/* ── Check-in endpoint ───────────────────────────────────── */
.ucal-day--checkin {
    background: linear-gradient(to right, #fff 50%, var(--range-bg) 50%);
    border-color: var(--range-border);
    cursor: pointer;
}
.ucal-day--checkin .ucal-day__inner,
.ucal-day--checkin-solo .ucal-day__inner {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}
.ucal-day--checkin-solo { cursor: pointer; }

/* ── Check-out endpoint ──────────────────────────────────── */
.ucal-day--checkout {
    background: linear-gradient(to left, #fff 50%, var(--range-bg) 50%);
    border-color: var(--range-border);
    cursor: pointer;
}
.ucal-day--checkout .ucal-day__inner {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

/* ══ Bottom panel ═══════════════════════════════════════════ */
.ucal-bottom {
    border-top: 1.5px solid var(--border);
    padding-top: 28px;
}

/* ── Shared summary / pricing row style ──────────────────── */
.ucal-summary {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    margin-bottom: 16px;
}
/* Dates row: full radius, no bottom margin — pricing row will butt up below it */
.ucal-summary--first {
    border-radius: var(--radius) var(--radius) 0 0;
    margin-bottom: 0;
}
/* Pricing row directly after dates row: merge by removing top border and top radius */
.ucal-summary--first + .ucal-summary {
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 16px;
}
.ucal-summary__item {
    flex: 1;
    padding: 12px 16px;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.ucal-summary__item:last-child { border-right: none; }
.ucal-summary__item--total { background: rgba(204,231,245,0.3); }

.ucal-summary__label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
}
.ucal-summary__val {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ucal-summary__val--empty {
    color: var(--past-text);
    font-weight: 400;
    font-style: italic;
}
.ucal-summary__sub {
    font-size: 11px;
    color: #16a34a;
    margin-top: 2px;
    display: none;
}
.ucal-summary__rate {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.ucal-summary__detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Total column emphasis */
.ucal-summary__item--total .ucal-summary__val {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
}

/* ── Guest dropdown ──────────────────────────────────────── */
.ucal-controls { display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.ucal-stepper-wrap { display: flex; flex-direction: column; gap: 6px; align-items: center; margin-bottom: 10px; }
.ucal-stepper-wrap__label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--primary);
}
.ucal-guests-select {
    width: 260px;
    height: 42px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    padding: 0 12px;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-main);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-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='%23145176' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: border-color .18s, box-shadow .18s;
}
.ucal-guests-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.ucal-guests-select option[value="0"] { color: var(--past-text); }

/* ── Message ─────────────────────────────────────────────── */
.ucal-msg { font-size: 14px; font-weight: 500; margin: 8px 0 0; min-height: 20px; text-align: center; padding-bottom: 12px; }
.ucal-msg--success { color: var(--avail-dark); }
.ucal-msg--error   { color: #dc2626; }

/* ── Reserve button ──────────────────────────────────────── */
.ucal-book-btn {
    display: inline-block;
    margin-top: 20px;
    text-align: center;
    background: var(--avail-dark);
    color: #fff !important;
    text-decoration: none !important;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: background .2s, transform .12s;
}
.ucal-book-btn:hover { background: var(--primary); transform: translateY(-1px); }

/* ── Loading ─────────────────────────────────────────────── */
.ucal-loading {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 14px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 520px) {
    .ucal-summary { flex-direction: column; }
    .ucal-summary__item { border-right: none; border-bottom: 1px solid var(--border); }
    .ucal-summary__item:last-child { border-bottom: none; }
    .ucal-summary + .ucal-summary { margin-bottom: 16px; }
    .ucal-day__inner { width: 22px; height: 22px; font-size: 11px; }
    .ucal-guests-select { width: 260px; }
}
