/* ==========================================================================
   Rental Booking Calendar — Widget CSS
   ========================================================================== */

/* Quill-rendered HTML inside any Bootstrap modal — make images responsive
   so wide uploads don't overflow the modal width on narrow screens. Quill 2
   strips the `class` attribute on save (so adding `img-fluid` in HTML mode
   doesn't survive a round-trip), but a CSS rule scoped to the modal body
   gives us the same effect without fighting the editor. */
.modal-body img { max-width: 100%; height: auto; }

/* Responsive iframe wrapper for vetted embeds (YouTube, Vimeo, Google Maps,
   OpenStreetMap) inserted via the guest-app body editor. The class is
   stamped both client-side (the EmbedIframeBlot in admin.js) and server-
   side (App\Core\HtmlSanitiser) so existing rows pick it up on the next
   save. `aspect-ratio` keeps the iframe at 16:9 and scales fluidly to the
   container width — Bootstrap's `.ratio` utility would work too, but
   that wraps the iframe in a parent <div> which Quill's blot model can't
   easily emit. The class-on-iframe approach plays nicely with Quill's
   block-embed blot AND with the operator pasting a raw <iframe> in
   HTML mode. */
.rb-embed-frame {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
}

:root {
    --rb-primary:      #2563eb;
    --rb-primary-d:    #1d4ed8;
    --rb-range-bg:     #dbeafe;   /* light blue range strip              */
    --rb-booked:       #fee2e2;
    --rb-booked-t:     #991b1b;
    --rb-pending:      #fef9c3;
    --rb-pending-t:    #854d0e;
    --rb-blocked:      #e5e7eb;
    --rb-blocked-t:    #6b7280;
    --rb-border:       #e5e7eb;
    --rb-radius:       0.75rem;
    --rb-day-size:     40px;
}

/* ── Container ────────────────────────────────────────────────────────────── */
.rb-widget-body {
    background: transparent;
    /* Hosted-standalone layout: gentle responsive padding so the widget isn't
       flush against the viewport edges on narrow screens. */
    padding: 1.5rem 1rem 3rem;
}
.rb-widget-container {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 820px;
    margin: 0 auto;
}

/* ── Branded header (logo / title / description) ─────────────────────────── */
.rb-widget-header {
    margin-bottom: 1.5rem;
}
.rb-widget-logo {
    max-height: 100px;
    max-width: 100%;
    width: auto;
    height: auto;
    margin-bottom: 0.75rem;
}
.rb-widget-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}
.rb-widget-desc {
    margin: 0 auto;
    max-width: 640px;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ── Step indicator ──────────────────────────────────────────────────────── */
.rb-steps { counter-reset: step; }
.rb-step {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0.5rem;
    border-radius: var(--rb-radius);
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}
.rb-step.active { background: var(--rb-primary); color: #fff; }
.rb-step.done   { background: #d1fae5; color: #065f46; }

/* ── Sections ─────────────────────────────────────────────────────────────── */
.rb-section { animation: rb-fade-in 0.2s ease; }
@keyframes rb-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* ── Calendar heading ─────────────────────────────────────────────────────── */
.rb-cal-heading {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: #111;
}
.rb-cal-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

/* ── Dates bar (Airbnb-style CHECK-IN / CHECKOUT) ─────────────────────────── */
.rb-dates-bar {
    display: flex;
    border: 1.5px solid var(--rb-border);
    border-radius: var(--rb-radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.rb-dc {
    flex: 1;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.rb-dc.active {
    box-shadow: inset 0 0 0 2px var(--rb-primary);
    border-radius: calc(var(--rb-radius) - 1px);
}
.rb-dc-divider {
    width: 1px;
    background: var(--rb-border);
    flex-shrink: 0;
}
.rb-dc-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #374151;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}
.rb-dc-val {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 400;
}
.rb-dc-val:not(:empty):not([data-empty]) { color: #111; font-weight: 500; }

/* ── Calendar wrapper ─────────────────────────────────────────────────────── */
.rb-cal-wrapper {
    position: relative;
    user-select: none;
    margin-bottom: 0.5rem;
}

/* ── Navigation arrows ────────────────────────────────────────────────────── */
.rb-cal-nav {
    position: absolute;
    top: 0;
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--rb-border);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: border-color 0.15s, background 0.15s;
    padding: 0;
}
.rb-cal-nav:hover  { border-color: #9ca3af; background: #f9fafb; }
.rb-cal-nav-prev   { left: 0; }
.rb-cal-nav-next   { right: 0; }

/* ── Two-month layout ─────────────────────────────────────────────────────── */
.rb-cal-months {
    display: flex;
    gap: 2rem;
    /* leave room for the absolute-positioned arrows */
    padding: 0 40px;
}
.rb-cal-month-panel { flex: 1; min-width: 0; }

/* Hide second month on small screens */
@media (max-width: 599px) {
    .rb-cal-month-panel + .rb-cal-month-panel { display: none; }
    .rb-cal-months { padding: 0 36px; gap: 0; }
}

/* ── Month title ──────────────────────────────────────────────────────────── */
.rb-cal-month-title {
    text-align: center;
    font-weight: 600;
    font-size: 0.9375rem;
    color: #111;
    padding: 0 0 0.75rem;
    height: 32px;           /* same height as nav buttons so grid aligns */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Day grid ─────────────────────────────────────────────────────────────── */
.rb-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;          /* no gap — range strip must be continuous */
}
.rb-cal-weekday {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #9ca3af;
    padding-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rb-cal-day {
    position: relative;
    height: var(--rb-day-size);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* background used for range strip (set via classes below) */
    background: transparent;
    transition: background 0.08s;
}
/* The inner circle for the date number */
.rb-cal-day > span {
    position: relative;
    z-index: 1;
    width: var(--rb-day-size);
    height: var(--rb-day-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: background 0.12s, color 0.12s;
}

/* ── Day states ───────────────────────────────────────────────────────────── */
.rb-cal-day.empty,
.rb-cal-day.past  { cursor: default; }
.rb-cal-day.past > span        { color: #d1d5db; }
.rb-cal-day.empty > span       { visibility: hidden; }

/* Available: circle on hover */
.rb-cal-day.available:hover > span { background: #f3f4f6; }

/* Unavailable states: strikethrough */
.rb-cal-day.booked > span,
.rb-cal-day.pending > span,
.rb-cal-day.pending_checkin > span,
.rb-cal-day.pending_checkout > span,
.rb-cal-day.blocked > span,
.rb-cal-day.checkin > span,
.rb-cal-day.checkout > span {
    color: #d1d5db;
    cursor: not-allowed;
    text-decoration: line-through;
}
.rb-cal-day.booked,
.rb-cal-day.pending,
.rb-cal-day.pending_checkin,
.rb-cal-day.pending_checkout,
.rb-cal-day.blocked,
.rb-cal-day.checkin,
.rb-cal-day.checkout { cursor: not-allowed; }

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

/* ── Range selection ──────────────────────────────────────────────────────── */
/* Continuous strip for in-range days */
.rb-cal-day.in-range {
    background: var(--rb-range-bg);
}
/* Half-backgrounds connect the circle to the strip */
/* Only applied when a range actually exists (wrapper gets .has-range) */
.has-range .rb-cal-day.selected-from {
    background: linear-gradient(90deg, transparent 50%, var(--rb-range-bg) 50%);
}
.has-range .rb-cal-day.selected-to {
    background: linear-gradient(90deg, var(--rb-range-bg) 50%, transparent 50%);
}
/* Selected circles */
.rb-cal-day.selected-from > span,
.rb-cal-day.selected-to > span,
.rb-cal-day.selected-both > span {
    background: var(--rb-primary);
    color: #fff;
    font-weight: 600;
}
/* Single selected date (no range) — only the circle, no strip */
.rb-cal-day.selected-from:not(.range-active) {
    background: transparent;
}
/* Today dot override when selected */
.rb-cal-day.selected-from > span::after,
.rb-cal-day.selected-to > span::after,
.rb-cal-day.selected-both > span::after { background: #fff; }

/* ── Calendar footer (Clear dates) ───────────────────────────────────────── */
.rb-cal-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.5rem;
}
.rb-clear-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    text-decoration: underline;
    cursor: pointer;
}
.rb-clear-link:hover  { color: #111; }
.rb-clear-link.d-none { display: none !important; }

/* ── Legend ───────────────────────────────────────────────────────────────── */
.rb-legend { font-size: 0.8rem; }
.rb-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 3px;
}
.rb-dot--booked  { background: #fca5a5; }
.rb-dot--pending { background: #fde047; }
.rb-dot--blocked { background: #d1d5db; }

/* ── Guest stepper ────────────────────────────────────────────────────────── */
.rb-guests-section {
    border: 1.5px solid var(--rb-border);
    border-radius: var(--rb-radius);
    overflow: hidden;
    margin-bottom: 1rem;
}
.rb-guest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
}
.rb-guest-row + .rb-guest-row {
    border-top: 1px solid var(--rb-border);
}
.rb-guest-info { display: flex; flex-direction: column; gap: 0.1rem; }
.rb-guest-type { font-size: 0.9rem; font-weight: 500; color: #111; }
.rb-guest-age  { font-size: 0.78rem; color: #9ca3af; }

.rb-stepper {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}
.rb-stepper-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1.5px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    color: #374151;
    transition: border-color 0.12s, color 0.12s;
}
.rb-stepper-btn:hover:not(:disabled) { border-color: #374151; color: #111; }
.rb-stepper-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.rb-stepper-val {
    min-width: 1.25rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: #111;
}

/* ── Price box ────────────────────────────────────────────────────────────── */
.rb-price-box {
    border: 1.5px solid var(--rb-border);
    border-radius: var(--rb-radius);
    padding: 0.875rem 1rem;
    background: #f9fafb;
}
.rb-price-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 0.125rem 0;
}
.rb-price-row.total {
    border-top: 1px solid var(--rb-border);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
}
.rb-price-row.discount,
.rb-price-row.voucher { color: #16a34a; }

/* ── Extras ───────────────────────────────────────────────────────────────── */
.rb-extra-item {
    border: 1.5px solid var(--rb-border);
    border-radius: var(--rb-radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.rb-extra-info   { flex: 1; }
.rb-extra-name   { font-weight: 500; font-size: 0.9rem; }
.rb-extra-price  { font-size: 0.8rem; color: #6b7280; }
.rb-extra-qty    { display: flex; align-items: center; gap: 0.4rem; }
.rb-extra-qty button {
    width: 28px; height: 28px;
    border: 1px solid var(--rb-border);
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.rb-extra-qty button:hover  { background: #f3f4f6; }
.rb-extra-qty .rb-qty-val {
    min-width: 1.5rem;
    text-align: center;
    font-weight: 600;
}

/* ── Confirmation checkmark ───────────────────────────────────────────────── */
.rb-checkmark {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: #d1fae5;
    color: #065f46;
    font-size: 2rem;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
}

/* ── Payment method buttons ───────────────────────────────────────────────── */
.rb-payment-option {
    border: 2px solid var(--rb-border);
    border-radius: var(--rb-radius);
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: border-color 0.15s;
}
.rb-payment-option:hover          { border-color: var(--rb-primary); }
.rb-payment-option.selected       { border-color: var(--rb-primary); background: #eff6ff; }
.rb-payment-option .rb-pm-icon    { font-size: 1.4rem; width: 2rem; text-align: center; }
.rb-payment-option .rb-pm-label   { font-weight: 500; }
.rb-payment-option .rb-pm-desc    { font-size: 0.8rem; color: #6b7280; }

/* ── Bootstrap overrides ──────────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--rb-primary) !important;
    border-color:     var(--rb-primary) !important;
}
.btn-primary:hover {
    background-color: var(--rb-primary-d) !important;
    border-color:     var(--rb-primary-d) !important;
}
.btn-primary:disabled { opacity: 0.5; }
