/* ============================================================
   HOLIDAYSEVA CALENDAR / DATE PICKER COMPONENT
   Import after colors.css. No other dependencies.
   ============================================================ */

/* ── Root element ─────────────────────────────────────────── */
.hs-calendar {
    background: var(--color-surface, #fff);
    border-radius: var(--radius-xl, 18px);
    padding: var(--space-lg, 28px);
    box-shadow: var(--shadow-modal, 0 8px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08));
    max-width: 720px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    font-family: var(--font-system, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif);
    box-sizing: border-box;
}

.hs-calendar *,
.hs-calendar *::before,
.hs-calendar *::after {
    box-sizing: border-box;
}

.hs-calendar.hs-calendar--inline {
    box-shadow: none;
    border: 1px solid var(--color-border, #D2D2D7);
}

/* ── Dual-month grid ──────────────────────────────────────── */
.hs-calendar__months {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl, 36px);
    margin-bottom: 20px;
}

/* ── Single month ─────────────────────────────────────────── */
.hs-calendar__month {
    min-width: 0;
}

/* ── Month header ─────────────────────────────────────────── */
.hs-calendar__month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md, 16px);
}

.hs-calendar__month-title {
    font-size: var(--text-md, 15px);
    font-weight: var(--weight-semibold, 600);
    color: var(--color-text-primary, #1D1D1F);
    letter-spacing: var(--tracking-tight, -0.01em);
}

/* ── Nav buttons ──────────────────────────────────────────── */
.hs-calendar__nav {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--color-border, #D2D2D7);
    background: var(--color-surface, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary, #1D1D1F);
    cursor: pointer;
    transition: background var(--transition-fast, 0.12s ease), box-shadow var(--transition-fast, 0.12s ease);
    flex-shrink: 0;
}

.hs-calendar__nav:hover {
    background: var(--color-muted, #F5F5F7);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.hs-calendar__nav--hidden {
    visibility: hidden;
    pointer-events: none;
}

/* ── Weekday labels ───────────────────────────────────────── */
.hs-calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: var(--space-xs, 6px);
}

.hs-calendar__weekday {
    text-align: center;
    font-size: var(--text-xs, 11px);
    font-weight: var(--weight-semibold, 600);
    color: var(--color-text-secondary, #6E6E73);
    padding: 4px 0;
    letter-spacing: var(--tracking-wide, 0.02em);
}

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

/* ── Day cell ─────────────────────────────────────────────── */
.hs-calendar__day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm, 13px);
    font-weight: 400;
    color: var(--color-text-primary, #1D1D1F);
    background: none;
    border: none;
    border-radius: 50%;
    position: relative;
    transition: none;
    cursor: pointer;
    z-index: 1;
    font-family: inherit;
}

.hs-calendar__day:hover:not(:disabled):not(.hs-calendar__day--empty):not(.hs-calendar__day--selected):not(.hs-calendar__day--range-start):not(.hs-calendar__day--range-end) {
    background: var(--color-muted, #F5F5F7);
}

.hs-calendar__day--empty {
    cursor: default;
    pointer-events: none;
}

.hs-calendar__day--disabled {
    color: var(--color-muted-dark, #DDDDDD);
    text-decoration: line-through;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Today dot ────────────────────────────────────────────── */
.hs-calendar__day--today {
    font-weight: var(--weight-bold, 700);
}

.hs-calendar__day--today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--color-primary, #FF385C);
    border-radius: 50%;
    z-index: 4;
}

/* ══════════════════════════════════════════════════════════
   SELECTED / RANGE ENDPOINTS
   Approach: the CELL element itself is transparent/band-only.
   The black circle is drawn entirely via ::before (full inset).
   The today dot is drawn via ::after (unchanged, sits on top).
   This way z-index never fights — ::before is always under
   the element background of siblings, ::after is always on top.
   ══════════════════════════════════════════════════════════ */

/* ── Single selected (no range) ── */
.hs-calendar__day--selected {
    background: var(--color-secondary, #222222) !important;
    color: #ffffff !important;
    font-weight: var(--weight-semibold, 600);
    border-radius: 50%;
    z-index: 2;
    transition: none !important;
}

/* today dot turns white when selected */
.hs-calendar__day--selected::after {
    background: #ffffff !important;
}

/* today + selected: hide the dot — the solid circle is indicator enough */
.hs-calendar__day--today.hs-calendar__day--selected::after {
    display: none !important;
}

/* ── Range start ── */
.hs-calendar__day--range-start {
    /* Right half = grey band; left half = transparent */
    background: linear-gradient(to right, transparent 50%, #EBEBEB 50%) !important;
    border-radius: 0 !important;
    color: transparent !important;
    /* hide real text — ::before redraws it */
    transition: none !important;
    z-index: 2;
    position: relative;
}

/* ── Range end ── */
.hs-calendar__day--range-end {
    /* Left half = grey band; right half = transparent */
    background: linear-gradient(to left, transparent 50%, #EBEBEB 50%) !important;
    border-radius: 0 !important;
    color: transparent !important;
    transition: none !important;
    z-index: 2;
    position: relative;
}

/* Black circle drawn via ::before — sits over the band, under ::after (today dot) */
.hs-calendar__day--range-start::before,
.hs-calendar__day--range-end::before {
    content: attr(data-day);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-secondary, #222222);
    color: #ffffff;
    font-size: inherit;
    font-weight: 600;
    font-family: inherit;
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
}

/* Today dot on range endpoints — ::after still fires, sits above ::before circle */
.hs-calendar__day--today.hs-calendar__day--range-start::after,
.hs-calendar__day--today.hs-calendar__day--range-end::after {
    background: #ffffff !important;
    z-index: 4;
}

/* ── In-range fill ────────────────────────────────────────── */
.hs-calendar__day--in-range {
    background: #EBEBEB !important;
    color: var(--color-text-primary, #1D1D1F);
    border-radius: 0;
    z-index: 1;
}

.hs-calendar__day--in-range:hover {
    background: #E0E0E0 !important;
}

.hs-calendar__day--hover-range {
    background: #EBEBEB !important;
    border-radius: 0;
    z-index: 1;
}

/* ── Extend-stay states ───────────────────────────────────── */
.hs-calendar__day--extend-end {
    background: var(--color-success, #1A7A35) !important;
    color: #fff !important;
    font-weight: var(--weight-semibold, 600);
    border-radius: 50%;
    z-index: 2;
}

.hs-calendar__day--extend-end::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: rgba(52, 199, 89, 0.12);
    border-radius: 0;
    z-index: -1;
}

.hs-calendar__day--extend-range {
    background: rgba(52, 199, 89, 0.12) !important;
    color: var(--color-text-primary, #1D1D1F);
    border-radius: 0;
}

/* ── Focus ring ───────────────────────────────────────────── */
.hs-calendar__day:focus-visible {
    outline: 2px solid var(--color-primary, #FF385C);
    outline-offset: 1px;
}

/* ── Footer ───────────────────────────────────────────────── */
.hs-calendar__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 20px;
    margin-top: 4px;
    border-top: 1px solid var(--color-border-light, #EBEBEB);
    align-items: center;
}

.hs-calendar__extend-label {
    font-size: 12px;
    color: var(--color-text-secondary, #6E6E73);
    font-weight: 500;
    margin-right: 4px;
    white-space: nowrap;
}

.hs-calendar__extend-pill {
    padding: 6px 14px;
    border: 1.5px solid var(--color-border, #D2D2D7);
    border-radius: 999px;
    background: none;
    font-family: inherit;
    font-size: var(--text-sm, 13px);
    color: var(--color-text-secondary, #6E6E73);
    cursor: pointer;
    transition: all var(--transition-fast, 0.12s ease);
    white-space: nowrap;
}

.hs-calendar__extend-pill:hover {
    border-color: var(--color-text-primary, #1D1D1F);
    color: var(--color-text-primary, #1D1D1F);
}

.hs-calendar__extend-pill--active {
    border-color: var(--color-text-primary, #1D1D1F);
    color: var(--color-text-primary, #1D1D1F);
    font-weight: var(--weight-semibold, 600);
    background: rgba(0, 0, 0, 0.04);
}

/* ── Live region (screen-reader only) ────────────────────── */
.hs-calendar__live {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
    .hs-calendar__months {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .hs-calendar {
        padding: 20px 16px;
    }

    .hs-calendar__extend-label {
        display: none;
    }
}