/**
 * Single Product Page Styles
 * Complete CSS with all features - FIXED VERSION
 */

@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

/* ===================================
   BASE STYLES
   =================================== */
* {
    box-sizing: border-box;
}

/* ===================================
   SINGLE PRODUCT PAGE WRAPPER
   =================================== */
.single-product-page {
    width: 100%;
    min-height: 100vh;
    background: #ffffff;
    padding-top: 80px;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
}

.product-main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ===================================
   BREADCRUMB
   =================================== */
.product-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
    font-size: 14px;
    color: #86868b;
}

.product-breadcrumb a {
    color: #325D53;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-breadcrumb a:hover {
    color: #285446;
    text-decoration: underline;
}

.product-breadcrumb .separator {
    color: #d2d2d7;
}

/* ===================================
   PRODUCT LAYOUT (2 Column Grid)
   =================================== */
.product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-bottom: 60px;
}

/* ===================================
   PRODUCT GALLERY
   =================================== */
.product-gallery {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.product-gallery-main {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 20px;
    overflow: hidden;
    background: #f8f9fa;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.product-gallery-main:hover {
    transform: scale(1.02);
}

.product-gallery-main img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

/* Thumbnails */
.product-gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

.product-thumbnail {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.product-thumbnail:hover {
    border-color: #325D53;
    transform: scale(1.05);
}

.product-thumbnail.active {
    border-color: #325D53;
    box-shadow: 0 0 0 2px rgba(50, 93, 83, 0.1);
}

.product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===================================
   PRODUCT INFO
   =================================== */
.product-info {
    padding: 20px 0;
}

.product-title {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0 0 20px 0;
    line-height: 1.3;
}

/* ===================================
   PRODUCT RATING
   =================================== */
.product-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.product-stars {
    display: flex;
    gap: 2px;
}

.product-stars i {
    color: #FFB800;
    font-size: 16px;
}

.product-review-count {
    font-size: 14px;
    color: #86868b;
}

/* ===================================
   PRODUCT PRICE - SHOP STYLE
   =================================== */
.product-price {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 16px 0 24px 0;
}

.product-price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Regular Price (not on sale) */
.product-price .amount,
.product-price > .woocommerce-Price-amount {
    font-size: 32px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

/* On Sale - Sale Price - RED with Discount Badge */
.product-price ins {
    text-decoration: none;
    background: transparent;
    order: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-price ins .amount,
.product-price ins .woocommerce-Price-amount {
    font-size: 32px;
    font-weight: 700;
    color: #ff424e;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

/* Discount Badge - ติดข้างราคาลด (ins) */
.product-price ins::after {
    content: attr(data-discount);
    background: #ff424e;
    color: white;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 4px;
    line-height: 1;
}

/* On Sale - Original Price - BOTTOM */
.product-price del {
    opacity: 1;
    order: 2;
}

.product-price del .amount,
.product-price del .woocommerce-Price-amount {
    font-size: 18px;
    font-weight: 400;
    color: #999;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

/* Hide screen reader text */
.product-price .screen-reader-text {
    display: none;
}

/* Currency Symbol Styling */
.product-price .woocommerce-Price-currencySymbol {
    font-weight: inherit;
}

/* ===================================
   SHORT DESCRIPTION
   =================================== */
.product-short-description {
    font-size: 16px;
    color: #6e6e73;
    line-height: 1.6;
    margin-bottom: 32px;
}

.product-short-description p {
    margin-bottom: 12px;
}

/* ===================================
   ADD TO CART SECTION
   =================================== */
.product-add-to-cart {
    margin-bottom: 32px;
}

/* Quantity Label */
.quantity-label {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 12px;
}

/* Quantity Selector */
.product-quantity-selector {
    margin-bottom: 20px;
}

.quantity-controls {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    background: #f5f5f7;
    padding: 8px 16px;
    border-radius: 12px;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #ffffff;
    color: #325D53;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: #325D53;
    color: #ffffff;
    transform: scale(1.1);
}

.quantity-value {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    min-width: 40px;
    text-align: center;
}

/* ===================================
   ADD TO CART BUTTON (Mobile Only)
   =================================== */
.product-add-to-cart-btn {
    width: 100%;
    background: #325D53;
    color: #ffffff;
    padding: 18px 32px;
    border: none;
    border-radius: 12px;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.product-add-to-cart-btn:hover {
    background: #285446;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(50, 93, 83, 0.3);
}

.product-add-to-cart-btn i {
    font-size: 20px;
}

/* ===================================
   DESKTOP NEW BUTTONS
   =================================== */
.desktop-product-actions {
    display: none;
    width: 100%;
}

@media (min-width: 769px) {
    /* Hide old button on desktop */
    .product-add-to-cart-btn {
        display: none !important;
    }
    
    /* Show new buttons on desktop */
    .desktop-product-actions {
        display: block;
    }
}

/* Button Container */
.desktop-action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

/* Add to Cart Button (Left - White) */
.desktop-add-cart-btn {
    flex: 0 0 40%;
    background: #ffffff;
    border: 3px solid #325D53;
    color: #325D53;
    padding: 18px 24px;
    border-radius: 50px;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.desktop-add-cart-btn:hover {
    background: #f8f9fa;
    border-color: #285446;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(50, 93, 83, 0.15);
}

.desktop-add-cart-btn .btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.desktop-add-cart-btn .btn-success-content {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.desktop-add-cart-btn i {
    font-size: 22px;
}

/* Success State */
.desktop-add-cart-btn.success {
    background: #ffffff;
    border-color: #34c759;
    color: #34c759;
}

.desktop-add-cart-btn.success .btn-content {
    display: none;
}

.desktop-add-cart-btn.success .btn-success-content {
    display: flex;
    animation: checkBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkBounce {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Buy Now Button (Right - Green) */
.desktop-buy-now-btn {
    flex: 0 0 calc(60% - 12px);
    background: linear-gradient(135deg, #3d6e63 0%, #325D53 100%);
    border: none;
    color: #ffffff;
    padding: 18px 24px;
    border-radius: 50px;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(50, 93, 83, 0.3);
}

.desktop-buy-now-btn:hover {
    background: linear-gradient(135deg, #2d5a51 0%, #285446 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(50, 93, 83, 0.4);
}

.desktop-buy-now-btn i {
    font-size: 20px;
}

/* Checkout Popup (Below Buttons) */
.desktop-checkout-popup {
    margin-top: 0;
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.desktop-checkout-popup.show {
    margin-top: 16px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.checkout-popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1d1d1f;
    padding: 16px 32px;
    border-radius: 50px;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(255, 165, 0, 0.3);
    transition: all 0.3s ease;
    animation: popupSlideUp 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.checkout-popup-btn:hover {
    background: linear-gradient(135deg, #FFC700 0%, #FF9500 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.4);
    color: #1d1d1f;
    text-decoration: none;
}

.checkout-popup-btn i:first-child {
    font-size: 20px;
}

.checkout-popup-btn i:last-child {
    font-size: 16px;
    animation: arrowPulse 1s ease-in-out infinite;
}

@keyframes popupSlideUp {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    60% {
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes arrowPulse {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
}

/* Loading State */
.desktop-add-cart-btn.loading,
.desktop-buy-now-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.desktop-add-cart-btn.loading i,
.desktop-buy-now-btn.loading i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   PRODUCT META
   =================================== */
.product-meta {
    padding: 20px 0;
    border-top: 1px solid #e5e5ea;
    margin-top: 20px;
}

.product-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.product-meta-label {
    font-size: 14px;
    font-weight: 600;
    color: #86868b;
    min-width: 100px;
}

.product-meta-value {
    font-size: 14px;
    color: #1d1d1f;
}

.product-meta-value a {
    color: #325D53;
    text-decoration: none;
}

.product-meta-value a:hover {
    text-decoration: underline;
}

/* ===================================
   SHARE BUTTONS
   =================================== */
.product-share {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    border-top: 1px solid #e5e5ea;
}

.product-share-title {
    font-size: 14px;
    font-weight: 600;
    color: #86868b;
}

.product-share-buttons {
    display: flex;
    gap: 12px;
}

.product-share-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #e5e5ea;
    background: #ffffff;
    color: #6e6e73;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.product-share-btn:hover {
    border-color: #325D53;
    color: #325D53;
    transform: translateY(-2px);
}

.product-share-btn.facebook:hover {
    border-color: #1877f2;
    color: #1877f2;
    background: rgba(24, 119, 242, 0.05);
}

.product-share-btn.line:hover {
    border-color: #00b900;
    color: #00b900;
    background: rgba(0, 185, 0, 0.05);
}

/* ===================================
   PRODUCT TABS SECTION
   =================================== */
.product-tabs-section {
    margin-bottom: 60px;
    padding-top: 40px;
    border-top: 1px solid #e5e5ea;
}

.product-tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e5e5ea;
    margin-bottom: 32px;
}

.product-tab-btn {
    padding: 16px 24px;
    border: none;
    background: transparent;
    color: #6e6e73;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.product-tab-btn:hover {
    color: #325D53;
}

.product-tab-btn.active {
    color: #325D53;
}

.product-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #325D53;
}

.product-tab-content {
    display: none;
    font-size: 16px;
    line-height: 1.8;
    color: #1d1d1f;
}

.product-tab-content.active {
    display: block;
}

.product-tab-content p {
    margin-bottom: 16px;
}

.product-tab-content ul,
.product-tab-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.product-tab-content li {
    margin-bottom: 8px;
}

/* Customer-edited links inside the description tab render as green pill chips
   so they read as actions, not as bare browser-default blue text. */
.product-tab-content a {
    display: inline-block;
    padding: 4px 14px;
    margin: 2px 4px 2px 0;
    background: #325D53;
    color: #ffffff;
    border-radius: 999px;
    font-size: 0.95em;
    line-height: 1.5;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
    vertical-align: baseline;
}

.product-tab-content a:hover,
.product-tab-content a:focus-visible {
    background: #244a42;
    color: #ffffff;
    transform: translateY(-1px);
    text-decoration: none;
}

/* ===================================
   RELATED PRODUCTS SECTION
   =================================== */
.related-products-section {
    margin-bottom: 60px;
    padding-top: 40px;
    border-top: 1px solid #e5e5ea;
}

.related-products-title {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 32px;
}

/* Card markup + styling for the related products grid lives in
   shop-featured.css (.featured-card, .desktop-products-view, etc.) — both shop
   and single-product enqueue it so the cards render identically. */

/* ===================================
   LIGHTBOX
   =================================== */
.product-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.product-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* ===================================
   RESPONSIVE - TABLET
   =================================== */
@media (max-width: 1024px) {
    .product-layout {
        gap: 40px;
    }
    
    .product-title {
        font-size: 28px;
    }
    
    .product-price ins .amount,
    .product-price .amount {
        font-size: 28px;
    }
    
    .product-price del .amount {
        font-size: 16px;
    }
    
    .product-price ins::after {
        font-size: 12px;
        padding: 2px 6px;
    }
}

/* ===================================
   RESPONSIVE - MOBILE
   =================================== */
@media (max-width: 768px) {
    .single-product-page {
        padding-top: 60px;
    }
    
    .product-main-content {
        padding: 20px 16px;
    }
    
    .product-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .product-gallery {
        position: relative;
        top: 0;
    }
    
    .product-title {
        font-size: 24px;
    }
    
    .product-price {
        margin: 12px 0 20px 0;
    }
    
    .product-price ins .amount,
    .product-price .amount {
        font-size: 26px;
    }
    
    .product-price del .amount {
        font-size: 15px;
    }
    
    .product-price ins::after {
        font-size: 11px;
        padding: 2px 5px;
    }
    
    .product-tabs-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .product-tab-btn {
        white-space: nowrap;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .related-products-title {
        font-size: 22px;
    }
    
    /* Mobile: Show old button, hide desktop buttons */
    .product-add-to-cart-btn {
        display: flex !important;
    }
    
    .desktop-product-actions {
        display: none !important;
    }
}

/* ===================================
   RESPONSIVE - SMALL MOBILE
   =================================== */
@media (max-width: 480px) {
    .product-title {
        font-size: 22px;
    }
    
    .product-price ins .amount,
    .product-price .amount {
        font-size: 24px;
    }
    
    .product-price del .amount {
        font-size: 14px;
    }
    
    .product-price ins::after {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .product-gallery-thumbnails {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .product-breadcrumb {
        margin-top: 20px;
        font-size: 12px;
    }
}