/**
 * Simple Booking - Calendar Styles
 * Komorebi theme compatible.
 */

/* Calendar Container */
.sb-calendar {
    max-width: 480px;
    margin: 0 auto;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: relative;
}

/* Calendar Header */
.sb-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.sb-calendar-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d2d2d;
    letter-spacing: 0.05em;
}

.sb-calendar-nav {
    background: none;
    border: 1px solid #e0dcd7;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 1;
    color: #2d2d2d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sb-calendar-nav:hover {
    background: #faf8f5;
    border-color: #c4a265;
    color: #c4a265;
}

.sb-calendar-nav.sb-nav-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sb-calendar-nav.sb-nav-disabled:hover {
    background: none;
    border-color: #e0dcd7;
    color: #2d2d2d;
}

/* Legend */
.sb-calendar-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #777;
}

.sb-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sb-legend-sample {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

.sb-legend-sample.sb-sample-available {
    color: #5a9463;
}

.sb-legend-sample.sb-sample-limited {
    color: #c4930e;
}

.sb-legend-sample.sb-sample-unavailable {
    color: #b0b0b0;
}

/* Calendar Grid */
.sb-calendar-grid {
    user-select: none;
}

.sb-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.sb-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    padding: 8px 0;
}

.sb-weekday.sb-sunday {
    color: #d46b6b;
}

.sb-weekday.sb-saturday {
    color: #5b8abf;
}

.sb-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    transition: opacity 0.3s ease;
}

/* Day Cell */
.sb-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s ease;
    min-height: 44px;
}

.sb-day-empty {
    background: transparent;
}

.sb-day-number {
    font-size: 14px;
    font-weight: 500;
    color: #2d2d2d;
    z-index: 1;
}

/* Status text label */
.sb-day-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    margin-top: 1px;
    z-index: 1;
    letter-spacing: 0;
    white-space: nowrap;
}

.sb-label-available {
    color: #5a9463;
}

.sb-label-limited {
    color: #c4930e;
}

.sb-label-unavailable {
    color: #b0b0b0;
}

/* Day States */
.sb-day-available {
    background: rgba(127, 168, 134, 0.08);
}

.sb-day-limited {
    background: rgba(212, 168, 83, 0.08);
}

.sb-day-unavailable {
    background: rgba(204, 204, 204, 0.15);
}

.sb-day-unavailable .sb-day-number {
    color: #bbb;
    text-decoration: line-through;
}

.sb-day-past {
    opacity: 0.35;
}

.sb-day-past .sb-day-number {
    color: #bbb;
}

/* Today */
.sb-day-today {
    border: 2px solid #c4a265;
}

.sb-day-today .sb-day-number {
    font-weight: 700;
}

/* Sunday / Saturday Colors */
.sb-day-sunday .sb-day-number {
    color: #d46b6b;
}

.sb-day-saturday .sb-day-number {
    color: #5b8abf;
}

.sb-day-past.sb-day-sunday .sb-day-number,
.sb-day-past.sb-day-saturday .sb-day-number {
    color: #bbb;
}

/* Selectable */
.sb-day-selectable {
    cursor: pointer;
}

.sb-day-selectable:hover {
    background: rgba(196, 162, 101, 0.15);
    transform: scale(1.05);
}

/* Selected State */
.sb-day-selected {
    background: #c4a265 !important;
    border-radius: 8px;
}

.sb-day-selected .sb-day-number {
    color: #fff !important;
    font-weight: 700;
}

.sb-day-selected .sb-day-label {
    color: rgba(255, 255, 255, 0.85) !important;
}

.sb-day-checkin {
    border-radius: 8px 4px 4px 8px;
}

.sb-day-checkout {
    border-radius: 4px 8px 8px 4px;
}

/* In-range */
.sb-day-in-range {
    background: rgba(196, 162, 101, 0.18) !important;
    border-radius: 2px;
}

.sb-day-in-range .sb-day-number {
    color: #8b7340;
}

/* Loading Overlay */
.sb-calendar-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.sb-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0dcd7;
    border-top-color: #c4a265;
    border-radius: 50%;
    animation: sb-spin 0.7s linear infinite;
}

@keyframes sb-spin {
    to { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 520px) {
    .sb-calendar {
        padding: 16px;
        border-radius: 8px;
    }

    .sb-calendar-title {
        font-size: 16px;
    }

    .sb-calendar-nav {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .sb-calendar-legend {
        gap: 10px;
        font-size: 11px;
    }

    .sb-day {
        min-height: 38px;
    }

    .sb-day-number {
        font-size: 13px;
    }

    .sb-day-label {
        font-size: 8px;
    }
}

@media (max-width: 380px) {
    .sb-calendar {
        padding: 12px;
    }

    .sb-calendar-legend {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 10px;
    }

    .sb-day {
        min-height: 34px;
    }

    .sb-day-number {
        font-size: 12px;
    }
}

/* Hourly booking indicator on calendar */
.sb-day-hourly {
    background: #f0f7ff !important;
    border-bottom: 2px solid #7baed4;
}

.sb-day-hourly.sb-day-selectable {
    cursor: default;
}

.sb-label-hourly {
    color: #1d5fa0;
    background: #dbeafe;
    border-radius: 3px;
    padding: 0 3px;
    font-size: 10px;
}

/* Calendar note */
.sb-calendar-note {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin: 12px 0 0;
}
