/* This file contains the shared schedule views styles used by more than one page. */

/* From routines/routine_list */

.routine-policies-holder {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.routine-policy-link {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--accent-ink) !important;
    font: 600 12.5px var(--font);
    text-decoration: none;
}

.routine-policy-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.routine-more-chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    cursor: default;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    font: 600 11.5px/1 var(--font);
    font-variant-numeric: tabular-nums;
}

.routine-more-chip:hover {
    background: var(--accent-soft);
    color: var(--accent-ink);
    border-color: transparent;
}

.routine-more-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* From routines/routine_details */

/* on call strip */
.on-call-now {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 1fr);
    margin: 0 0 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-xs);
}

.on-call-now[hidden] {
    display: none;
}

.on-call-now-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 14px 20px;
}

.on-call-now-block + .on-call-now-block {
    border-left: 1px solid var(--border);
}

.on-call-now-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 600 11.5px/1.2 var(--font);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.on-call-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px var(--ok-soft);
}

.on-call-now-line,
.on-call-now-coverage {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 28px;
}

.on-call-now-line b,
.on-call-now-coverage b {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 650 15px/1.2 var(--font);
    color: var(--text);
    letter-spacing: -0.01em;
}

.on-call-now-line.is-none,
.on-call-now-coverage.is-gap {
    color: var(--warn);
}

.on-call-now-line.is-none b,
.on-call-now-coverage.is-gap b {
    color: var(--warn);
}

.on-call-now-coverage.is-ok {
    color: var(--ok);
}

.on-call-now-dots {
    display: inline-flex;
    gap: 3px;
    flex: none;
}

.on-call-now-dots i {
    width: 8px;
    height: 8px;
    border-radius: 3px;
}

.on-call-now-text {
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rotation-avatars {
    display: inline-flex;
    flex: none;
}

.rotation-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    object-fit: cover;
}

img.rotation-avatar {
    background: var(--surface-3);
}

/* initials avatars */
span.rotation-avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    box-sizing: border-box;
    color: #fff;
    font: 700 9.5px/1 var(--font);
    letter-spacing: 0.02em;
}

.rotation-avatars .rotation-avatar + .rotation-avatar {
    margin-left: -9px;
}

/* schedule card */
.schedule-view-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-xs);
    overflow: hidden;
}

.schedule-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    padding: 14px 16px 14px 20px;
    border-bottom: 1px solid var(--border);
}

.schedule-panel-title {
    min-width: 0;
}

.schedule-panel-title h2 {
    margin: 0;
    font: 700 15px/1.3 var(--font);
    letter-spacing: -0.01em;
    color: var(--text);
}

.schedule-panel-title p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

.schedule-panel-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.schedule-month-nav {
    display: inline-flex;
    align-items: center;
    height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: var(--sh-xs);
}

.schedule-nav-button {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 0 !important;
    background: transparent !important;
    color: var(--text-2) !important;
    border-radius: 7px !important;
}

.schedule-nav-button:hover {
    background: var(--surface-3) !important;
    color: var(--text) !important;
}

.schedule-month-name {
    min-width: 84px;
    padding: 0 4px;
    text-align: center;
    font: 650 13px/1 var(--font);
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.schedule-segment-button {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 11px !important;
    border: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: var(--muted) !important;
    font: 600 12.5px var(--font) !important;
    box-shadow: none !important;
}

.schedule-segment-button:hover {
    color: var(--text) !important;
}

.schedule-segment-button.active {
    background: var(--surface) !important;
    color: var(--text) !important;
    box-shadow: 0 1px 2px rgba(15, 20, 36, 0.08), 0 0 0 1px var(--border) !important;
}

.schedule-refresh-holder {
    display: inline-flex;
}

.schedule-refresh-holder:not(:has(> :not([hidden]))) {
    display: none;
}

.schedule-timeline {
    display: flex;
    background: var(--surface) !important;
}

.schedule-timeline-fixed {
    flex: 0 0 140px;
    min-width: 140px !important;
    margin: 0 !important;
    border-right: 1px solid var(--border);
    background: var(--surface);
    position: relative;
    z-index: 2;
}

.schedule-timeline-corner {
    height: 50px !important;
    margin: 0 !important;
    background: var(--surface-2) !important;
    border-bottom: 1px solid var(--border);
}

.schedule-timeline-labels {
    padding: 12px 0 0 !important;
    background: var(--surface) !important;
    text-align: left !important;
}

.schedule-timeline-label {
    display: flex !important;
    align-items: center;
    height: 40px !important;
    margin: 0 0 12px !important;
    padding: 0 14px !important;
    background: transparent !important;
    font: 600 12.5px/1.2 var(--font) !important;
    color: var(--text-2) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-timeline-label.is-final {
    position: relative;
    color: var(--text) !important;
    font-weight: 700 !important;
}

.schedule-timeline-label.is-final::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -7px;
    border-top: 1px dashed var(--border-strong);
}

.schedule-timeline .schedule-scroller {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 0 6px !important;
    scrollbar-width: thin;
}

.schedule-timeline-holder {
    position: relative;
}

.schedule-timeline-dates {
    display: flex;
    margin: 0 !important;
    background-color: var(--surface-2) !important;
    background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px) !important;
    background-size: var(--schedule-day, 144px) 100% !important;
    border-bottom: 1px solid var(--border);
}

.schedule-timeline-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 50px !important;
    padding: 0 !important;
    background: transparent !important;
    color: var(--muted) !important;
    text-transform: none !important;
}

.schedule-timeline-date span {
    font: 600 10.5px/1 var(--font);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.schedule-timeline-date b {
    font: 650 14px/1 var(--font);
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.schedule-timeline-date.is-wkend span,
.schedule-timeline-date.is-wkend b {
    color: var(--faint);
}

.schedule-timeline-date.is-today span {
    color: var(--accent-ink);
}

.schedule-timeline-date.is-today b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
}

.schedule-timeline-lanes {
    padding-top: 12px;
}

.schedule-timeline-lane {
    margin: 0 !important;
    background-color: transparent !important;
    background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px) !important;
    background-size: var(--schedule-day, 144px) 100% !important;
}

.schedule-timeline-lane > div {
    margin-bottom: 12px !important;
}

.schedule-timeline-lane.is-final {
    position: relative;
    background-color: color-mix(in srgb, var(--accent) 4%, transparent) !important;
}

.schedule-timeline-lane.is-final::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -7px;
    border-top: 1px dashed var(--border-strong);
}

#divRotationView .schedule-slot {
    border-radius: 6px !important;
    border-right: 2px solid var(--surface);
    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 4px !important;
    font: 600 11px/1 var(--font) !important;
}

#divRotationView .schedule-slot.is-stacked {
    font-size: 10px !important;
    border-bottom: 1px solid var(--surface);
}

.schedule-timeline-now-line {
    position: absolute;
    top: 50px;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--crit);
    pointer-events: none;
    z-index: 1;
}

.schedule-timeline-now-line::before {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    width: 9px;
    height: 9px;
    margin-left: -4.5px;
    border-radius: 50%;
    background: var(--crit);
    box-shadow: 0 0 0 2px var(--surface);
}

.schedule-timeline-now-line span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* calendar and history */
.schedule-calendar {
    min-height: 0 !important;
}

.schedule-calendar > .row {
    border-color: var(--border) !important;
    background-color: transparent !important;
    background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px) !important;
}

.schedule-calendar .border-start {
    border-color: var(--border) !important;
}

.schedule-calendar-head > div {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px !important;
    padding: 0 !important;
    background: var(--surface-2) !important;
    color: var(--muted) !important;
    font: 600 10.5px/1 var(--font) !important;
    letter-spacing: 0.06em;
}

.schedule-calendar-week > div.border-start {
    background-color: transparent !important;
}

.schedule-calendar-week > div.border-start.is-out {
    background-color: var(--surface-2) !important;
}

.schedule-calendar-day-number {
    color: var(--text-2);
    font: 600 12px/1 var(--font) !important;
    padding: 5px 0 !important;
    width: 24px !important;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.is-out .schedule-calendar-day-number {
    color: var(--faint);
}

.schedule-calendar-day-number.is-today {
    background: var(--accent) !important;
    color: var(--on-accent) !important;
}

/* timeline range */
.schedule-view-panel:not(:has(#btnTimelineView.active)) .schedule-range-group {
    display: none;
}

.schedule-timeline-range .schedule-timeline-date span {
    white-space: nowrap;
}

.schedule-timeline-range .schedule-scroller {
    overflow: hidden !important;
    padding-bottom: 0 !important;
}

.schedule-timeline-range .schedule-timeline-date {
    min-width: 0;
    overflow: hidden;
}

.schedule-timeline-range.is-dense .schedule-timeline-date b {
    font-size: 12.5px;
}

.schedule-timeline-range.is-dense .schedule-timeline-date.is-today b {
    min-width: 0;
    height: 20px;
    padding: 0 4px;
}

.schedule-timeline-range.is-tiny .schedule-timeline-date b {
    font-size: 10.5px;
}

.schedule-timeline-range.is-tiny .schedule-timeline-date {
    overflow: visible;
    position: relative;
}

.schedule-timeline-range.is-tiny .schedule-timeline-date.is-today {
    z-index: 1;
}

.schedule-timeline-range.is-tiny .schedule-timeline-date.is-today b {
    padding: 0 2px;
    border-radius: 5px;
}

#divRotationView .schedule-slot.is-short {
    padding: 0 !important;
    font-size: 10.5px !important;
    letter-spacing: 0.02em;
}

#divRotationView .schedule-slot.is-narrow {
    font-size: 0 !important;
    padding: 0 !important;
    border-right-width: 1px;
    border-radius: 3px !important;
}

.schedule-legend > div {
    align-items: center;
    margin: 0 !important;
    gap: 8px;
}

.schedule-legend > div > div:first-child {
    width: 12px !important;
    height: 12px !important;
    border: 0 !important;
    border-radius: 4px !important;
    flex: none;
}

.schedule-legend > div > div:last-child {
    margin: 0 !important;
    font: 500 13px/1.3 var(--font) !important;
    color: var(--text-2) !important;
}

/* Add layer */
.routine-add-layer-holder {
    margin: 12px 0 0 !important;
}

@media (max-width: 991.98px) {
    .on-call-now {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    .on-call-now {
        grid-template-columns: minmax(0, 1fr);
    }

    .on-call-now-block {
        padding: 12px 16px;
    }

    .schedule-panel-head {
        padding: 12px 16px;
    }

    .schedule-panel-tools {
        width: 100%;
    }

    .schedule-segment-button {
        flex: 1 1 0;
        justify-content: center;
        padding: 0 6px !important;
    }

    .schedule-timeline-fixed {
        flex-basis: 96px;
        min-width: 96px !important;
    }

    .schedule-timeline-label {
        padding: 0 10px !important;
        font-size: 12px !important;
    }
}
