/*
 * BluSup shared component foundation (Pass 11B)
 * Shared structural styling for BB, BH, and common listing/contact components.
 * Project CSS still owns personality, colors, density, and special page polish.
 */

/* Universal component safety */
.bs-listing-grid,
.bb-tour-grid,
.bh-listing-grid,
.bb-category-jump-grid,
.bh-category-grid,
.bs-contact-grid,
.bb-form-grid,
.bh-form-grid {
    min-width: 0;
}

.bs-listing-card,
.bb-tour-card,
.bh-listing-card,
.bs-contact-card,
.bh-contact-card,
.bb-section,
.bh-note-card,
.bh-cta-band {
    min-width: 0;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.bs-listing-card *,
.bb-tour-card *,
.bh-listing-card *,
.bs-contact-card *,
.bh-contact-card * {
    box-sizing: border-box;
    min-width: 0;
}

/* Shared listing image/button behavior. Project CSS can size the media. */
.bs-listing-image-button,
.bb-tour-image-wrap,
.bh-listing-image-button {
    position: relative;
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    overflow: hidden;
    cursor: zoom-in;
    text-align: left;
    font: inherit;
    color: inherit;
}

.bs-listing-image-button:focus-visible,
.bb-tour-image-wrap:focus-visible,
.bh-listing-image-button:focus-visible {
    outline: 2px solid var(--bs-button-border-hover);
    outline-offset: 3px;
}

.bs-listing-image,
.bb-tour-image,
.bh-listing-image {
    display: block;
    width: 100%;
    max-width: 100%;
    object-fit: cover;
}

.bs-image-chip,
.bb-image-chip,
.bh-image-chip {
    pointer-events: none;
    white-space: nowrap;
    line-height: 1.1;
}

/* Shared action rows and buttons. Product CSS keeps color/feel. */
.bs-lead-actions,
.bb-action-row,
.bh-action-row,
.bh-link-row,
.bb-contact-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

[data-bs-lead-action] {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Shared form resilience */
.bs-lead-form,
.bb-form,
.bh-contact-form {
    min-width: 0;
}

.bs-lead-form input,
.bs-lead-form select,
.bs-lead-form textarea,
.bb-form input,
.bb-form select,
.bb-form textarea,
.bh-contact-form input,
.bh-contact-form select,
.bh-contact-form textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Shared fullscreen image viewer shell for BB/BH. */
.bb-image-viewer,
.bh-image-viewer,
.bs-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 10040;
}

.bb-image-viewer[hidden],
.bh-image-viewer[hidden],
.bs-image-viewer[hidden] {
    display: none !important;
}

.bb-image-viewer-backdrop,
.bb-image-viewer-stage,
.bh-image-viewer-backdrop,
.bh-image-viewer-stage,
.bs-image-viewer-backdrop,
.bs-image-viewer-stage {
    position: absolute;
    inset: 0;
}

.bb-image-viewer-backdrop,
.bh-image-viewer-backdrop,
.bs-image-viewer-backdrop {
    background: rgba(10, 24, 38, 0.78);
    backdrop-filter: blur(4px);
}

.bh-image-viewer-backdrop {
    background: rgba(8, 16, 21, 0.82);
}

.bb-image-viewer-stage,
.bh-image-viewer-stage,
.bs-image-viewer-stage {
    display: grid;
    place-items: center;
    padding: 1rem;
}

.bh-image-viewer-stage {
    padding: 2rem 1rem;
}

.bb-image-viewer-shell,
.bh-image-viewer-shell,
.bs-image-viewer-shell {
    position: relative;
    width: min(96vw, 1320px);
    max-height: calc(100dvh - 2rem);
    display: grid;
    gap: 0.7rem;
}

.bh-image-viewer-shell {
    width: min(1100px, 100%);
    max-height: none;
    gap: 0.8rem;
}

.bb-image-viewer-head,
.bh-image-viewer-head,
.bs-image-viewer-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem 0.75rem;
    color: #fff;
    padding-right: 4.75rem;
}

.bb-image-viewer-controls,
.bh-image-viewer-controls,
.bs-image-viewer-controls {
    order: -1;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    justify-content: flex-start;
}

.bb-image-viewer-zoom,
.bb-image-viewer-close,
.bh-image-viewer-zoom,
.bh-image-viewer-close,
.bs-image-viewer-zoom,
.bs-image-viewer-close {
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
    padding: 0.55rem 0.72rem;
    cursor: pointer;
}

.bb-image-viewer-zoom:hover,
.bb-image-viewer-close:hover,
.bh-image-viewer-zoom:hover,
.bh-image-viewer-close:hover,
.bs-image-viewer-zoom:hover,
.bs-image-viewer-close:hover,
.bb-image-viewer-zoom:focus-visible,
.bb-image-viewer-close:focus-visible,
.bh-image-viewer-zoom:focus-visible,
.bh-image-viewer-close:focus-visible,
.bs-image-viewer-zoom:focus-visible,
.bs-image-viewer-close:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    outline: none;
}

.bb-image-viewer-title,
.bh-image-viewer-title,
.bs-image-viewer-title {
    font-size: 1rem;
    line-height: 1.1;
}

.bb-image-viewer-hint,
.bh-image-viewer-hint,
.bs-image-viewer-hint {
    font-size: 0.85rem;
    opacity: 0.78;
    margin-left: auto;
    text-align: center;
}

.bb-image-viewer-frame,
.bh-image-viewer-frame,
.bs-image-viewer-frame {
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #07101a;
    box-shadow: 0 24px 56px rgba(5, 14, 24, 0.35);
    min-height: min(72vh, 760px);
}

.bh-image-viewer-frame {
    min-height: 240px;
    max-height: calc(100vh - 7rem);
    border-radius: 24px;
    background: #07101a;
    box-shadow: none;
}

.bb-image-viewer-image,
.bh-image-viewer-image,
.bs-image-viewer-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(78vh, 900px);
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    cursor: grab;
    touch-action: none;
    will-change: transform;
    transform-origin: center center;
}

.bb-image-viewer-image {
    max-width: 100%;
}

.bh-image-viewer-image {
    max-height: calc(100vh - 9rem);
}

.bb-image-viewer-image.is-dragging,
.bh-image-viewer-image.is-dragging,
.bs-image-viewer-image.is-dragging {
    cursor: grabbing;
}

body.bb-image-viewer-open,
body.bh-image-viewer-open,
body.bs-image-viewer-open {
    overflow: hidden;
}

@media (max-width: 820px) {
    .bs-lead-actions,
    .bb-action-row,
    .bh-action-row,
    .bh-link-row {
        width: 100%;
    }
}

@media (max-width: 700px) {
    .bb-image-viewer-stage,
    .bh-image-viewer-stage,
    .bs-image-viewer-stage {
        padding: 0.75rem;
    }

    .bb-image-viewer-shell,
    .bs-image-viewer-shell {
        width: min(98vw, 1320px);
        max-height: calc(100dvh - 1.5rem);
    }

    .bb-image-viewer-head,
    .bh-image-viewer-head,
    .bs-image-viewer-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
        padding-right: 4.5rem;
    }

    .bb-image-viewer-hint,
    .bh-image-viewer-hint,
    .bs-image-viewer-hint {
        margin-left: 0;
        text-align: left;
    }

    .bb-image-viewer-frame,
    .bs-image-viewer-frame {
        min-height: min(68vh, 620px);
    }

    .bb-image-viewer-image,
    .bs-image-viewer-image {
        max-height: min(72vh, 760px);
    }
}

@media (max-width: 640px) {
    .bs-lead-actions,
    .bb-action-row,
    .bh-action-row,
    .bh-link-row,
    .bb-contact-card-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    [data-bs-lead-action] {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}
