/* Calendar Widget Styles - BEM Methodology */

.calendar-widget {
    --cal-accent: #c25e34;
    --cal-accent-light: rgba(194, 94, 52, 0.12);
    --cal-blocked-bg: #f5f5f5;
    --cal-blocked-text: #999;
    --cal-border: var(--color-border, #e5e7eb);
    --cal-today-color: #c25e34;
    font-family: inherit;
    max-width: 100%;
    user-select: none;
}

/* Navigation */
.calendar__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md, 16px);
}

.calendar__nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--cal-border);
    border-radius: 6px;
    background: var(--color-background, #fff);
    color: var(--color-text, #1f2937);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.calendar__nav-btn:hover {
    background: var(--color-surface-hover, #f3f4f6);
    border-color: var(--color-border-strong, #d1d5db);
}

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

/* Grid layout - adapts to container width */
.calendar__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-xl, 32px);
}

/* Individual month */
.calendar__month {
    min-width: 0;
}

.calendar__month-header {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-sm, 8px);
    color: var(--color-text, #1f2937);
}

/* Weekday headers */
.calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.calendar__weekdays span {
    padding: 4px 0;
}

/* Days grid */
.calendar__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

/* Individual day cell */
.calendar__day {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    min-height: 44px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-text, #1f2937);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    padding: 0;
    position: relative;
}

.calendar__day:hover:not(:disabled):not(.calendar__day--empty) {
    background: var(--color-surface-hover, #f3f4f6);
}

.calendar__day:focus-visible {
    outline: 2px solid var(--cal-accent);
    outline-offset: -2px;
}

/* Empty cell (padding before first of month) */
.calendar__day--empty {
    cursor: default;
    aspect-ratio: 1;
    min-height: 44px;
}

/* Past dates */
.calendar__day--past {
    color: var(--cal-blocked-text);
    cursor: not-allowed;
}

/* Today indicator */
.calendar__day--today {
    font-weight: 600;
    color: var(--cal-today-color);
}

.calendar__day--today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--cal-today-color);
}

/* Blocked dates */
.calendar__day--blocked {
    background: var(--cal-blocked-bg);
    color: var(--cal-blocked-text);
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Selected dates (check-in / check-out) */
.calendar__day--selected {
    background: var(--cal-accent) !important;
    color: #fff !important;
    font-weight: 600;
    border-radius: 6px;
}

/* In-range dates (between check-in and check-out) */
.calendar__day--in-range {
    background: var(--cal-accent-light);
    border-radius: 0;
    color: var(--cal-accent);
    font-weight: 500;
}

/* Round the corners of the range start/end */
.calendar__day--range-start {
    border-radius: 6px 0 0 6px;
}

.calendar__day--range-end {
    border-radius: 0 6px 6px 0;
}

/* Hover preview during check-out selection */
.calendar__day--hover-preview {
    background: var(--cal-accent-light);
    color: var(--cal-accent);
}

/* Message area */
.calendar__message {
    text-align: center;
    padding: var(--space-sm, 8px) 0;
    font-size: 0.875rem;
    color: var(--color-text-muted, #6b7280);
    min-height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar__message--error {
    color: var(--color-error, #ef4444);
}

/* Summary (nights / price) */
.calendar__summary {
    text-align: center;
    padding: var(--space-sm, 8px) 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text, #1f2937);
}

/* Clear button */
.calendar__clear {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #6b7280);
    background: none;
    border: 1px solid var(--cal-border);
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.calendar__clear:hover {
    color: var(--color-error, #ef4444);
    border-color: var(--color-error, #ef4444);
}

/* Controls row (clear + summary) */
.calendar__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-sm, 8px);
}

/* Loading state */
.calendar__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl, 32px);
    color: var(--color-text-muted, #6b7280);
    font-size: 0.875rem;
}

.calendar__loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--cal-border);
    border-top-color: var(--cal-accent);
    border-radius: 50%;
    animation: calendar-spin 0.6s linear infinite;
    margin-right: 8px;
}

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

/* Responsive: touch-friendly sizing on small screens */
@media (max-width: 600px) {
    .calendar__day {
        min-height: 44px;
        font-size: 0.875rem;
    }

    .calendar__nav-btn {
        width: 44px;
        height: 44px;
    }
}
