.reservation {
    margin-top: 100px;
    margin-bottom: 150px;
    --hour-width: 75px;
    --row-height: 50px;
    --slot-column-gap: 2px;
    --slot-row-gap: 2px;
    --booking-strip-height: 8px;
}

/* tlačítko Vybrat jiný termín */
.reservation .btn-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 16px;
    margin-bottom: 70px;
    position: relative;
}

.reservation .term-picker-wrap {
    position: relative;
    grid-column: 2;
    justify-self: center;
}

.reservation .print {
    display: inline-flex;
    grid-column: 3;
    justify-self: end;
    gap: 16px;
}

.reservation .term-picker-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 101; /* nad sticky days lištou */
    width: 250px;
    transform: translateX(-50%);
}

.reservation .term-picker-calendar {
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(51, 34, 7, 0.12);
}

.reservation .term-picker-calendar__header {
    display: grid;
    grid-template-columns: 30px 1fr 30px;
    align-items: center;
    min-height: 40px;
    padding: 4px;
}

.reservation .term-picker-calendar__nav {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-4px);
    cursor: pointer;
}

.reservation .term-picker-calendar__nav:disabled {
    opacity: 0.45;
    cursor: default;
}

.reservation .term-picker-calendar__month {
    text-align: center;
    color: #000000;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: lowercase;
}

.reservation .term-picker-calendar__weekdays,
.reservation .term-picker-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.reservation .term-picker-calendar__weekdays {
    padding: 8px 6px 8px;
}

.reservation .term-picker-calendar__weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.reservation .term-picker-calendar__grid {
    padding: 0 4px 4px;
}

.reservation .term-picker-calendar__day {
    height: 32px;
    margin: -1px 0 0 -1px;
    border: 1px solid #d9d9d9;
    background: #ffffff;
    color: #565656;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.reservation .term-picker-calendar__day--outside {
    color: #b0aaa3;
    background: #fbfbfb;
}

.reservation .term-picker-calendar__day--selected,
.reservation .term-picker-calendar__day--today {
    background: #FFE875;
    color: #6c5a17;
    font-weight: 700;
}

.reservation .term-picker-calendar__day:disabled {
    color: #c3c3c3;
    background: #f7f5f1;
    cursor: default;
}

.reservation .term-picker-calendar__day:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid rgba(215, 121, 0, 0.35);
    outline-offset: -2px;
}



/* lišta s dny pro rezervaci*/
.reservation .days {
    display: grid;
    grid-template-columns: repeat(8, minmax(120px, 1fr));
    position: sticky;
    top: var(--reservation-days-sticky-top, 0px);
    z-index: 100;
    width: 100%;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    background: #fff;
    border-bottom: 1px solid rgba(239, 231, 215, 0.68);
}

.reservation .days.days--stuck {
    box-shadow: 0 10px 24px rgba(51, 34, 7, 0.12);
}

.reservation .days::-webkit-scrollbar {
    display: none;
}

.reservation .days .active,
.reservation .days .other {
    padding: 15px 10px;
    cursor: pointer;
}

.reservation .days .active p,
.reservation .days .other p {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    margin: 0;
}

.reservation .days .active p span {
  text-decoration: underline;
}

.reservation .days .other p {
    color: #5a5a5a;
}



/* obal pro legendu a facility*/
.reservation .content {
    padding: 50px 15px;
}



/* legenda */
.reservation .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 30px;
    margin: 12px 15px 40px;
}
.reservation .legend p {
    display: flex;
    align-items: center;
    margin: 0;
}
.reservation .legend p span {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 8px
}



/* facility - jednotlivé sportoviště */
.reservation .facility {
    padding: 40px 0;
    border-top: 1px solid rgba(239, 231, 215, 0.68);
}

.reservation .facility h4 {
    margin: 0 0 20px;
}

.reservation .facility--grouped > .facility-group__title {
    text-align: left;
}

.reservation .facility-group__layout {
    display: grid;
    grid-template-columns: var(--facility-group-label-width, 90px) minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    align-items: start;
    gap: 5px;
}

.reservation .facility-group__labels {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.reservation .facility--grouped .facility-group__labels > .facility-group__unit-label,
.reservation .facility--grouped .facility-group__labels > .facility-group__label-spacer {
    position: static;
    flex: 0 0 auto;
}

.reservation .facility--grouped .facility-group__rows--fixed-labels > .facility-group__timeline-row,
.reservation .facility--grouped .facility-group__rows--fixed-labels > .facility-group__unit-row {
    display: flow-root;
}

.reservation .facility--grouped .facility-group__rows {
    width: max-content;
    min-width: 100%;
}

.reservation .facility--grouped .facility-group__timeline-row,
.reservation .facility--grouped .facility-group__unit-row {
    display: grid;
    grid-template-columns: var(--facility-group-label-width, 108px) auto;
    width: max-content;
    min-width: 100%;
    align-items: stretch;
}

.reservation .facility--grouped .facility-group__unit-row:last-child {
    margin-bottom: 12px;
}

.reservation .facility--grouped .facility-group__timeline-row {
    margin-bottom: 4px;
}

.reservation .facility--grouped .facility-group__unit-label,
.reservation .facility--grouped .facility-group__label-spacer {
    position: sticky;
    left: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    background: #fff;
    font-size: 12px;
}
.reservation .facility--grouped .facility-group__unit-label {
    font-weight: 700;
    text-transform: uppercase;
    justify-content: center;
    text-align: center;
}

.reservation .facility--grouped .schedule {
    margin: 0 15px 0 0;
}

.reservation .facility--grouped .schedule--grouped-row {
    margin-bottom: 15px;
}

.reservation .facility--grouped .facility-group__unit-row:last-child .schedule--grouped-row {
    margin-bottom: 0;
}

.facility .schedule-scroll {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
}

.facility .schedule {
    --columns: 16;
    --rows: 2;
    position: relative;
    overflow: visible;
    margin: 0 5px 15px 15px;
}

.facility .schedule .timeline, /* časová osa */
.facility .schedule .timeslots { /* rezervační bloky */
    display: grid;
    grid-template-columns: repeat(var(--columns), var(--hour-width));
    width: max-content;
    min-width: 100%;
}


/* časová osa */
.facility .schedule .timeline {
    margin-bottom: 4px;
    column-gap: var(--slot-column-gap);
}

.facility .schedule .timeline .time {
    text-align: center;
    font-weight: 700;
}


/* rezervační bloky */
.facility .schedule .timeslots {
    position: relative;
    gap: var(--slot-row-gap) var(--slot-column-gap);
    grid-template-rows: repeat(var(--rows), var(--facility-row-height, var(--row-height)));
    width: calc(
        var(--columns) * var(--hour-width) +
        (var(--columns) - 1) * var(--slot-column-gap)
    );
    min-width: calc(
        var(--columns) * var(--hour-width) +
        (var(--columns) - 1) * var(--slot-column-gap)
    );
    height: calc(
        var(--rows) * var(--facility-row-height, var(--row-height)) +
        (var(--rows) - 1) * var(--slot-row-gap)
    );
}

.facility .schedule .block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    background-color: var(--slot-bg, transparent);
    color: var(--slot-ink, inherit);
    overflow: hidden;
    cursor: default;
}

.facility .schedule button.block {
    appearance: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    font: inherit;
}

.facility .schedule .block--interactive {
    cursor: pointer;
}

.facility .schedule .block--interactive:focus {
    outline: none;
}

.facility .schedule .block--interactive:focus-visible {
    outline: 3px solid #d77900;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.9);
}

.facility .schedule .timeslots > .block {
    position: relative;
}

.facility .schedule .timeslots > .block.block--with-strip {
    padding-top: calc(3px + var(--booking-strip-height));
}

.facility .schedule .timeslots > .block.block--with-strip::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: var(--booking-strip-height);
    background: var(--strip-color, transparent);
    pointer-events: none;
}

.facility .schedule .timeslots .block.booking-block {
    border: 0;
}

.facility .schedule .booking-layer {
    position: absolute;
    top: -50px;
    right: 0;
    left: 0;
    height: 0;
    overflow: visible;
}

.facility .schedule .booking-entry {
    position: absolute;
    z-index: 2;
    margin-top: 50px;
    pointer-events: none;
    transition: transform 0.18s ease;
    transform-origin: center center;
}

.facility .schedule .booking-entry:hover,
.facility .schedule .booking-entry:has(.booking-fragment:hover),
.facility .schedule .booking-entry:has(.booking-block:hover),
.facility .schedule .booking-entry:has(.booking-block:focus-visible) {
    transform: scale(1.3);
    z-index: 60;
}

.facility .schedule .timeslots > .block {
    transition: scale 0.18s ease;
    transform-origin: center center;
}

.facility .schedule .timeslots > .block:not(.block--covered-by-booking):hover {
    scale: 1.4;
    z-index: 60;
}

.facility .schedule .timeslots > .block.block--interactive:not(.block--covered-by-booking):focus-visible {
    scale: 1.4;
    z-index: 60;
}

.facility .schedule .booking-fragment {
    position: absolute;
    z-index: 1;
    background-color: var(--slot-bg, #686868);
    box-sizing: border-box;
    pointer-events: auto;
    cursor: default;
}

.facility .schedule .booking-entry:hover .booking-fragment--bridge {
    width: calc(var(--slot-column-gap) + 2px) !important;
    transform: translateX(-1px);
}

.facility .schedule .booking-strip {
    position: absolute;
    z-index: 2;
    height: var(--booking-strip-height);
    background: var(--strip-color, transparent);
    pointer-events: none;
}

.facility .schedule .block.booking-block {
    position: absolute;
    z-index: 3;
    pointer-events: auto;
    background: transparent;
    cursor: default;
}

.facility .schedule .timeslots > .block.block--occupied[data-reservation-info-enabled="1"],
.facility .schedule .timeslots > .block.active1,
.facility .schedule .timeslots > .block.active2,
.facility .schedule .timeslots > .block.active3,
.facility .schedule .timeslots > .block.active-deadline,
.facility .schedule .timeslots > .block.active4,
.facility .schedule .timeslots > .block.late,
.facility .schedule .timeslots > .block.full-lection,
.facility .schedule .timeslots > .block.voucher,
.facility .schedule .timeslots > .block.frmrez,
.facility .schedule .timeslots > .block.frmmy {
    cursor: pointer;
}

.facility .schedule .booking-entry[data-reservation-info-enabled="1"] .booking-fragment,
.facility .schedule .booking-entry[data-reservation-info-enabled="1"] .block.booking-block,
.facility .schedule .booking-entry.active1 .booking-fragment,
.facility .schedule .booking-entry.active1 .block.booking-block,
.facility .schedule .booking-entry.active2 .booking-fragment,
.facility .schedule .booking-entry.active2 .block.booking-block,
.facility .schedule .booking-entry.active3 .booking-fragment,
.facility .schedule .booking-entry.active3 .block.booking-block,
.facility .schedule .booking-entry.active-deadline .booking-fragment,
.facility .schedule .booking-entry.active-deadline .block.booking-block,
.facility .schedule .booking-entry.active4 .booking-fragment,
.facility .schedule .booking-entry.active4 .block.booking-block,
.facility .schedule .booking-entry.late .booking-fragment,
.facility .schedule .booking-entry.late .block.booking-block,
.facility .schedule .booking-entry.full-lection .booking-fragment,
.facility .schedule .booking-entry.full-lection .block.booking-block,
.facility .schedule .booking-entry.voucher .booking-fragment,
.facility .schedule .booking-entry.voucher .block.booking-block,
.facility .schedule .booking-entry.frmrez .booking-fragment,
.facility .schedule .booking-entry.frmrez .block.booking-block,
.facility .schedule .booking-entry.frmmy .booking-fragment,
.facility .schedule .booking-entry.frmmy .block.booking-block {
    cursor: pointer;
}

.facility .schedule .block.booking-block--with-strip {
    padding-top: calc(3px + var(--booking-strip-height));
}

.block-time {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.15;
}

.block-title {
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.15;
}

.content-empty {
    padding: 4px 0;
    color: #5a5a5a;
    font-size: 14px;
    font-weight: 700;
}


/* fade-effect */
.reservation .schedule-scroll-shell {
    position: relative;
    min-width: 0;
    max-width: 100%;
}

.reservation .schedule-scroll {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    -ms-overflow-style: none;
    scrollbar-width: none;
    overscroll-behavior-x: none;
    scroll-behavior: auto;
}

.reservation .schedule-scroll::-webkit-scrollbar {
    display: none;
}

.reservation .schedule-scroll-fade {
    display: block;
    appearance: none;
    position: absolute;
    top: 0;
    width: var(--schedule-fade-width, 80px);
    height: 100%;
    padding: 0;
    border: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 50;
    cursor: pointer;
}

.reservation .schedule-scroll-fade--left {
    left: 0;
    background: linear-gradient(
        to left,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 1)
    );
}

.reservation .schedule-scroll-fade--right {
    right: 0;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 1)
    );
}

.reservation .schedule-scroll-shell.can-scroll-left .schedule-scroll-fade--left,
.reservation .schedule-scroll-shell.can-scroll-right .schedule-scroll-fade--right {
    opacity: 1;
    pointer-events: auto;
}

.reservation .facility--grouped .schedule-scroll-fade--left {
    left: var(--facility-group-label-width, 90px);
}

.reservation .facility-group__layout .schedule-scroll-fade--left {
    left: 0;
}

.reservation .schedule {
    width: calc(var(--columns) * var(--hour-width) + (var(--columns) - 1) * var(--slot-column-gap));
    min-width: 0;
}

/* Touch taps must not leave an enlarged block extending the scrollable area. */
@media (hover: none) {
    .reservation .facility .schedule .booking-layer > .booking-entry,
    .reservation .facility .schedule .timeslots > .block:not(.block--covered-by-booking):hover {
        transform: none;
        scale: none;
    }
}

@media screen and (max-width: 991.98px) {
    .reservation.container-new {
        width: 100%;
        max-width: none;
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }
}


@media (max-width: 767.98px) {
    .reservation .btn-container {
        display: flex;
        flex-direction: column-reverse;
        align-items: center;
        gap: 16px;
    }
}

#ajax-spinner {
    display: none;
    position: fixed;
    font-size: 75px;
    z-index: 123456;
    color: #000;
    background-color: #00000080;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
}

#ajax-spinner .spinner {
    animation: rotate 2s linear infinite;
    z-index: 2;
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -25px 0 0 -25px;
    width: 100px;
    height: 100px;
}

#ajax-spinner .spinner .path {
    stroke: #fff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }

    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}


/* ---------------   RESPONSIVE DESIGN   ---------------*/
@media (max-width: 575.98px) {
    .reservation .content {
        padding: 25px 10px;
    }

    .reservation .facility h4 {
        margin: 0 15px 20px 0;
    }

    .reservation .legend {
        margin: 12px 15px 40px 0;
    }

    .reservation .facility--grouped .facility-group__timeline-row,
    .reservation .facility--grouped .facility-group__unit-row {
        grid-template-columns: var(--facility-group-label-width, 90px) auto; 
    }

    .reservation .schedule-scroll-fade {
        width: var(--schedule-fade-width, 40px);
    }
}
