/* Blazor form-state classes (EditForm adds .valid/.invalid/.modified, not Bootstrap's .is-invalid) */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--bs-success);
}

.invalid {
    outline: 1px solid var(--bs-danger);
}

.validation-message {
    color: var(--bs-danger);
    font-size: 0.875em;
}

.extra-small {
    font-size: 0.75rem;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-card:hover {
    border-color: var(--bs-primary-border-subtle) !important;
    background-color: var(--bs-secondary-bg) !important;
}

.hover-underline:hover {
    text-decoration: underline !important;
}

/* ==========================================================================
   Booking Calendar (day / week time grids + month grid)
   ========================================================================== */
.cal-scroll {
    overflow-x: auto;
}

.cal-timegrid {
    display: grid;
    min-width: 720px;
}

.cal-col-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    border-left: 1px solid var(--bs-border-color);
    padding: 0.5rem 0.35rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.cal-col-header.is-today {
    color: var(--bs-primary);
    box-shadow: inset 0 -3px 0 var(--bs-primary);
}

.cal-time-gutter {
    position: relative;
    border-right: 1px solid var(--bs-border-color);
}

.cal-time-label {
    position: absolute;
    right: 0.4rem;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.cal-day-col {
    position: relative;
    border-left: 1px solid var(--bs-border-color);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(var(--cal-hour-height) - 1px),
        var(--bs-border-color) calc(var(--cal-hour-height) - 1px),
        var(--bs-border-color) var(--cal-hour-height));
}

.cal-day-col.is-today {
    background-color: var(--bs-primary-bg-subtle);
}

.cal-day-col.is-bookable {
    cursor: copy;
}

.cal-event {
    position: absolute;
    border-radius: 6px;
    border: 1px solid;
    border-left-width: 4px;
    padding: 2px 6px;
    font-size: 0.72rem;
    line-height: 1.25;
    overflow: hidden;
    cursor: pointer;
    z-index: 2;
    transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.cal-event:hover,
.cal-event:focus-visible {
    box-shadow: 0 0.35rem 0.9rem var(--bs-tertiary-bg);
    transform: translateY(-1px);
    z-index: 4;
    outline: none;
}

.cal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--bs-danger);
    z-index: 3;
    pointer-events: none;
}

.cal-now-line::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--bs-danger);
}

.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-width: 720px;
}

.cal-month-weekday {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color);
}

.cal-month-cell {
    min-height: 118px;
    padding: 0.35rem;
    border-right: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.cal-month-cell:nth-child(7n) {
    border-right: none;
}

.cal-month-cell:hover {
    background-color: var(--bs-secondary-bg);
}

.cal-month-cell.is-outside {
    background-color: var(--bs-tertiary-bg);
    opacity: 0.6;
}

.cal-month-daynum {
    font-size: 0.8rem;
    font-weight: 600;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-month-cell.is-today .cal-month-daynum {
    background-color: var(--bs-primary);
    color: var(--bs-light);
}

/* Elapsed time (earlier days, and today before now): greyed and not selectable */
.cal-past {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    cursor: not-allowed;
    background-color: rgba(var(--bs-body-color-rgb), 0.06);
    border-bottom: 1px dashed var(--bs-border-color);
}

.cal-month-cell.is-past .cal-month-daynum {
    color: var(--bs-tertiary-color);
}

.cal-month-cell.is-past {
    background-color: rgba(var(--bs-body-color-rgb), 0.03);
}

/* Weekends: greyed, hatched and not selectable */
.cal-col-header.is-weekend {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-tertiary-color);
}

.cal-col-header.is-weekend .text-body-emphasis {
    color: var(--bs-tertiary-color) !important;
}

.cal-day-col.is-weekend {
    cursor: not-allowed;
    background-color: var(--bs-tertiary-bg);
    background-image:
        repeating-linear-gradient(45deg, transparent 0, transparent 7px, rgba(var(--bs-body-color-rgb), 0.05) 7px, rgba(var(--bs-body-color-rgb), 0.05) 14px),
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent calc(var(--cal-hour-height) - 1px),
            var(--bs-border-color) calc(var(--cal-hour-height) - 1px),
            var(--bs-border-color) var(--cal-hour-height));
}

.cal-month-weekday.is-weekend {
    color: var(--bs-tertiary-color);
    background-color: var(--bs-tertiary-bg);
}

.cal-month-cell.is-weekend,
.cal-month-cell.is-weekend:hover {
    cursor: not-allowed;
    background-color: var(--bs-tertiary-bg);
    background-image: repeating-linear-gradient(45deg, transparent 0, transparent 7px, rgba(var(--bs-body-color-rgb), 0.05) 7px, rgba(var(--bs-body-color-rgb), 0.05) 14px);
    color: var(--bs-tertiary-color);
}

.cal-chip {
    display: block;
    border-radius: 4px;
    border: 1px solid;
    border-left-width: 3px;
    padding: 1px 5px;
    margin-top: 3px;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* ---------------- Public booking landing page ---------------- */
.pb-stepper .pb-step { font-size: .8rem; padding: .3rem .75rem; border-radius: 999px; color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); }
.pb-stepper .pb-step.active { background: var(--bs-warning); color: var(--bs-dark); font-weight: 700; }
.pb-stepper .pb-step.done { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.pb-stepper .pb-step.done .btn-link { color: inherit; font-size: inherit; }

.pb-otp-input { letter-spacing: .6em; font-family: Consolas, "Courier New", monospace; }

.pb-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pb-dow { text-align: center; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--bs-secondary-color); padding: .25rem 0; }
.pb-day {
    min-height: 74px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
    padding: .4rem .5rem; border: 1px solid var(--bs-border-color); border-radius: .5rem;
    background: var(--bs-body-bg); color: var(--bs-body-color); text-align: left; min-width: 0;
}
.pb-day-num { font-weight: 700; }
.pb-day-note { font-size: .7rem; max-width: 100%; }
.pb-day.pb-available { border-color: rgba(var(--bs-success-rgb), .45); background: var(--bs-success-bg-subtle); cursor: pointer; }
.pb-day.pb-available .pb-day-note { color: var(--bs-success-text-emphasis); font-weight: 600; }
.pb-day.pb-available:hover, .pb-day.pb-available:focus-visible { border-color: var(--bs-warning); box-shadow: 0 0 0 .2rem rgba(var(--bs-warning-rgb), .35); outline: 0; }
.pb-day.pb-fullybooked { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); cursor: not-allowed; }
.pb-day.pb-weekend, .pb-day.pb-holiday, .pb-day.pb-outsidewindow, .pb-day.pb-noticeperiod, .pb-day.pb-past {
    cursor: not-allowed; color: var(--bs-tertiary-color); background-color: var(--bs-tertiary-bg);
    background-image: repeating-linear-gradient(45deg, transparent 0, transparent 7px, rgba(var(--bs-body-color-rgb), .05) 7px, rgba(var(--bs-body-color-rgb), .05) 14px);
}
.pb-day.pb-holiday .pb-day-note { color: var(--bs-warning-text-emphasis); }
.pb-day.pb-outside { opacity: .45; }
.pb-day.pb-today .pb-day-num { color: var(--bs-primary); text-decoration: underline; }
.pb-day.pb-selected { border: 2px solid var(--bs-warning); }
.pb-legend { display: inline-block; width: .9rem; height: .9rem; border-radius: .2rem; vertical-align: -2px; margin-right: .25rem; border: 1px solid var(--bs-border-color); }
.pb-legend.pb-available { background: var(--bs-success-bg-subtle); border-color: rgba(var(--bs-success-rgb), .45); }
.pb-legend.pb-fullybooked { background: var(--bs-danger-bg-subtle); }
.pb-legend.pb-weekend { background: var(--bs-tertiary-bg); }

.pb-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.pb-slot { padding: .4rem .25rem; line-height: 1.2; }
.pb-durations { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.pb-duration { line-height: 1.3; }

@media (max-width: 575.98px) {
    .pb-day { min-height: 54px; padding: .3rem; }
    .pb-day-note { display: none; }
    .pb-day.pb-available::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bs-success); }
}

/* Audit log snapshots */
.audit-snapshot { max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: .78rem; }

/* Someone else's booking: shows the slot is taken without revealing details */
.cal-private {
    background-color: var(--bs-secondary-bg) !important;
    background-image: repeating-linear-gradient(135deg, transparent 0, transparent 6px, rgba(var(--bs-body-color-rgb), .04) 6px, rgba(var(--bs-body-color-rgb), .04) 12px);
    color: var(--bs-secondary-color) !important;
    border-color: var(--bs-border-color) !important;
}
.cal-event.cal-private { border-left: 4px solid var(--bs-secondary-color) !important; }
