/* Product Detail Page v3 - New UI */
/* All classes prefixed with p3- to avoid collision with products.css */

/* Hide Alpine-dependent elements until initialized */
[x-cloak] {
    display: none !important;
}

/* Prevent horizontal overflow on mobile */
html, body {
    overflow-x: hidden;
}

/* ========================================
   LAYOUT
   ======================================== */

#p3-layout {
    display: grid;
    grid-template-columns: 48% 1fr;
    gap: 30px;
    margin-top: 15px;
    margin-bottom: 30px;
}

/* ========================================
   1. STAR RATING (under H1)
   ======================================== */

.p3-star-rating {
    margin-top: -8px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #555;
}

.p3-star-rating .p3-stars {
    color: #f5a623;
    font-size: 16px;
    letter-spacing: 1px;
    margin-right: 5px;
}

.p3-star-rating a {
    color: #1f9bdf;
    text-decoration: none;
}

.p3-stars-container {
    display: inline-block;
    position: relative;
    color: #ddd;
    font-size: 16px;
    letter-spacing: 1px;
    margin-right: 5px;
    vertical-align: 1px;
}

.p3-stars-filled {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    white-space: nowrap;
    color: #f5a623;
}

.p3-star-rating a:hover {
    text-decoration: underline;
}

/* ========================================
   2. CTA BUTTON — brand blue, not green
   ======================================== */

.p3-cta-btn {
    display: block;
    width: 100%;
    padding: 14px 30px;
    font-size: 18px;
    font-family: "MuseoSlab500Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: bold;
    color: #ffffff;
    background-color: #1f9bdf;
    border: none;
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.p3-cta-btn:hover {
    background-color: #1a85c4;
    color: #ffffff;
    text-decoration: none;
}

.p3-cta-subtext {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin-bottom: 20px;
}

/* ========================================
   3. PRICE CALLOUT — brand blue accent
   ======================================== */

.p3-price-callout {
    font-size: 18px;
    font-weight: bold;
    color: #1f9bdf;
    margin-bottom: 12px;
}

.p3-price-callout small {
    font-size: 13px;
    font-weight: normal;
    color: #888;
}

/* ========================================
   4. DELIVERY BADGES (CustomInk-style)
   ======================================== */

.p3-delivery-row {
    display: flex;
    gap: 24px;
    margin-bottom: 18px;
}

.p3-delivery-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.p3-badge-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.p3-badge-free {
    background-color: #f0f0f0;
    color: #555;
}

.p3-badge-rush {
    background-color: #fef7ec;
    color: #c4850c;
}

.p3-badge-text {
    display: flex;
    flex-direction: column;
}

.p3-badge-label {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    line-height: 1.2;
}

.p3-badge-date {
    font-size: 12px;
    color: #777;
    line-height: 1.2;
}

/* ========================================
   5. IMAGE GALLERY / THUMB STRIP
   ======================================== */

#p3-image-gallery {
    position: relative;
}

.p3-main-image-wrapper {
    position: relative;
    background-color: #f6f8f7;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p3-main-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    display: block;
    object-fit: contain;
}

.p3-thumb-strip {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
}

.p3-thumb {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: #f6f8f7;
    transition: border-color 0.2s ease;
    flex-shrink: 0;
}

.p3-thumb:hover,
.p3-thumb.active {
    border-color: #1f9bdf;
}

/* ========================================
   6. COLOR SWATCHES
   ======================================== */

.p3-swatches-label {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    font-weight: bold;
}

.p3-swatches-label span {
    font-weight: normal;
    color: #1f9bdf;
}

.p3-swatches-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.p3-swatch {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.p3-swatch:hover {
    border-color: #999;
    transform: scale(1.1);
}


/* ========================================
   7. TRUST BAR
   ======================================== */

.p3-trust-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 25px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin: 30px 0;
    clear: both;
}

.p3-trust-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 14px;
}

.p3-trust-item svg {
    flex-shrink: 0;
    color: #1f9bdf;
}

.p3-trust-item strong {
    font-family: "MuseoSlab500Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ========================================
   8. CUSTOMER PHOTOS
   ======================================== */

.p3-customer-photos {
    margin: 30px 0;
}

.p3-customer-photos h3 {
    font-family: "MuseoSlab500Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: #5b6f82;
    margin-bottom: 15px;
}

.p3-photos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.p3-photos-grid img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}

/* ========================================
   10. STICKY MOBILE CTA — brand blue
   ======================================== */

.p3-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: #ffffff;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.p3-sticky-cta .p3-sticky-price {
    font-size: 20px;
    font-weight: bold;
    color: #1f9bdf;
    flex-shrink: 0;
}

.p3-sticky-cta .p3-sticky-price small {
    display: block;
    font-size: 12px;
    font-weight: normal;
    color: #888;
}

.p3-sticky-cta .p3-sticky-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 17px;
    font-weight: bold;
    color: #ffffff;
    background-color: #1f9bdf;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
}

/* ========================================
   PRODUCT INFO SECTION
   ======================================== */

#p3-product-info {
    padding-top: 5px;
}

.p3-pricing-section {
    margin-bottom: 24px;
    padding-top: 18px;
    border-top: 1px solid #eee;
}

.p3-pricing-section h3 {
    font-family: "MuseoSlab500Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.p3-price-table {
    font-size: 14px;
    color: #555;
    line-height: 2;
}

.p3-price-guarantee {
    font-size: 13px;
    color: #888;
    margin-top: 10px;
}

.p3-details-section {
    margin-bottom: 24px;
    padding-top: 18px;
    border-top: 1px solid #eee;
}

.p3-details-section h3 {
    font-family: "MuseoSlab500Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 18px;
    color: #333;
    margin-bottom: 12px;
}

.p3-details-section .p3-detail-row {
    margin-bottom: 14px;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.p3-details-section .p3-detail-row strong {
    display: block;
    color: #333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.p3-sample-order {
    font-size: 13px;
    color: #8B9AA7;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.p3-sample-order a {
    color: #8B9AA7;
    text-decoration: underline;
}

/* ========================================
   REVIEWS SECTION
   ======================================== */

.p3-reviews-section {
    margin: 30px 0;
    clear: both;
}

.p3-reviews-section h3 {
    font-family: "MuseoSlab500Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: #5b6f82;
    margin-bottom: 8px;
}

.p3-reviews-summary {
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
}

.p3-review-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.p3-review-item .p3-review-author {
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
}

/* ========================================
   DELIVERY SECTION (within product info)
   ======================================== */

.p3-delivery-section {
    margin-bottom: 24px;
    padding-top: 18px;
    border-top: 1px solid #eee;
}

.p3-delivery-section h3 {
    font-family: "MuseoSlab500Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

/* ========================================
   RESPONSIVE — TABLET
   ======================================== */

@media (max-width: 1000px) {
    #sidebar {
        display: none;
    }
    #page-content-wrapper {
        width: 100%;
        padding: 0 20px;
        box-sizing: border-box;
    }
}

/* ========================================
   RESPONSIVE — MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Add spacing above h1 and star rating on mobile */
    #page-content-wrapper h1 {
        margin-top: 15px;
    }

    .p3-star-rating {
        margin-top: 0;
        margin-bottom: 15px;
    }

    #p3-layout {
        grid-template-columns: 1fr;
        gap: 15px;
        min-width: 0;
    }

    #p3-image-gallery,
    #p3-product-info {
        min-width: 0;
        max-width: 100%;
    }

    /* Fix related products: 2 columns on mobile via grid */
    #related-products .related-products-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    #related-products .related-products-grid:after {
        display: none !important;
    }
    #related-products .related-product-item {
        float: none !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
    }

    /* Constrain image so CTA is visible above the fold */
    .p3-main-image-wrapper {
        height: 300px;
    }

    .p3-thumb-strip {
        gap: 6px;
        margin-top: 8px;
    }

    .p3-thumb {
        width: 50px;
        height: 50px;
    }

    /* Smaller swatches on mobile to reduce vertical space */
    .p3-swatch {
        width: 28px;
        height: 28px;
        border-radius: 3px;
    }

    .p3-swatches-grid {
        gap: 5px;
        margin-bottom: 15px;
    }

    .p3-trust-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 18px 15px;
    }

    .p3-photos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Ensure text doesn't clip */
    #p3-product-info {
        padding: 0;
        overflow: hidden;
    }

    .p3-details-section .p3-detail-row {
        padding-right: 5px;
    }

    .p3-pricing-section,
    .p3-details-section,
    .p3-delivery-section,
    .p3-sample-order {
        padding-right: 5px;
    }

    .p3-cta-btn {
        font-size: 16px;
        padding: 13px 20px;
    }

    .p3-price-callout {
        font-size: 16px;
    }

    .p3-delivery-row {
        gap: 16px;
    }

    .p3-badge-icon {
        width: 28px;
        height: 28px;
    }

    .p3-badge-icon svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 550px) {
    #breadcrumb-wrapper {
        display: none;
    }

    #page-content-wrapper h1 {
        font-size: 22px;
        margin-bottom: 5px;
    }

    .p3-main-image-wrapper {
        height: 260px;
    }

    .p3-swatch {
        width: 26px;
        height: 26px;
    }

    .p3-swatches-grid {
        gap: 4px;
    }

    .p3-thumb {
        width: 44px;
        height: 44px;
    }
}
