/* ==========================================================================
   Availability calendar and the selection bar. Loaded only where needed.
   ========================================================================== */

.cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--color-ink-muted);
}

.cal-legend li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}

.cal-swatch {
    width: 0.95rem;
    height: 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong);
}

.cal-swatch--free { background-color: var(--color-surface-raised); }
.cal-swatch--booked { background-color: var(--color-border-strong); border-color: var(--color-ink-faint); }
.cal-swatch--selected { background-color: var(--color-terracotta); border-color: var(--color-terracotta); }

.cal-hint {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-ink-soft);
}

.cal-hint__icon {
    width: 1rem;
    height: 1rem;
    color: var(--color-terracotta);
}

.cal-hint--nojs {
    margin-bottom: var(--space-8);
    color: var(--color-ink-muted);
}

/* --- Month grid ---------------------------------------------------------- */

.cal-months {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
    gap: var(--space-8);
}

.cal-month__name {
    margin-bottom: var(--space-3);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-ink-muted);
}

.cal-grid {
    table-layout: fixed;
    /* Collapsed borders would merge the day cells into one grey mesh; separate keeps each
       day a distinct box, which is what makes a range readable at a glance. */
    border-collapse: separate;
    border-spacing: 2px;
}

.cal-grid th {
    padding-bottom: var(--space-1);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-ink-faint);
    text-align: center;
}

.cal-day {
    padding: 0;
    text-align: center;
    /* Square cells whatever the column width. */
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.cal-day--blank {
    background: none;
}

.cal-day__hit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
}

.cal-day--free {
    background-color: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    color: var(--color-ink);
}

.cal-day--free .cal-day__hit {
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-out),
                color var(--duration-fast) var(--ease-out);
}

.cal-day--free .cal-day__hit:hover {
    background-color: var(--color-terracotta-tint);
    color: var(--color-terracotta-dark);
}

.cal-day--booked {
    background-color: var(--color-border-strong);
    border: 1px solid var(--color-border-strong);
    color: var(--color-ink-muted);
    /* Diagonal hatch, so "booked" survives being printed or seen without colour. */
    background-image: repeating-linear-gradient(
        45deg,
        rgb(255 255 255 / 0.35) 0 2px,
        transparent 2px 5px
    );
}

.cal-day--past {
    background-color: transparent;
    border-color: transparent;
    color: var(--color-ink-faint);
    opacity: 0.55;
}

/* Someone leaves this morning, the next guest may arrive the same afternoon. A corner
   marker rather than a separate colour — it is a nuance, not a fourth state. */
.cal-day--turnover {
    background-image: linear-gradient(
        135deg,
        var(--color-sand-deep) 0 45%,
        var(--color-surface-raised) 45%
    );
}

/* While a departure is being chosen, the changeover day — the first taken night after the
   arrival — is a valid departure even though it is booked. Marked so it does not look inert. */
.cal-day--departure-ok {
    cursor: pointer;
    box-shadow: inset 0 0 0 2px var(--color-terracotta);
}

.cal-day--departure-ok .cal-day__hit {
    cursor: pointer;
}

.cal-day--selected {
    background-color: var(--color-terracotta-tint);
    border-color: var(--color-terracotta-light);
    color: var(--color-terracotta-dark);
    background-image: none;
}

.cal-day--edge {
    background-color: var(--color-terracotta);
    border-color: var(--color-terracotta);
    color: #fff;
    font-weight: 600;
}

.cal-day--edge .cal-day__hit:hover {
    background-color: var(--color-terracotta-dark);
    color: #fff;
}

/* --- Blättern ------------------------------------------------------------ */

.cal-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

/* Hält den Zeitraum in der Mitte, auch wenn nur ein Pfeil da ist. */
.cal-pager__spacer {
    flex: 0 0 auto;
    width: 1px;
}

.cal-pager__label {
    font-weight: 600;
    text-align: center;
}

/* Der Chevron zeigt nach unten; für die Pfeile wird er gedreht. Ohne Maßangabe
   nimmt ein Inline-SVG die Browser-Vorgabe von 300x150 an. */
.cal-pager__icon {
    width: 0.7rem;
    height: 0.7rem;
    flex-shrink: 0;
}

.cal-pager__icon--prev { transform: rotate(90deg); }
.cal-pager__icon--next { transform: rotate(-90deg); }

@media (max-width: 30rem) {
    .cal-pager__label {
        font-size: var(--text-sm);
    }
}

/* --- Selection bar ------------------------------------------------------- */

.quote-bar {
    position: sticky;
    bottom: 0;
    /* Seitenmöbel — muss unter der Abdunklung des offenen Menüs bleiben. */
    z-index: var(--z-sticky);
    padding-block: var(--space-4);
    background-color: var(--color-surface-raised);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -6px 24px rgb(43 38 34 / 0.1);
}

.quote-bar[hidden] {
    display: none;
}

.quote-bar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4) var(--space-8);
}

.quote-bar__dates {
    display: flex;
    flex-direction: column;
}

.quote-bar__range {
    font-weight: 600;
}

.quote-bar__nights {
    font-size: var(--text-sm);
    color: var(--color-ink-muted);
}

.quote-bar__price {
    display: flex;
    flex-direction: column;
    /* Grows so the price sits between the dates and the buttons rather than crowding one. */
    flex: 1 1 12rem;
}

.quote-bar__total {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: 1.1;
}

.quote-bar__note {
    font-size: var(--text-xs);
    color: var(--color-ink-muted);
}

.quote-bar__note--problem {
    color: var(--color-danger);
    font-size: var(--text-sm);
}

.quote-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 40rem) {
    .quote-bar__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .quote-bar__actions .btn {
        flex: 1 1 auto;
    }
}
