/* ReservationKey Availability Calendar — Frontend Styles */

:root {
    /* Osborne's Inn palette — Twenty Twenty-Four theme */
    --rk-primary: #111111;
    --rk-primary-hover: #636363;
    --rk-available: #5a7a4e;
    --rk-available-bg: #d4e4cb;
    --rk-unavailable: #b54a2a;
    --rk-unavailable-bg: #f6ddd3;
    --rk-restricted: #8a6f4f;
    --rk-restricted-bg: #e8d8c4;
    --rk-border: #cfcabe;
    --rk-text: #111111;
    --rk-muted: #636363;
    --rk-bg: #f9f9f9;
    --rk-surface: #ffffff;
    --rk-shadow: 0 1px 3px rgba(17,17,17,0.08);
    --rk-font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --rk-font-heading: "Cardo", Georgia, "Times New Roman", serif;
    --rk-radius: 0.33rem;
}

.rk-calendar-widget * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.rk-calendar-widget {
    font-family: var(--rk-font-body);
    color: var(--rk-text);
    background: var(--rk-bg);
    border-radius: var(--rk-radius);
    box-shadow: var(--rk-shadow);
    overflow: hidden;
}

/* ── Multi-month layout ── */
.rk-cal-months {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.rk-cal-month {
    flex: 1 1 320px;
    min-width: 280px;
}

/* ── Header / Month Navigation ── */
.rk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--rk-primary);
    color: #f9f9f9;
}

.rk-header h3 {
    font-family: var(--rk-font-heading);
    font-size: 1.15rem;
    font-weight: 400;
    font-style: italic;
    text-transform: capitalize;
    margin: 0;
    letter-spacing: 0.01em;
}

.rk-nav-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    color: #f9f9f9;
    width: 34px;
    height: 34px;
    border-radius: var(--rk-radius);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.rk-nav-btn:hover { background: rgba(255,255,255,0.25); }
.rk-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Prevent parent overlays from blocking interactions */
.rk-calendar-widget,
.rk-calendar-widget *,
.rk-cal-shell,
.rk-cal-shell button,
.rk-cal-shell select,
.rk-cal-shell input {
    pointer-events: auto !important;
    user-select: auto !important;
    touch-action: auto !important;
}

.rk-calendar-widget {
    position: relative !important;
    z-index: 2147483647 !important;
    isolation: isolate !important;
    transform: translateZ(0) !important;
    will-change: transform !important;
}

.rk-cal-shell .rk-controls,
.rk-cal-shell .rk-header,
.rk-cal-shell .rk-legend,
.rk-cal-shell .rk-cal-months {
    position: relative !important;
    z-index: 2147483647 !important;
}

.rk-cal-shell .rk-nav-btn,
.rk-cal-shell .rk-refresh-btn,
.rk-cal-shell .rk-adults-select,
.rk-cal-shell .rk-children-select,
.rk-cal-shell .rk-room-select {
    position: relative !important;
    z-index: 2147483647 !important;
    cursor: pointer !important;
}

/* ── Controls ── */
.rk-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 18px;
    border-bottom: 1px solid var(--rk-border);
    align-items: center;
}

.rk-control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.rk-control-group label {
    color: var(--rk-muted);
    font-weight: 500;
}

.rk-control-group select {
    padding: 5px 8px;
    border: 1px solid var(--rk-border);
    border-radius: var(--rk-radius);
    font-size: 0.85rem;
    background: var(--rk-surface);
    color: var(--rk-text);
}

.rk-refresh-btn {
    margin-left: auto;
    padding: 6px 16px;
    background: var(--rk-primary);
    color: #f9f9f9;
    border: 1px solid var(--rk-primary);
    border-radius: var(--rk-radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}
.rk-refresh-btn:hover {
    background: var(--rk-primary-hover);
    border-color: var(--rk-primary-hover);
}

/* ── Legend ── */
.rk-legend {
    display: flex;
    gap: 16px;
    padding: 8px 18px;
    font-size: 0.78rem;
    color: var(--rk-muted);
    border-bottom: 1px solid var(--rk-border);
    flex-wrap: wrap;
}
.rk-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.rk-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ── Calendar Grid ── */
.rk-cal-wrapper {
    padding: 14px 18px 18px;
}

.rk-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.rk-day-header {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--rk-muted);
    padding: 6px 0;
    text-transform: uppercase;
}

.rk-day {
    min-height: 68px;
    border: 1px solid var(--rk-border);
    border-radius: var(--rk-radius);
    padding: 4px;
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    position: relative;
    transition: box-shadow 0.15s;
}
.rk-day:hover { box-shadow: 0 0 0 2px var(--rk-primary); z-index: 1; }

.rk-day[data-rk-date] {
    cursor: pointer !important;
}

.rk-day[data-rk-date]:hover {
    filter: brightness(0.97);
}

.rk-day[data-rk-date]::after {
    content: 'Book';
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--rk-primary);
    color: var(--rk-bg);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: calc(var(--rk-radius) / 2);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    line-height: 1.2;
}

.rk-day[data-rk-date]:hover::after {
    opacity: 1;
}

.rk-booking-notice {
    padding: 10px 18px;
    background: var(--rk-unavailable-bg);
    color: var(--rk-unavailable);
    border-bottom: 1px solid var(--rk-border);
    font-size: 0.85rem;
    font-weight: 500;
}

.rk-day.rk-empty {
    border: none;
    background: transparent;
    pointer-events: none;
}

.rk-day-num {
    font-weight: 500;
    font-size: 0.8rem;
    margin-bottom: 2px;
    color: var(--rk-text);
}

.rk-day-status {
    font-size: 0.68rem;
    font-weight: 500;
    margin-top: auto;
    line-height: 1.2;
}

.rk-day-price {
    font-size: 0.66rem;
    color: var(--rk-muted);
    margin-top: 1px;
}

/* Status styles */
.rk-day.rk-avail {
    background: var(--rk-available-bg);
    border-color: var(--rk-available);
}
.rk-day.rk-avail .rk-day-status { color: var(--rk-available); }

.rk-day.rk-unavail {
    background: var(--rk-unavailable-bg);
    border-color: var(--rk-unavailable);
}
.rk-day.rk-unavail .rk-day-status { color: var(--rk-unavailable); }

.rk-day.rk-restricted {
    background: var(--rk-restricted-bg);
    border-color: var(--rk-restricted);
}
.rk-day.rk-restricted .rk-day-status { color: var(--rk-restricted); }

.rk-day.rk-today {
    border-width: 2px;
    border-color: var(--rk-primary);
}

/* ── Loading / Error ── */
.rk-loading {
    text-align: center;
    padding: 50px 20px;
    color: var(--rk-muted);
}
.rk-loading .rk-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--rk-border);
    border-top-color: var(--rk-primary);
    border-radius: 50%;
    animation: rk-spin 0.7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes rk-spin { to { transform: rotate(360deg); } }

.rk-error {
    text-align: center;
    padding: 36px 20px;
    color: var(--rk-unavailable);
    font-size: 0.9rem;
}
.rk-error code {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--rk-muted);
    background: var(--rk-surface);
    padding: 8px;
    border-radius: var(--rk-radius);
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .rk-day { min-height: 52px; font-size: 0.7rem; }
    .rk-day-num { font-size: 0.72rem; }
    .rk-day-status { font-size: 0.6rem; }
    .rk-day-price { font-size: 0.58rem; }
    .rk-header h3 { font-size: 0.95rem; }
    .rk-controls { gap: 8px; }
    .rk-cal-months { gap: 12px; }
}
