/**
 * Shared styles for product detail pages.
 * Use class "product-gallery-carousel" on the Bootstrap carousel element.
 */

/* =====================================================
   UniFi-inspired product page layout (desktop-first)
   ===================================================== */

.product-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 48px 0 64px;
    background: #fff;
}

.product-page-inner {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Product switcher */
.product-page-nav {
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 20px;
    background: #fff;
}

.product-page-nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.product-page-nav-scroll {
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-page-nav-scroll-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    background: #fff;
    color: #4a4a4a;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.product-page-nav-scroll-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.product-page-nav-scroll-btn:hover:not(:disabled) {
    color: #111;
    border-color: #c8c8c8;
    background: #f8f8f8;
}

.product-page-nav-scroll-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.product-page-nav-scroll:not(.product-page-nav-scroll--overflow) .product-page-nav-scroll-btn {
    display: none;
}

.product-page-nav-track {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding: 4px 0 6px;
    min-height: 0;
}

.product-page-nav-track::-webkit-scrollbar {
    display: none;
}

.product-page-nav-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    color: #4a4a4a;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid #e0e0e0;
    border-radius: 999px;
    background: #fff;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.product-page-nav-item:hover {
    color: #111;
    border-color: #c8c8c8;
    text-decoration: none;
}

.product-page-nav-item.active {
    color: #fff;
    background: var(--bs-primary, #063F5B);
    border-color: var(--bs-primary, #063F5B);
    font-weight: 600;
}

/* Hero section */
.product-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 48px;
    align-items: start;
    margin-bottom: 48px;
}

.product-hero-media {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.product-hero-media > .text-center,
.product-hero-media > .product-gallery-stack,
.product-hero-media > .product-gallery-carousel {
    margin-bottom: 0 !important;
}

.product-hero-media .doc-wrapper {
    margin-bottom: 0;
}

.product-hero-media #ports-and-dimensions {
    margin-top: 0;
}

.product-hero-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding-top: 8px;
}

.product-hero-info .product-title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 4px;
    color: #111;
}

.product-hero-info .product-sku {
    font-size: 0.9375rem;
    line-height: 1.4;
    color: #6b6b6b;
    margin: 0 0 16px;
}

.product-hero-features {
    margin-bottom: 16px;
}

.product-feature-block {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fafafa;
}

.product-feature-block--platform {
    background: #f5f7fb;
}

.product-feature-block-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #111;
}

.product-feature-list {
    margin: 0;
    padding-left: 1.15rem;
    font-size: 0.875rem;
    color: #4a4a4a;
    line-height: 1.45;
}

.product-feature-list li {
    margin-bottom: 6px;
}

.product-feature-list li:last-child {
    margin-bottom: 0;
}

.product-feature-label {
    font-weight: 600;
    color: #111;
}

.product-feature-block-text {
    font-size: 0.875rem;
    color: #4a4a4a;
    margin: 0;
    line-height: 1.55;
}

.product-hero-info .product-actions {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.product-purchase-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 40px;
}

.product-purchase-price {
    font-size: 1.375rem;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
    white-space: nowrap;
}

.product-quantity-control {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.product-qty-btn {
    appearance: none;
    border: none;
    background: #fff;
    color: #111;
    width: 36px;
    min-height: 40px;
    padding: 0;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.product-qty-btn:hover {
    background: #f5f5f5;
}

.product-qty-input {
    width: 44px;
    min-height: 40px;
    border: none;
    border-left: 1px solid #d0d0d0;
    border-right: 1px solid #d0d0d0;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111;
    padding: 0;
    -moz-appearance: textfield;
}

.product-qty-input::-webkit-outer-spin-button,
.product-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-hero-info .product-cta,
.product-hero-info .product-actions .btn {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    padding: 10px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
    box-sizing: border-box;
}

.product-hero-info .product-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #4a4a4a;
    margin: 0 0 20px;
    width: 100%;
}

/* Hero gallery carousel (desktop + mobile) */
.product-hero-media .product-gallery-carousel--hero {
    width: 100%;
    margin-bottom: 0;
}

.product-hero-media .product-gallery-carousel--hero .carousel-item,
.product-hero-media .product-gallery-carousel--hero .product-model-viewer,
.product-hero-media .product-gallery-carousel--hero .product-model-viewer-fallback {
    height: 420px;
}

.product-hero-media .product-gallery-carousel--hero .carousel-item img,
.product-hero-media .product-gallery-carousel--hero .carousel-item video {
    max-height: 420px;
}

.product-hero-media .product-image-main {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
}

/* Technical specs section */
.product-specs-section {
    border-top: 1px solid #e8e8e8;
    padding-top: 0;
}

/* Pages with several media tabs (LEDs, Installation, In The Box…) outgrow a
   phone's width — the strip scrolls sideways like .product-page-nav-track
   rather than forcing the whole page wide. */
.product-specs-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.product-specs-tabs::-webkit-scrollbar {
    display: none;
}

.product-specs-tab {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 16px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #4a4a4a;
    cursor: default;
    flex: 0 0 auto;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .product-specs-tab {
        padding: 14px 14px;
        font-size: 0.875rem;
    }
}

.product-specs-tab.active {
    color: #111;
    border-bottom-color: var(--bs-primary, #0d6efd);
}

.product-specs-panel {
    padding: 32px 0 0;
}

.product-specs-panel .doc-wrapper {
    margin-bottom: 0;
}

.product-specs-panel .row {
    margin: 0;
}

.product-specs-panel .table {
    margin-bottom: 0;
    border: none;
}

.product-specs-panel .table > :not(caption) > * > * {
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.product-specs-panel .table thead th {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111;
    padding: 28px 0 12px;
    border-bottom: 1px solid #e0e0e0;
    background: transparent;
}

.product-specs-panel .table thead:first-child th {
    padding-top: 0;
}

.product-specs-panel .table tbody th[scope="row"] {
    width: 38%;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #4a4a4a;
    padding-right: 24px;
}

.product-specs-panel .table tbody td {
    font-size: 0.9375rem;
    color: #111;
    line-height: 1.55;
}

@media (max-width: 991.98px) {
    .product-page {
        padding-top: 0;
        padding-bottom: 48px;
    }

    .product-hero {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .product-hero-info {
        padding-top: 0;
    }

    .product-hero-info .product-title {
        font-size: 1.75rem;
    }

    .product-hero-media .product-image-main {
        max-height: 300px;
    }

}

@media (max-width: 767.98px) {
    .product-page-inner {
        padding: 0 16px;
    }

    .product-page-nav-inner {
        padding: 0 12px;
    }

    .product-page-nav-scroll {
        gap: 2px;
    }

    .product-page-nav-scroll-btn {
        width: 26px;
        height: 26px;
    }

    .product-specs-panel .table tbody th[scope="row"] {
        width: 42%;
        padding-right: 12px;
    }
}

/* =====================================================
   3D model gallery (existing)
   ===================================================== */

.product-gallery-carousel {
    --product-gallery-control-bg: rgba(195, 195, 195, 0.5);
}

/* Product 3D model viewer */
.product-model-viewer {
    width: 100%;
    height: 320px;
    background-color: #ffffff;
    border-radius: 8px;
    display: block;
    margin: 0;
}

/* Prevent carousel swipe when touching model-viewer (so AR button and 3D rotate work on mobile) */
.product-gallery-carousel .product-model-viewer {
    touch-action: none;
}

.product-model-viewer-fallback {
    width: 100%;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 8px;
    color: #666;
}

/* Carousel indicators: visible pill and dots. Static (not the Bootstrap
   bottom overlay) so the pill never covers the slide image. */
.product-gallery-carousel .carousel-indicators {
    position: static;
    width: max-content;
    margin: 10px auto 0;
    background: rgba(255, 255, 255, 0.5);
    padding: 8px 12px;
    border-radius: 20px;
}

.product-gallery-carousel .carousel-indicators [data-bs-slide-to] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--product-gallery-control-bg);
    opacity: 0.8;
}

.product-gallery-carousel .carousel-indicators [data-bs-slide-to].active {
    background-color: #767575;
    opacity: 1;
}

/* Prev/Next control buttons */
.product-gallery-carousel .carousel-control-prev-icon,
.product-gallery-carousel .carousel-control-next-icon {
    background-color: var(--product-gallery-control-bg);
    padding: 12px;
    border-radius: 50%;
}

/* Match model height so no empty band below 3D on mobile */
.product-gallery-carousel .carousel-item {
    height: 320px;
}

/* No large gap under desktop 3D model (override .doc-wrapper margin) */
.product-gallery-stack > .doc-wrapper:first-child {
    margin-bottom: 0;
}

/* Fill the slide (320px, or 420px in the hero) so the centering below is
   measured against the slide's real height — otherwise content sits in the
   top 320px of a taller slide and reads as top-aligned. */
.product-gallery-carousel .carousel-item .doc-wrapper,
.product-gallery-carousel .carousel-item .text-center {
    min-height: 320px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.product-gallery-carousel .carousel-item img,
.product-gallery-carousel .carousel-item video,
.product-gallery-stack .product-gallery-video {
    max-height: 320px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.product-gallery-media-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: inherit;
}

.product-gallery-expand-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    z-index: 20;
    padding: 8px 10px;
    font-size: 0.9rem;
}

.product-gallery-video {
    cursor: pointer;
}

.lightbox-content--video {
    max-width: 95%;
    max-height: 95%;
    outline: none;
}

/* Placeholder until model-viewer loads (optional: add .model-viewer-wrapper around placeholder + model-viewer) */
.product-gallery-carousel .model-viewer-wrapper,
.product-gallery-stack .model-viewer-wrapper {
    position: relative;
    min-height: 320px;
}

.product-gallery-carousel .model-viewer-wrapper .model-viewer-placeholder,
.product-gallery-stack .model-viewer-wrapper .model-viewer-placeholder {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-gallery-carousel .model-viewer-wrapper .model-viewer-reveal,
.product-gallery-stack .model-viewer-wrapper .model-viewer-reveal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.product-gallery-carousel .model-viewer-wrapper.model-viewer-loaded .model-viewer-placeholder,
.product-gallery-stack .model-viewer-wrapper.model-viewer-loaded .model-viewer-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.product-gallery-carousel .model-viewer-wrapper.model-viewer-loaded .model-viewer-reveal,
.product-gallery-stack .model-viewer-wrapper.model-viewer-loaded .model-viewer-reveal {
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

/* Model viewer container: for expand button positioning */
.product-model-viewer-container {
    position: relative;
}

/* Expand button: bottom right, opens model in lightbox */
.product-model-expand-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    z-index: 20;
    padding: 8px 10px;
    font-size: 0.9rem;
}

/* 3D model in lightbox: enlarged like images */
.lightbox-model-viewer {
    width: 90vw;
    height: 90vh;
    max-width: 900px;
    max-height: 700px;
    background: #fff;
    border-radius: 8px;
}

/* AR button: icon only */
.product-model-viewer .ar-icon-btn {
    padding: 8px 10px;
    font-size: 1rem;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    cursor: pointer;
    color: #333;
}
.product-model-viewer .ar-icon-btn:hover {
    background: #fff;
    color: #000;
}

/* Datasheet download — sits under the quote CTA in the hero actions.
   Injected by product-page-layout.js when assets/datasheets/manifest.json
   lists a sheet for this product. */
.product-hero-info .product-actions .product-datasheet {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0;
    color: var(--bs-primary, #063F5B);
    border-color: #cfd9e3;
    background: #fff;
}

.product-hero-info .product-actions .product-datasheet:hover,
.product-hero-info .product-actions .product-datasheet:focus-visible {
    color: #fff;
    background: var(--bs-primary, #063F5B);
    border-color: var(--bs-primary, #063F5B);
}

.product-hero-info .product-actions .product-datasheet i {
    font-size: 0.95em;
}
