/**
 * Product Page Styles
 * Extracted from page-product.php for better performance
 */

/* ==========================================================================
   Product Detail Page Layout
   ========================================================================== */
.product-detail-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.product-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-top: 20px;
}

/* ==========================================================================
   Product Gallery
   ========================================================================== */
#product-gallery {
    display: flex;
    gap: 20px;
    position: relative;
}

.product-thumbnails {
    width: 80px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-thumbnails img {
    width: 100%;
    height: auto;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.product-thumbnails img.active,
.product-thumbnails img:hover {
    border-color: var(--color-primary, #2d1f1f);
}

.product-main-image {
    flex: 1;
    position: relative;
}

.product-main-image img {
    width: 100%;
    height: auto;
    max-height: 700px;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

/* Zoom on hover */
.product-main-image .zoom-container {
    overflow: hidden;
    cursor: zoom-in;
}

.product-main-image .zoom-container:hover img {
    transform: scale(1.5);
    transform-origin: var(--zoom-x, center) var(--zoom-y, center);
}

/* ==========================================================================
   Product Info
   ========================================================================== */
#product-info .vendor {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 10px;
}

#product-info .title {
    font-family: 'Canela Text', serif;
    font-size: 32px;
    line-height: 1.2;
    margin-bottom: 20px;
    font-weight: 300;
}

.price-wrapper {
    margin-bottom: 30px;
}

#product-info .price {
    font-size: 24px;
    font-weight: 600;
}

#product-info .price.sale {
    color: var(--color-accent, #f25c5e);
}

#product-info .compare-price {
    text-decoration: line-through;
    color: #999;
    font-size: 18px;
    margin-left: 10px;
}

/* ==========================================================================
   Quantity Selector - Global fix for mobile blue highlight
   ========================================================================== */
#qty-decrease,
#qty-increase {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    outline: none !important;
    color: #2d1f1f !important;
    background: #fff !important;
    border: 1px solid #e5e5e5 !important;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    touch-action: manipulation;
}

#qty-decrease:active,
#qty-increase:active {
    background: #f5f5f5 !important;
}

#qty-decrease:focus,
#qty-increase:focus {
    outline: none !important;
    box-shadow: none !important;
    border-color: #e5e5e5 !important;
}

#product-quantity {
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    color: #2d1f1f !important;
}

#product-quantity::-webkit-inner-spin-button,
#product-quantity::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0;
}

/* ==========================================================================
   Size Selector
   ========================================================================== */
.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.size-option {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    text-align: center;
    line-height: 42px;
    transition: all 0.15s ease;
    font-size: 13px;
    font-weight: 400;
    color: var(--color-primary, #2d1f1f);
}

.size-option:hover:not(.unavailable) {
    border-color: var(--color-primary, #2d1f1f);
}

.size-option.selected {
    background: var(--color-primary, #2d1f1f);
    color: #fff;
    border-color: var(--color-primary, #2d1f1f);
}

.size-option.unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    color: #999;
    text-decoration: line-through;
}

/* ==========================================================================
   Color Swatches
   ========================================================================== */
.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e5e5e5;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 0 2px #fff;
    padding: 0;
    background-clip: padding-box;
}

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

.color-swatch.selected {
    border-color: var(--color-primary, #2d1f1f);
    box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--color-primary, #2d1f1f);
}

.color-swatch.selected::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.color-swatch.light.selected::after {
    color: var(--color-primary, #2d1f1f);
    text-shadow: none;
}

.color-swatch.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
}

.color-swatch.unavailable::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: #999;
    transform: rotate(-45deg);
}

/* ==========================================================================
   Buy Now Button
   ========================================================================== */
#buy-now {
    width: 100%;
    padding: 18px;
    background: #68683D;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
}

#buy-now:hover:not(:disabled) {
    background: #1a1212;
}

#buy-now:disabled {
    background: #e5e5e5;
    color: #999;
    cursor: not-allowed;
}

#buy-now.loading {
    position: relative;
    color: transparent;
}

#buy-now.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Add to Cart Button (Secondary)
   ========================================================================== */
#add-to-cart {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background: transparent;
    border: 1px solid var(--color-primary, #2d1f1f);
    color: var(--color-primary, #2d1f1f);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
}

#add-to-cart:hover {
    background: var(--color-primary, #2d1f1f);
    color: white;
}

#add-to-cart:disabled {
    background: #f5f5f5;
    border-color: #ccc;
    color: #999;
    cursor: not-allowed;
}

#add-to-cart.loading {
    position: relative;
    color: transparent;
}

#add-to-cart.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--color-primary, #2d1f1f);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   Product Description
   ========================================================================== */
#product-description {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e5e5e5;
}

#product-description h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

#product-description p,
#description-content {
    font-size: 14px;
    line-height: 1.8;
    color: #666;
}

/* ==========================================================================
   Related Products
   ========================================================================== */
@media (max-width: 1023px) {
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==========================================================================
   Responsive - Tablet
   ========================================================================== */
@media (max-width: 1023px) {
    .product-detail-page {
        padding: 16px;
    }

    .product-container {
        grid-template-columns: 1fr;
        gap: 24px;
        margin-top: 10px;
    }

    #product-gallery {
        flex-direction: column;
        overflow: hidden;
    }

    .product-thumbnails {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        order: 2;
        padding: 10px 0;
        justify-content: flex-start;
        flex-shrink: 0;
    }

    .product-thumbnails img {
        width: 60px;
        height: 75px;
        min-width: 60px;
        object-fit: cover;
        border: 1px solid #e5e5e5;
    }

    .product-thumbnails img.active {
        border-color: var(--color-primary, #2d1f1f);
    }

    .product-main-image {
        order: 1;
        height: 50vh;
        max-height: 50vh;
        min-height: 250px;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #main-image-container {
        height: 100%;
        max-height: 100%;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent !important;
        overflow: hidden;
    }

    .product-main-image .zoom-container {
        height: 100%;
        max-height: 100%;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .product-main-image img {
        max-height: 100%;
        max-width: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }
}

/* ==========================================================================
   Responsive - Mobile
   ========================================================================== */
@media (max-width: 768px) {
    .product-detail-page {
        padding: 12px;
    }

    /* Disable zoom on touch devices */
    .product-main-image .zoom-container {
        cursor: default;
    }

    .product-main-image .zoom-container:hover img {
        transform: none;
    }

    #product-info .title {
        font-size: 20px;
        font-family: 'Canela Text', Georgia, serif;
        font-weight: 400;
    }

    #product-info .vendor {
        font-size: 11px;
        margin-bottom: 6px;
    }

    #product-info .price {
        font-size: 20px;
    }

    .price-wrapper {
        margin-bottom: 20px;
    }

    #add-to-cart {
        padding: 16px;
        font-size: 13px;
    }

    #add-to-wishlist {
        padding: 14px;
        font-size: 13px;
    }

    #quantity-selector {
        margin: 16px 0;
    }

    /* Fix blue tap highlight on quantity buttons */
    #qty-decrease,
    #qty-increase {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        outline: none !important;
        color: #2d1f1f !important;
        background: #fff !important;
        border: 1px solid #e5e5e5 !important;
    }

    #qty-decrease:active,
    #qty-increase:active {
        background: #f5f5f5 !important;
    }

    #qty-decrease:focus,
    #qty-increase:focus {
        outline: none !important;
        box-shadow: none !important;
    }

    .breadcrumbs {
        padding: 10px 12px !important;
        font-size: 12px;
    }

    /* Smaller height for smaller phones */
    .product-main-image {
        height: 45vh;
        max-height: 45vh;
        min-height: 200px;
    }
}

/* ==========================================================================
   Loading Placeholders
   ========================================================================== */
.thumbnail-placeholder {
    background: #f5f5f5;
    border-radius: 4px;
}

/* ==========================================================================
   Product Vendor Row (Vendor + Wishlist Heart) - LV Style
   ========================================================================== */
.product-vendor-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-vendor-row .vendor {
    margin-bottom: 0;
}

/* Product Page Wishlist Heart - Simple outline style */
/* Override global .wishlist-heart absolute positioning */
.product-wishlist-heart {
    position: static;
    top: auto;
    right: auto;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.product-wishlist-heart svg {
    width: 24px;
    height: 24px;
}

.product-wishlist-heart svg path {
    transition: all 0.2s ease;
}

.product-wishlist-heart:hover svg path {
    stroke: #e91e63;
}

.product-wishlist-heart.active svg path {
    fill: #e91e63;
    stroke: #e91e63;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .product-vendor-row {
        margin-bottom: 4px;
    }

    .product-wishlist-heart {
        width: 28px;
        height: 28px;
    }

    .product-wishlist-heart svg {
        width: 22px;
        height: 22px;
    }
}
