/* ========================================
   TRUSTMARY REVIEWS WIDGET - POSITION BELOW PRODUCT
   ======================================== */

.krisette-trustmary-reviews {
    width: 100%;
    order: 4 !important;
    clear: both;
    margin-top: 40px;
    margin-bottom: 20px;
}

/* Ensure the product page content area uses flexbox for ordering */
.woocommerce div.product {
    display: flex;
    flex-wrap: wrap;
}

.woocommerce div.product > .woocommerce-product-gallery {
    order: 1;
}

.woocommerce div.product > .summary {
    order: 2;
}

.woocommerce div.product > .woocommerce-tabs {
    order: 3;
}

.woocommerce div.product > .krisette-trustmary-reviews {
    order: 4;
}

.woocommerce div.product > .you-might-also-like-section {
    order: 5;
}

/* ========================================
   PRODUCT TITLE - ENSURE VISIBILITY
   ======================================== */

.woocommerce div.product .product_title,
.woocommerce div.product .summary .product_title {
    display: block !important;
    visibility: visible !important;
    font-size: 2rem;
    font-weight: 300;
    color: #333;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
}

/* ========================================
   PRODUCT GALLERY - PREVENT IMAGE STRETCHING
   ======================================== */

/* Main gallery wrapper - consistent height */
.woocommerce-product-gallery {
    position: relative;
}

/* Main image container - fixed aspect ratio to prevent jumping */
.woocommerce-product-gallery__wrapper {
    min-height: 400px;
}

.woocommerce-product-gallery__image {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 400px;
}

/* Main product image - prevent stretching */
.woocommerce-product-gallery__image img,
.woocommerce-product-gallery__wrapper img,
.woocommerce div.product div.images img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    object-position: top center;
}

/* Gallery thumbnails - match main image width */
.woocommerce-product-gallery .flex-control-thumbs {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 100%;
}

.woocommerce-product-gallery .flex-control-thumbs li {
    flex: 0 0 auto;
    width: calc(20% - 8px); /* 5 thumbnails per row */
    list-style: none;
    margin: 0;
    padding: 0;
}

.woocommerce-product-gallery .flex-control-thumbs img {
    width: 100%;
    height: auto;
    object-fit: cover;
    cursor: pointer;
}

/* Prevent zoom from distorting images */
.woocommerce-product-gallery .zoomImg {
    object-fit: contain;
}

/* ========================================
   VARIATION LABELS - ENSURE VISIBILITY
   ======================================== */

/* Variations table layout */
.woocommerce div.product .variations td {
    padding: 0;
    border: none;
    background: none;
    display: block;
}

/* Variation labels - visible and styled */
.woocommerce div.product .variations .label,
.woocommerce div.product .variations th.label,
.woocommerce div.product .variations label {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-weight: 500;
    color: #2c2c2c;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-align: left;
    width: 100%;
}

/* Variation options container */
.woocommerce div.product .variations .value {
    display: block;
    width: 100%;
    margin-bottom: 15px;
}

/* Variation select dropdowns */
.woocommerce div.product .variations select {
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    padding: 10px 15px;
    background: white;
    color: #2c2c2c;
    font-size: 0.95rem;
    min-width: 120px;
}

/* ========================================
   POLICY LINKS (Shipping & Refund)
   ======================================== */

.product-policy-links {
    display: block !important;
    visibility: visible !important;
    width: 100%;
    margin-top: -5px;
    margin-bottom: 10px;
    padding-top: 0;
    font-size: 0.85rem;
    clear: both;
}

.product-policy-links .policy-link {
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-policy-links .policy-link:hover {
    color: #333;
    text-decoration: underline;
}

.product-policy-links .policy-separator {
    color: #ccc;
    margin: 0 10px;
}

/* ========================================
   HIDE SKU AND CATEGORY LABELS
   ======================================== */

.woocommerce div.product .product_meta .sku_wrapper,
.woocommerce div.product .product_meta .posted_in {
    display: none !important;
}

/* ========================================
   HIDE PRODUCT TABS (Description, Additional Info, Reviews)
   ======================================== */

.woocommerce-tabs,
.woocommerce div.product .woocommerce-tabs {
    display: none !important;
}

/* ========================================
   ADD TO CART SECTION - INLINE LAYOUT
   ======================================== */

/* Make quantity and button sit side by side */
.woocommerce div.product form.cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.woocommerce div.product form.cart .quantity {
    flex: 0 0 auto;
}

.woocommerce div.product form.cart .single_add_to_cart_button {
    flex: 1;
    background: linear-gradient(135deg, #000000, #000000);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.4s ease;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.2);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.woocommerce div.product form.cart .single_add_to_cart_button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.3);
}

/* Variations form layout */
.woocommerce div.product form.cart.variations_form {
    flex-direction: column;
    align-items: stretch;
}

.woocommerce div.product form.cart.variations_form .woocommerce-variation-add-to-cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.woocommerce div.product form.cart.variations_form .woocommerce-variation-add-to-cart .quantity {
    flex: 0 0 auto;
}

.woocommerce div.product form.cart.variations_form .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    flex: 1;
}

/* ========================================
   POLICY MODAL
   ======================================== */

.policy-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.policy-modal.is-open {
    display: block;
}

.policy-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.2s ease;
}

.policy-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.policy-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 5px;
    transition: color 0.2s ease;
}

.policy-modal-close:hover {
    color: #333;
}

.policy-modal-title {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    font-weight: 500;
    color: #333;
    padding-right: 40px;
}

.policy-modal-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #555;
}

.policy-modal-content p {
    margin-bottom: 1em;
}

.policy-modal-content h2,
.policy-modal-content h3,
.policy-modal-content h4 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #333;
}

.policy-modal-content ul,
.policy-modal-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .policy-modal-container {
        width: 95%;
        padding: 30px 20px;
        max-height: 90vh;
        border-radius: 8px;
    }

    .policy-modal-title {
        font-size: 1.3rem;
    }

    .policy-modal-close {
        top: 10px;
        right: 15px;
    }
}

/* Force mobile layout for modal content (always single column, simplified) */
.policy-modal-content {
    max-width: 100% !important;
}

.policy-modal-content .wp-block-columns,
.policy-modal-content .columns {
    display: block !important;
    flex-direction: column !important;
}

.policy-modal-content .wp-block-column,
.policy-modal-content .column {
    width: 100% !important;
    flex-basis: 100% !important;
    margin-bottom: 1em;
}

.policy-modal-content .wp-block-group,
.policy-modal-content .wp-block-cover {
    padding: 20px !important;
}

.policy-modal-content img {
    max-width: 100%;
    height: auto;
}

.policy-modal-content table {
    display: block;
    overflow-x: auto;
    width: 100%;
}

/* Simplify any grid layouts in modal */
.policy-modal-content .wp-block-gallery,
.policy-modal-content [class*="grid"] {
    display: block !important;
}

.policy-modal-content .wp-block-gallery .wp-block-image {
    width: 100% !important;
    margin-bottom: 1em;
}

/* ========================================
   MOBILE: VARIANTS ABOVE DESCRIPTION
   ======================================== */

@media (max-width: 768px) {
    /* Make summary a flex container for reordering */
    .woocommerce div.product .summary {
        display: flex;
        flex-direction: column;
    }

    /* Default order for all summary children */
    .woocommerce div.product .summary > * {
        order: 0;
    }

    /* Move short description below variations */
    .woocommerce div.product .summary .woocommerce-product-details__short-description {
        order: 10;
    }

    /* Keep variations form above description */
    .woocommerce div.product .summary .variations_form {
        order: 5;
    }
}
