/**
 * Booking V3 – Latido and Messages steps: doctor, redirect, message (owner F-OTHER).
 * Direction A "Clinic Editorial"; reuses tokens.css and components.css (.bsv3-card, .bsv3-btn,
 * .bsv3-badge, .bsv3-eyebrow, .bsv3-meta, .bsv3-notice). Selectors are ".bsv3 .bsv3-<class>" (>= 0,2,0).
 */

/* ------------------------------------------------------------------ doctor photo (doctor + redirect) */

.bsv3 .bsv3-doctor-photo {
    flex-shrink: 0;
    display: block;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--bs-tint);
    object-fit: cover;
}

.bsv3 .bsv3-doctor-photo--sm {
    width: 64px;
    height: 64px;
}

.bsv3 .bsv3-doctor-photo--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-lead);
}

/* ------------------------------------------------------------------ doctor step */

.bsv3 .bsv3-doctors {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.bsv3 .bsv3-doctors__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.bsv3 .bsv3-doctors__item {
    display: flex;
    min-width: 0;
}

.bsv3 .bsv3-doctor {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    text-align: center;
    transition: border-color var(--bs-motion-fast) var(--bs-ease);
}

.bsv3 .bsv3-doctor:not(.is-selected):hover {
    border-color: var(--bs-line-600);
}

.bsv3 .bsv3-doctor__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.bsv3 .bsv3-doctor__badge {
    margin-bottom: 4px;
}

.bsv3 .bsv3-doctor__name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--bs-text);
}

.bsv3 .bsv3-doctor__spec {
    font-size: var(--bs-fs-small);
    line-height: 1.5;
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-doctor__cta {
    margin-top: auto;
}

@media (max-width: 767px) {
    .bsv3 .bsv3-doctors__list {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .bsv3 .bsv3-doctor {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 12px 16px;
        text-align: left;
    }

    .bsv3 .bsv3-doctor .bsv3-doctor-photo {
        width: 64px;
        height: 64px;
    }

    .bsv3 .bsv3-doctor__body {
        align-items: flex-start;
    }

    .bsv3 .bsv3-doctor__cta {
        grid-column: 1 / -1;
    }
}

/* ------------------------------------------------------------------ redirect step */

.bsv3 .bsv3-redirect {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 640px;
    min-width: 0;
}

.bsv3 .bsv3-redirect__doctor {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bsv3 .bsv3-redirect__who {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bsv3 .bsv3-redirect__name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--bs-text);
}

.bsv3 .bsv3-redirect__spec {
    font-size: var(--bs-fs-small);
    line-height: 1.5;
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-redirect__service {
    margin-top: 4px;
}

.bsv3 .bsv3-redirect__timer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px 20px;
}

.bsv3 .bsv3-redirect__count {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bs-surface);
    box-shadow: inset 0 0 0 2px var(--bs-lead);
    color: var(--bs-lead);
}

.bsv3 .bsv3-redirect__number {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.bsv3 .bsv3-redirect__unit {
    margin-top: 3px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-redirect__icon,
.bsv3 .bsv3-redirect__spinner {
    display: none;
}

.bsv3 .bsv3-redirect__spinner {
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: bsv3-redirect-spin 0.8s linear infinite;
}

@keyframes bsv3-redirect-spin {
    to {
        transform: rotate(360deg);
    }
}

.bsv3 .bsv3-redirect__status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bsv3 .bsv3-redirect__text {
    font-size: var(--bs-fs-body);
    font-weight: 600;
    line-height: 1.5;
    color: var(--bs-text);
}

.bsv3 .bsv3-redirect__text[tabindex="-1"]:focus-visible {
    box-shadow: none;
}

.bsv3 .bsv3-redirect__hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--bs-fs-small);
    line-height: 1.5;
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-redirect__bar {
    grid-column: 1 / -1;
    height: 4px;
    overflow: hidden;
    border-radius: var(--bs-r-pill);
    background: var(--bs-surface);
}

.bsv3 .bsv3-redirect__fill {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--bs-lead);
    transform: scaleX(var(--bsv3-redirect-progress, 0));
    transform-origin: left center;
    transition: transform 200ms linear;
}

/* states: running (number) · paused / idle (clock, no bar) · redirecting (spinner) · invalid (notice) */

.bsv3 .bsv3-redirect:is([data-state="paused"], [data-state="idle"], [data-state="redirecting"]) :is(.bsv3-redirect__number, .bsv3-redirect__unit) {
    display: none;
}

.bsv3 .bsv3-redirect:is([data-state="paused"], [data-state="idle"]) .bsv3-redirect__icon {
    display: inline-flex;
}

.bsv3 .bsv3-redirect:is([data-state="paused"], [data-state="idle"]) .bsv3-redirect__count {
    box-shadow: inset 0 0 0 2px var(--bs-line-600);
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-redirect:is([data-state="paused"], [data-state="idle"]) .bsv3-redirect__bar {
    display: none;
}

.bsv3 .bsv3-redirect[data-state="redirecting"] .bsv3-redirect__spinner {
    display: block;
}

@media (max-width: 767px) {
    .bsv3 .bsv3-redirect__doctor {
        gap: 16px;
    }

    .bsv3 .bsv3-redirect__timer {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px 16px;
    }

    .bsv3 .bsv3-redirect__pause {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bsv3 .bsv3-redirect__fill {
        transition: none;
    }

    .bsv3 .bsv3-redirect__spinner {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.6;
    }
}

/* ------------------------------------------------------------------ message step */

.bsv3 .bsv3-message {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.bsv3 .bsv3-message__content {
    min-width: 0;
    font-size: var(--bs-fs-body);
    line-height: var(--bs-lh-body);
    color: var(--bs-text);
    overflow-wrap: break-word;
}

.bsv3 .bsv3-message__content :is(p, ul, ol, table, blockquote) {
    margin: 0 0 12px;
}

.bsv3 .bsv3-message__content :is(h2, h3, h4, h5) {
    margin: 0 0 10px;
    font-size: var(--bs-fs-heading);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: var(--bs-ls-heading);
    text-transform: uppercase;
    color: var(--bs-lead);
}

.bsv3 .bsv3-message__content :is(p, ul, ol, table, blockquote, h2, h3, h4, h5):last-child {
    margin-bottom: 0;
}

.bsv3 .bsv3-message__content ul {
    padding-left: 20px;
    list-style: disc;
}

.bsv3 .bsv3-message__content ol {
    padding-left: 20px;
    list-style: decimal;
}

.bsv3 .bsv3-message__content li + li {
    margin-top: 4px;
}

.bsv3 .bsv3-message__content img {
    height: auto;
    border-radius: var(--bs-r-control);
}

.bsv3 .bsv3-message__content :is(td, th) {
    padding: 6px 12px 6px 0;
    border-bottom: 1px solid var(--bs-line);
    text-align: left;
    vertical-align: top;
}

.bsv3 .bsv3-message__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/*
 * Layouts used by existing message texts (formerly styled by message_custom_code, which V3 ignores):
 * the Dermatologie note with opening hours (.bs-message-dermatology-*, .tc-column-pure / .oh-*).
 */

.bsv3 .bsv3-message__content .bs-message-dermatology-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: start;
    gap: 32px;
}

.bsv3 .bsv3-message__content .bs-message-phone-link {
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.bsv3 .bsv3-message__content .bs-message-phone-link:hover {
    text-decoration: underline;
}

.bsv3 .bsv3-message__content .tc-column-pure {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bsv3 .bsv3-message__content .oh-title {
    font-size: var(--bs-fs-heading);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: var(--bs-ls-heading);
    text-transform: uppercase;
    color: var(--bs-lead);
}

.bsv3 .bsv3-message__content .oh-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bsv3 .bsv3-message__content .oh-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 6px 8px 6px 16px;
    border-radius: var(--bs-r-control);
    background: var(--bs-tint);
}

.bsv3 .bsv3-message__content .oh-day {
    font-size: var(--bs-fs-small);
    font-weight: 600;
    color: var(--bs-lead);
}

.bsv3 .bsv3-message__content .oh-time {
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bs-surface);
    font-size: var(--bs-fs-small);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--bs-lead);
    font-variant-numeric: tabular-nums;
}

.bsv3 .bsv3-message__content .day-short {
    display: none;
}

@media (max-width: 767px) {
    .bsv3 .bsv3-message__content .bs-message-dermatology-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .bsv3 .bsv3-message__cta {
        width: 100%;
    }
}
