/* ==========================================================================
   Rental Booking — Calendar
   Mobile-first, CSS Grid, 7-column month layout
   ========================================================================== */

/* Container */
.rb-calendar-wrap {
    max-width: 480px;
    margin: 0 auto;
    font-family: inherit;
    color: var(--rb-color-text);
}

/* Header: accommodation selector + month nav */
.rb-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 8px;
    gap: 8px;
}

.rb-accommodation-select {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    font-size: 1rem;
    border: 1px solid var(--rb-color-border);
    border-radius: var(--rb-radius-button);
    background: var(--rb-color-bg-card);
    color: var(--rb-color-text);
    cursor: pointer;
    min-height: var(--rb-tap-min);
}

/* Month navigation */
.rb-month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rb-month-nav button {
    min-width: var(--rb-tap-min);
    min-height: var(--rb-tap-min);
    padding: 0 10px;
    border: 1px solid var(--rb-color-border);
    border-radius: var(--rb-radius-button);
    background: var(--rb-color-bg-card);
    color: var(--rb-color-text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.rb-month-nav button:hover {
    background: var(--rb-color-accent-light);
}

.rb-month-label {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    padding-bottom: 8px;
}

/* Weekday labels */
.rb-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.rb-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rb-color-muted);
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Calendar grid */
.rb-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

/* Day cell */
.rb-day {
    position: relative;
    aspect-ratio: 1;
    min-height: var(--rb-tap-min);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--rb-radius-card);
    border: 1px solid transparent;
    background: var(--rb-color-bg-card);
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, border-color 0.12s;
    padding: 2px;
    box-sizing: border-box;
}

.rb-day--empty {
    cursor: default;
    background: transparent;
    border-color: transparent;
}

.rb-day-number {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
}

.rb-day-price {
    font-size: var(--rb-font-size-price);
    color: var(--rb-color-muted);
    line-height: 1;
    margin-top: 2px;
}

/* States */
.rb-day--available {
    background: var(--rb-color-bg-card);
    border-color: var(--rb-color-border);
}

.rb-day--available:hover {
    border-color: var(--rb-color-accent);
    background: var(--rb-color-accent-light);
}

.rb-day--blocked {
    background: #fef2f2;
    border-color: transparent;
    cursor: not-allowed;
    opacity: 0.6;
}

.rb-day--blocked .rb-day-number {
    color: var(--rb-color-blocked);
    text-decoration: line-through;
}

.rb-day--external {
    background: #fff7ed;
    border-color: transparent;
    cursor: not-allowed;
    opacity: 0.6;
}

.rb-day--external .rb-day-number {
    color: var(--rb-color-external);
}

.rb-day--external::after {
    content: '✕';
    font-size: 0.55rem;
    position: absolute;
    top: 3px;
    right: 4px;
    color: var(--rb-color-external);
}

.rb-day--closed {
    background: #f8fafc;
    border-color: transparent;
    cursor: not-allowed;
    opacity: 0.55;
}

.rb-day--closed .rb-day-number {
    color: var(--rb-color-closed);
}

.rb-day--past {
    background: var(--rb-color-past);
    border-color: transparent;
    cursor: not-allowed;
    opacity: 0.45;
}

.rb-day--selected-start,
.rb-day--selected-end {
    background: var(--rb-color-selected);
    border-color: var(--rb-color-selected);
    color: var(--rb-color-selected-text);
}

.rb-day--selected-start .rb-day-number,
.rb-day--selected-end .rb-day-number {
    color: var(--rb-color-selected-text);
}

.rb-day--selected-start .rb-day-price,
.rb-day--selected-end .rb-day-price {
    color: var(--rb-color-selected-text);
    opacity: 0.8;
}

.rb-day--in-range {
    background: var(--rb-color-in-range);
    border-color: var(--rb-color-accent-light);
}

.rb-day--loading {
    animation: rb-pulse 1.2s ease-in-out infinite;
}

@keyframes rb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Loading overlay */
.rb-calendar-loading {
    text-align: center;
    padding: 24px;
    color: var(--rb-color-muted);
    font-size: 0.9rem;
}

/* Bottom sheet */
.rb-bottom-sheet {
    margin-top: 16px;
    border: 1px solid var(--rb-color-border);
    border-radius: var(--rb-radius-card);
    padding: 16px;
    background: var(--rb-color-bg-card);
}

.rb-bottom-sheet--empty .rb-sheet-hint {
    color: var(--rb-color-muted);
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
}

.rb-sheet-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.rb-sheet-row:last-child {
    margin-bottom: 0;
}

.rb-sheet-label {
    color: var(--rb-color-muted);
}

.rb-sheet-guest-select,
.rb-sheet-dog-select {
    padding: 4px 28px 4px 10px !important;
    font-size: 0.9rem;
    border: 1px solid var(--rb-color-border);
    border-radius: var(--rb-radius-button);
    background: var(--rb-color-bg-card);
    color: var(--rb-color-text) !important;
    cursor: pointer;
    width: auto;
    min-width: 56px;
    max-width: 80px;
    height: 36px !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    outline: none;
    box-shadow: none;
}

.rb-sheet-guest-select:focus,
.rb-sheet-dog-select:focus {
    border-color: var(--rb-color-accent);
    box-shadow: 0 0 0 3px var(--rb-color-accent-light);
}

.rb-sheet-value {
    font-weight: 600;
}

.rb-sheet-value--price {
    color: var(--rb-color-accent);
    font-size: 1.1rem;
}

.rb-sheet-row--discount .rb-sheet-value {
    color: var(--rb-color-accent);
}

.rb-sheet-cta {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    min-height: var(--rb-tap-min);
    background: var(--rb-color-accent);
    color: #fff;
    border: none;
    border-radius: var(--rb-radius-button);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
    text-decoration: none;
}

.rb-sheet-cta:hover {
    background: var(--rb-color-selected);
    color: #fff;
}

.rb-sheet-error {
    color: var(--rb-color-blocked);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Guest details form (booking step 2) */
.rb-sheet-back {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    color: var(--rb-color-muted);
    cursor: pointer;
    margin-bottom: 10px;
    display: inline-block;
}

.rb-sheet-back:hover {
    color: var(--rb-color-text);
}

.rb-sheet-form-title {
    font-weight: 600;
    margin: 0 0 12px;
    font-size: 1rem;
}

.rb-sheet-form-field {
    margin-bottom: 10px;
}

.rb-sheet-form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--rb-color-muted);
    margin-bottom: 3px;
}

.rb-sheet-form-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.9rem;
    border: 1px solid var(--rb-color-border);
    border-radius: var(--rb-radius-button);
    background: var(--rb-color-bg-card);
    color: var(--rb-color-text);
    box-sizing: border-box;
    min-height: var(--rb-tap-min);
}

textarea.rb-sheet-form-input {
    resize: vertical;
    min-height: 72px;
}

.rb-sheet-form-input:focus {
    border-color: var(--rb-color-accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--rb-color-accent-light);
}

.rb-sheet-form-error {
    display: block;
    font-size: 0.78rem;
    color: var(--rb-color-blocked);
    margin-top: 2px;
    min-height: 1em;
}

.rb-sheet-form-terms {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.rb-sheet-form-checkbox {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--rb-color-accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.rb-sheet-form-terms-label {
    font-size: 0.85rem;
    line-height: 1.4;
    cursor: pointer;
    flex: 1;
}

.rb-sheet-form-terms-label a {
    color: var(--rb-color-accent);
    text-decoration: underline;
}

/* Legend */
.rb-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--rb-color-muted);
}

.rb-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rb-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.rb-legend-dot--available  { background: var(--rb-color-bg-card); border: 1px solid var(--rb-color-border); }
.rb-legend-dot--blocked    { background: var(--rb-color-blocked); }
.rb-legend-dot--external   { background: var(--rb-color-external); }
.rb-legend-dot--closed     { background: var(--rb-color-closed); }
.rb-legend-dot--selected   { background: var(--rb-color-selected); }

/* ── Payment return page ─────────────────────────────────────── */
.rb-return-page {
    min-height: 100vh;
}

/* Hero */
.rb-return-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 120px 24px 60px;
    text-align: center;
    color: #fff;
    background: #3a7bd5;
    position: relative;
}

.rb-return-hero--confirmed { background: linear-gradient(135deg, #1a7f4e 0%, #27ae60 100%); }
.rb-return-hero--pending   { background: linear-gradient(135deg, #c07800 0%, #e6a817 100%); }
.rb-return-hero--cancelled { background: linear-gradient(135deg, #991b1b 0%, #e53e3e 100%); }
.rb-return-hero--expired   { background: linear-gradient(135deg, #4a5568 0%, #718096 100%); }
.rb-return-hero--concept   { background: linear-gradient(135deg, #1a56a0 0%, #3a7bd5 100%); }
.rb-return-hero--unknown   { background: linear-gradient(135deg, #4a5568 0%, #718096 100%); }

.rb-return-hero__inner {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.rb-return-icon {
    width: 72px;
    height: 72px;
    color: rgba(255,255,255,0.95);
    flex-shrink: 0;
}

.rb-return-icon svg {
    width: 100%;
    height: 100%;
}

.rb-return-hero__title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
    line-height: 1.2;
}

.rb-return-hero__subtitle {
    font-size: 1rem;
    margin: 0;
    color: rgba(255,255,255,0.88);
    line-height: 1.5;
    max-width: 420px;
}

/* Spinning loader for pending state */
@keyframes rb-spin {
    to { transform: rotate(360deg); }
}

.rb-return-spinner {
    animation: rb-spin 1.4s linear infinite;
    transform-origin: center;
}

/* Booking details below hero */
.rb-return-body {
    padding: 40px 24px;
    max-width: 480px;
    margin: 0 auto;
}

.rb-return-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    align-items: baseline;
}

.rb-return-details dt {
    font-weight: 600;
    color: var(--rb-color-muted, #666);
    font-size: 0.875rem;
    white-space: nowrap;
}

.rb-return-details dd {
    margin: 0;
    font-size: 0.9rem;
}

/* Second month hidden on mobile */
.rb-calendar-month--next {
    display: none;
}

/* Desktop: wider container, two-month layout */
@media (min-width: 768px) {
    .rb-calendar-wrap {
        max-width: 960px;
    }

    .rb-calendar-months {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
        align-items: start;
    }

    /* Both month grids are always 6 rows × 7 cols (42 cells).
       Explicit template makes row heights identical across both grids. */
    .rb-calendar-grid {
        grid-template-rows: repeat(6, 1fr);
    }

    .rb-calendar-month--next {
        display: block;
    }

    .rb-calendar-wrap .rb-bottom-sheet {
        position: sticky;
        top: 16px;
    }
}
