/* Externalized Product Styles - Cached and Reused */

/* Shop Navigation */
.shop-nav {
    width: 100%;
    max-width: 100%; /* Prevent JS inline width from overflowing viewport */
    display: flex;
    flex-direction: column;
    gap: 1em;
    padding: 1em 2em;
    margin-bottom: 1em;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    opacity: 1;
    box-sizing: border-box;
}

.shop-nav-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}


/* Archives Navigation - Same layout as shop-nav */
.archives-nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 1em;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}


.archives-nav.visible {
    opacity: 1;
}

.archives-nav-left {
    justify-self: start;
}

.archives-nav-center {
    justify-self: center;
}

.archives-nav-right {
    justify-self: end;
}

/* Desktop: Full width navigation */
@media (min-width: 768px) {
    .archives-nav {
        width: 100%;
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mobile: stack vertically */
@media (max-width: 767px) {
    .archives-nav {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 1em;
        padding: 0 1em;
        box-sizing: border-box;
    }

    .archives-nav-left {
        grid-column: 1;
        grid-row: 1;
    }

    .archives-nav-right {
        grid-column: 2;
        grid-row: 1;
    }

    .archives-nav-center {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

/* Desktop: Full width navigation */
@media (min-width: 768px) {
    .shop-nav {
        width: 100%;
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
}

.shop-nav-left {
    text-align: left;
}

.shop-nav-center {
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.shop-nav-right {
    text-align: right;
}

/* Mobile: adjust padding */
@media (max-width: 767px) {
    .shop-nav {
        padding: 1em;
    }
}

.pagination {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pagination span.pages {
    font-size: 1rem;
    min-width: 2em;
}

.cart-button {
    color: #999;
    text-decoration: none;
}

/* Cart count styling */
.view-cart-btn-qty,
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: black;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.cart-v2 .view-cart-btn {
    position: relative;
}

/* Hide count when empty */
.cart-count:empty {
    display: none;
}
/* Hide zero count - handled via data attribute in PHP */
.cart-count[data-count="0"] {
    display: none;
}

/* Remove Fancybox padding for product info iframes */
.fancybox__slide--iframe {
    padding: 0 !important;
}

.fancybox__slide--iframe .f-html {
    padding: 0 !important;
}

.fancybox__slide--iframe .f-iframe {
    padding: 0 !important;
}

.fancybox__content {
    padding: 0 !important;
}

/* Additional iframe-specific padding removal */
.fancybox__slide--iframe .fancybox__iframe {
    padding: 0 !important;
    margin: 0 !important;
}

/* CompactHeading link styling */
.compact-heading-header a {
    text-decoration: underline;
    text-decoration-color: var(--color-inline-heading);
    text-underline-offset: 0.2em;
}

.compact-heading-header a:hover {
    text-decoration-color: currentColor;
}

/* Product Grid with fade-in animation */
.inline-product-category {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end; /* Align products at bottom for consistent photo alignment */
    animation: fadeIn 0.8s ease-in-out;
    width: 100%;
    margin: 0 auto;
    clear: both;
}

/* Fade-in animation for product grid */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.inline-product {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    color: #999999;
    margin: 2em 2em;
}

/* Product Gallery */
.product-gallery-wrapper {
    position: relative;
    display: block;
}

.product-gallery-wrapper > a:first-child {
    display: block;
    margin-bottom: 1.3em;
}

.product-gallery-wrapper img {
    display: block;
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .inline-product {
        width: 100%;
        max-width: 100%;
        margin: 1em 0;
        box-sizing: border-box;
    }

    .product-gallery-wrapper {
        width: min(100%, calc(100vw - 20px));
        max-width: calc(100vw - 20px);
        margin-inline: auto;
        box-sizing: border-box;
    }

    .product-gallery-wrapper > a:first-child {
        width: 100%;
        max-width: 100%;
    }

    .product-gallery-wrapper img,
    .product-gallery-wrapper > div {
        width: 100% !important;
        max-width: 100%;
        height: auto;
        box-sizing: border-box;
    }

    .product-gallery-wrapper > div[style*="width:600px"] {
        aspect-ratio: 3 / 2;
        height: auto !important;
    }
}

/* Video Thumbnail in Gallery */
.video-thumbnail-wrapper {
    position: relative;
    display: inline-block;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.video-thumbnail-wrapper:hover .video-play-overlay {
    transform: translate(-50%, -50%) scale(1.15);
    color: #fff;
}

/* Product Info Container */
.inline-product-info-container {
    display: block;
    max-width: 90%;
    margin: 0 auto;
    width: 100%;
}

.inline-product-card {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

/* Centered Split Variation - Most Common */
.inline-product-card.centered-split {
    min-height: 70px;
    position: relative;
    display: flex;
    align-items: center;
    padding: 2px 0 2rem 0;
}

.centered-left-split {
    position: absolute;
    left: 0.3rem;
    top: 0.25rem;
    text-align: left;
    max-width: 30%;
}

.measurement-split {
    font-size: 0.95em;
    opacity: 0.9;
    line-height: 1.2;
    font-weight: 500;
    margin-bottom: 2px;
}

.category-split {
    font-size: 0.85em;
    opacity: 0.8;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.centered-center-split {
    position: absolute;
    left: 50%;
    top: 0.25rem;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
}

.centered-center-split .cart-button-container {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: auto !important;
}

.centered-center-split .in-cart-text-button {
    position: relative;
    display: flex;
    align-items: center;
}

/* Position × icon button next to "In Cart" button */
.centered-center-split .cart-button-container .remove-from-cart-btn {
    position: absolute !important;
    left: calc(100% + 0.5em) !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin-left: 0 !important;
}

.centered-right-split {
    position: absolute;
    right: 0.3rem;
    top: 0.25rem;
    text-align: right;
    max-width: 30%;
}

.centered-price-split {
    font-size: 1.1em;
    font-weight: bold;
    line-height: 1.2;
    white-space: nowrap;
}

.availability-centered-split {
    font-size: 0.8em;
    opacity: 0.6;
    margin-top: 2px;
    white-space: nowrap;
}

/* Cart Buttons */
.add-to-cart-text-button {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4CAF50;
    padding: 6px 12px;
    font-size: 0.85em;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.add-to-cart-text-button:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
}

.add-to-cart-text-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.in-cart-text-button {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #FF9800;
    padding: 6px 12px;
    font-size: 0.85em;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.in-cart-text-button:hover {
    background: rgba(255, 152, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.5);
}

/* Circular icon button (× symbol) next to "In Cart" */
.cart-button-container .remove-from-cart-btn {
    background: rgba(255, 67, 67, 0.1);
    border: 1px solid rgba(255, 67, 67, 0.3);
    color: #ff4343;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin-left: 0.3em;
}

.cart-button-container .remove-from-cart-btn:hover {
    background: rgba(255, 67, 67, 0.2);
    border-color: rgba(255, 67, 67, 0.5);
}

/* Text-based action links on cart page */
.centered-center-split .cart-product-actions {
    display: block !important;
    padding-top: 12px;
}

.centered-center-split .cart-product-actions a {
    display: block !important;
    position: static !important; /* Override absolute positioning */
    margin-bottom: 0.3em !important;
    text-decoration: underline;
    cursor: pointer;
    transform: none !important; /* Override transform */
    left: auto !important; /* Override left positioning */
    top: auto !important; /* Override top positioning */
}

.centered-center-split .cart-product-actions a:last-child {
    margin-bottom: 0 !important;
}

/* Product details link */
.centered-left-split .product-details-link {
    font-size: 0.85em;
    opacity: 0.6;
    text-decoration: underline;
    color: #4a9eff;
    margin-top: 0.1em;
    padding: 0.2em 0.4em;
    display: block;
    line-height: 1.2;
}

.centered-left-split .product-details-link:hover {
    opacity: 0.9;
}

/* Ensure touch-friendly on mobile */
@media (max-width: 768px) {
    .product-details-link {
        padding: 0.8em 1em;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Native dialog styling */
.product-info-dialog {
    width: 100%;
    max-width: min(95vw, 1200px);
    max-height: 95vh;
    padding: 0;
    margin: auto;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    overflow-y: auto;
    box-shadow: 0 0 3rem rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Hide the inner container's border when inside dialog */
.product-info-dialog > div > div {
    border: none !important;
    box-shadow: none !important;
    min-height: auto !important;
    padding: clamp(0.5rem, 2vw, 1rem) clamp(1rem, 4vw, 2.5rem) 0.5rem clamp(1rem, 4vw, 2.5rem) !important;
}

/* Remove bottom margin from the US map */
.product-info-dialog img[src*="us.svg"] {
    margin-bottom: 0 !important;
    display: block !important;
}

/* Remove bottom padding from last child */
.product-info-dialog > div > div > div:last-child,
.product-info-dialog .f-html > div > div {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

.product-info-dialog::backdrop {
    background: rgba(0, 0, 0, 0.85);
    /* backdrop-filter: blur(4px); */ /* Disabled - causes 5 second delay on modal open */
}

.dialog-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 67, 67, 0.1);
    border: 1px solid rgba(255, 67, 67, 0.3);
    color: #ff4343;
    font-size: 2em;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.2s;
}

.dialog-close:hover {
    background: rgba(255, 67, 67, 0.2);
    border-color: rgba(255, 67, 67, 0.5);
}


/* Mobile adjustments */
@media (max-width: 768px) {
    .dialog-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 1.5em;
    }
}

/* Product Info Popup */
.product-info-popup {
    padding: 2rem;
    max-width: min(95vw, 1200px);
    background: #0d0d0d;
    color: #d9d9d9;
}

.product-info-popup h2 {
    margin: 0 0 1rem 0;
    font-size: 1.8rem;
    color: #fff;
}

.product-sku {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.product-price {
    font-size: 2rem;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 1.5rem;
}

.add-to-cart-popup {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4CAF50;
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.add-to-cart-popup:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #d9d9d9;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    color: #999;
    font-size: 0.9rem;
}

/* Loading State */
.shop-loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: #999;
}

/* Fancybox inline content styling for product info */
.fancybox__slide--inline .fancybox__content {
    background: transparent !important;
    padding: 0 !important;
}

.fancybox__slide--inline > .f-html {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
}

/* Ensure inline product info has proper z-index and visibility */
.fancybox__slide--inline [id^="product-info-"] {
    position: relative !important;
    z-index: 10 !important;
    display: block !important;
}

/* Override any transparency issues */
.fancybox__slide--inline [id^="product-info-"] > div {
    position: relative !important;
    z-index: 10 !important;
    background: rgba(13, 13, 13, 0.98) !important;
}

/* Ensure text is visible and not compressed */
.fancybox__slide--inline .inline-product-info-container {
    opacity: 1 !important;
    color: #d9d9d9 !important;
}

.fancybox__slide--inline .inline-product-info-container * {
    opacity: 1 !important;
}

/* Fix any text squishing issues */
.fancybox__slide--inline .product-info-field {
    margin-bottom: 0.8em !important;
    line-height: 1.5 !important;
}

.fancybox__slide--inline .product-info-label {
    display: inline-block !important;
    min-width: 120px !important;
    margin-right: 1em !important;
}

.fancybox__slide--inline .product-info-value {
    display: inline-block !important;
}
