:root {
    --grid-gap: 0.35rem;
}

.availability-form {
    width: 100%;
}

.sticky-nav-container {
    position: static;
    margin-bottom: 0.5rem;
}

.sticky-header-group {
    position: sticky;
    top: var(--app-header-height);
    z-index: var(--z-sticky);
    background: var(--bg-surface);
    width: 100%;
    padding: 0.5rem 0;
    box-shadow: 0 4px 10px -5px var(--bg-surface);
}

.date-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
    padding: 0.5rem;
    margin: 0;
    border-radius: 8px;
    border: 1px solid var(--neutral);
    gap: 1rem;
}

.date-navigation .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.date-navigation h3 {
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    margin: 0;
    text-align: center;
}

.nav-actions {
    display: flex;
    gap: 0.625rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--grid-gap);
}

.day-header {
    position: static;
    top: auto;
    box-shadow: none;
    border-bottom: none;
    border-radius: 0.4rem 0.4rem 0 0;
    z-index: auto;
}

.calendar-grid.header-only {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--neutral);
}

/* Grid offsets for correct start day of week */
.start-col-1 {
    grid-column-start: 1;
}
.start-col-2 {
    grid-column-start: 2;
}
.start-col-3 {
    grid-column-start: 3;
}
.start-col-4 {
    grid-column-start: 4;
}
.start-col-5 {
    grid-column-start: 5;
}
.start-col-6 {
    grid-column-start: 6;
}
.start-col-7 {
    grid-column-start: 7;
}

.calendar-grid::before {
    content: "";
    grid-row: span 2;
    display: none; /* Hidden by default for Mondays */
}

.calendar-grid:has(> .start-col-2)::before {
    display: block;
    grid-column: 1 / 2;
}
.calendar-grid:has(> .start-col-3)::before {
    display: block;
    grid-column: 1 / 3;
}
.calendar-grid:has(> .start-col-4)::before {
    display: block;
    grid-column: 1 / 4;
}
.calendar-grid:has(> .start-col-5)::before {
    display: block;
    grid-column: 1 / 5;
}
.calendar-grid:has(> .start-col-6)::before {
    display: block;
    grid-column: 1 / 6;
}
.calendar-grid:has(> .start-col-7)::before {
    display: block;
    grid-column: 1 / 7;
}

.card-date {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 1fr auto;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
    font-weight: 700;
    border-bottom: 1px solid var(--border-dim);
    white-space: nowrap;
}

.card-date > span {
    grid-column: 2;
    text-align: center;
}

.noncontactable {
    grid-column: 3;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.2s ease, transform 0.2s ease;
    stroke: var(--text-main);
    margin: 0;
    align-self: end;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    justify-self: end;
    height: 2.5rem;
    width: 2.5rem;
}

@media (hover: hover) {
    .noncontactable:hover {
        transform: scale(1.15);
    }
}

.noncontactable:active {
    transform: scale(0.95);
}

.noncontactable[data-active="true"] {
    stroke: var(--danger, red);
    font-weight: 700;
}

.mobile-text {
    display: none;
}

.nc-text {
    display: none; /* Hidden by default */
    flex: 1;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Hide the buttons when Non-Contactable is active */
.is-non-contactable .shift-column {
    display: none;
}

/* Show the text when Non-Contactable is active */
.is-non-contactable .nc-text {
    display: flex;
}

.card-body-horizontal {
    padding: 0.5rem 0.35rem;
    display: flex;
    gap: 0.35rem;
    flex-grow: 1;
}

.shift-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
}

.shift-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

.split-btn-compact {
    display: flex;
    width: 100%;
    height: 2.2rem;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--neutral);
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.split-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    background: var(--primary-light);
    color: var(--text-muted);
    font-size: 0.9rem;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .split-side:hover {
        background: var(--neutral);
    }
}

.split-side:active {
    filter: brightness(0.9);
}

.split-btn-compact[data-state="true"] .side-yes {
    background: var(--success);
    color: var(--text-inverse);
    flex: 1;
    width: 100%;
}

.split-btn-compact[data-state="true"] .side-no {
    display: none;
}

.split-btn-compact[data-state="false"] .side-no {
    background: var(--danger);
    color: var(--text-inverse);
    flex: 1;
    width: 100%;
}

.split-btn-compact[data-state="false"] .side-yes {
    display: none;
}

.booking-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 2.2rem;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    border-radius: 6px;
    transition: filter 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.booking-btn-confirmed {
    background-color: var(--primary);
}

.booking-btn-provisional {
    background-color: var(--warning);
}

@media (hover: hover) {
    .booking-btn:hover {
        filter: brightness(0.9);
        color: white;
        text-decoration: none;
    }
}

.booking-btn:active {
    transform: scale(0.95);
}

@media (max-width: 600px) {
    .calendar-card {
        padding: 0.5rem;
    }

    .card-body-horizontal {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-text {
        display: none;
    }

    .date-navigation .btn {
        font-size: 1.2rem;
        padding: 0.5rem 0.8rem;
    }

    .card-date {
        grid-template-columns: 1fr; /* Switch to a single column */
        gap: 0.25rem;
        padding: 0.5rem;
    }

    .card-date > span {
        grid-column: 1;
        white-space: normal;
        align-self: center;
    }

    .noncontactable {
        grid-column: 1;
        justify-self: center;
        padding: 0;
        height: 1.5rem;
        width: 1.5rem;
    }

    .desktop-text {
        display: none;
    }

    .mobile-text {
        display: block; /* Show 'NC' */
        font-size: 1.2rem; /* Optional: Make 'NC' slightly larger to fill the space nicely */
    }
}
