/* 
 * Single Product Styles - Mobile First Approach
 * Supports light/dark theme switching
 */

/* Product Layout - Mobile First */
.single-product.woocommerce {
    /* Base styles */
    --product-spacing: 1rem;
    --section-spacing: 2rem;
    --primary-color-rgb: 0, 182, 173; /* RGB value of primary color for rgba() usage */
    
    /* Reset some WooCommerce defaults */
    .woocommerce-product-gallery {
        width: 100% !important;
        float: none !important;
    }
    
    .summary.entry-summary {
        width: 100% !important;
        float: none !important;
        clear: both;
        margin-top: var(--product-spacing);
    }
    
    /* Container styling */
    .container {
        padding: 0 1rem;
        max-width: 100%;
        margin: 0 auto;
    }
    
    /* Main product container */
    .product {
        margin-bottom: var(--section-spacing);
        display: flex;
        flex-direction: column;
    }
    
    /* Product title */
    .product_title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
        color: var(--heading-color);
        text-align: left;
        line-height: 1.3;
    }
    
    /* Product rating */
    .woocommerce-product-rating {
        display: flex;
        align-items: center;
        margin-bottom: 1rem;
        flex-wrap: wrap;
    }
    
    .star-rating {
        margin-right: 0.5rem !important;
        margin-top: 0.25rem;
        margin-bottom: 0.25rem;
    }
    
    .woocommerce-review-link {
        color: var(--font-color);
        opacity: 0.8;
        text-decoration: none;
        font-size: 0.9rem;
    }
    
    /* Product price */
    .price {
        font-size: 1.5rem !important;
        font-weight: 700;
        color: var(--secondary-color) !important;
        margin-bottom: 1rem;
        display: block;
    }
    
    .price * {
        font-size: inherit;
        color: inherit;
    }
    
    /* Product short description */
    .woocommerce-product-details__short-description {
        margin-bottom: var(--product-spacing);
        
        p, ul, ol {
            margin-bottom: 1rem;
            color: var(--font-color);
            line-height: 1.6;
        }
        
        ul, ol {
            padding-left: 1.5rem;
        }
        
        li {
            margin-bottom: 0.5rem;
        }
        
        strong {
            color: var(--heading-color);
            font-weight: 600;
        }
        
        a {
            color: var(--primary-color);
            text-decoration: none;
            transition: color 0.2s ease;
        }
        
        a:hover {
            color: var(--primary-color-hover);
        }
        
        hr {
            border: 0;
            border-top: 1px solid var(--border-color);
            margin: 1.5rem 0;
        }
    }
}

/* Product Gallery */
.single-product.woocommerce {
    .woocommerce-product-gallery {
        margin-bottom: var(--product-spacing);
        position: relative;
        
        &__wrapper {
            border-radius: var(--border-radius);
            overflow: hidden;
            background-color: var(--bg-light);
            border: 1px solid var(--border-color);
            padding: 1rem;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        img {
            max-width: 100%;
            height: auto;
            display: block;
            margin: 0 auto;
            border-radius: calc(var(--border-radius) - 4px);
            transition: transform 0.3s ease;
        }
        
        &:hover img {
            transform: scale(1.02);
        }
    }
}

/* Product Form */
.single-product.woocommerce {
    /* Variations form */
    .variations_form {
        margin-bottom: var(--product-spacing);
        
        .variations {
            width: 100%;
            margin-bottom: 1rem;
            border-collapse: collapse;
            
            tr {
                display: flex;
                flex-direction: column;
                margin-bottom: 1rem;
            }
            
            td {
                padding: 0;
                
                &.label {
                    margin-bottom: 0.5rem;
                    
                    label {
                        font-weight: 600;
                        color: var(--heading-color);
                        font-size: 1rem;
                        margin: 0;
                    }
                }
                
                &.value {
                    position: relative;
                    
                    select {
                        width: 100%;
                        padding: 0.75rem;
                        border: 1px solid var(--border-color);
                        border-radius: var(--border-radius);
                        background-color: var(--bg-light);
                        color: var(--font-color);
                        appearance: none;
                        cursor: pointer;
                        font-size: 1rem;
                        transition: border-color 0.2s ease, box-shadow 0.2s ease;
                        
                        &:focus {
                            outline: none;
                            border-color: var(--primary-color);
                            box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
                        }
                    }
                    
                    &::after {
                        content: '';
                        position: absolute;
                        right: 1rem;
                        top: 50%;
                        transform: translateY(-50%);
                        width: 0;
                        height: 0;
                        border-left: 6px solid transparent;
                        border-right: 6px solid transparent;
                        border-top: 6px solid var(--font-color);
                        pointer-events: none;
                    }
                    
                    .reset_variations {
                        display: inline-block;
                        margin-top: 0.5rem;
                        font-size: 0.85rem;
                        color: var(--font-color);
                        opacity: 0.7;
                        text-decoration: none;
                        
                        &:hover {
                            opacity: 1;
                            color: var(--primary-color);
                        }
                    }
                }
            }
        }
        
        /* Single variation display */
        .single_variation_wrap {
            .woocommerce-variation {
                margin-bottom: 1rem;
                
                .woocommerce-variation-description {
                    font-size: 0.9rem;
                    margin-bottom: 0.5rem;
                    color: var(--font-color);
                }
                
                .woocommerce-variation-price {
                    font-weight: 700;
                    color: var(--secondary-color);
                    margin-bottom: 0.5rem;
                }
                
                .woocommerce-variation-availability {
                    font-size: 0.9rem;
                    
                    p.stock {
                        margin: 0;
                        
                        &.in-stock {
                            color: #4CAF50;
                        }
                        
                        &.out-of-stock {
                            color: #F44336;
                        }
                    }
                }
            }
        }
    }
    
    /* Product add-ons */
    .wc-pao-addon {
        margin-bottom: 1.5rem;
        
        .wc-pao-addon-name {
            display: block;
            font-weight: 600;
            color: var(--heading-color);
            margin-bottom: 0.5rem;
            
            .required {
                color: #F44336;
            }
        }
        
        .wc-pao-addon-description {
            font-size: 0.9rem;
            margin-bottom: 0.5rem;
            color: var(--font-color);
            opacity: 0.8;
        }
        
        .wc-pao-addon-wrap {
            margin: 0;
            
            input[type="text"],
            input[type="number"],
            textarea,
            select {
                width: 100%;
                padding: 0.75rem;
                border: 1px solid var(--border-color);
                border-radius: var(--border-radius);
                background-color: var(--bg-light);
                color: var(--font-color);
                font-size: 1rem;
                transition: border-color 0.2s ease, box-shadow 0.2s ease;
                
                &:focus {
                    outline: none;
                    border-color: var(--primary-color);
                    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
                }
            }
            
            textarea {
                min-height: 100px;
                resize: vertical;
            }
        }
    }
    
    /* Add to cart button and quantity */
    .woocommerce-variation-add-to-cart {
        display: flex;
        flex-direction: column;
        
        .quantity {
            margin-bottom: 1rem;
            
            input {
                width: 100%;
                padding: 0.75rem;
                border: 1px solid var(--border-color);
                border-radius: var(--border-radius);
                background-color: var(--bg-light);
                color: var(--font-color);
                font-size: 1rem;
                text-align: center;
            }
        }
        
        .single_add_to_cart_button {
            width: 100%;
            padding: 1rem !important;
            font-size: 1.1rem !important;
            font-weight: 600 !important;
            text-transform: uppercase !important;
            letter-spacing: 0.5px !important;
            border-radius: var(--border-radius) !important;
            background-color: var(--primary-color) !important;
            color: white !important;
            border: none !important;
            cursor: pointer;
            transition: all 0.3s ease !important;
            
            &:hover:not(.disabled) {
                background-color: var(--primary-color-hover) !important;
                transform: translateY(-2px);
                box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            }
            
            &:active:not(.disabled) {
                transform: translateY(0);
            }
            
            &.disabled {
                opacity: 0.6;
                cursor: not-allowed;
            }
        }
    }
}

/* Product Tabs */
.single-product.woocommerce {
    .woocommerce-tabs {
        margin-top: var(--section-spacing);
        margin-bottom: var(--section-spacing);
        
        .wc-tabs {
            margin: 0 0 1.5rem 0 !important;
            padding: 0 !important;
            list-style: none !important;
            display: flex;
            flex-wrap: wrap;
            border-bottom: 1px solid var(--border-color);
            
            &::before,
            &::after {
                display: none !important;
            }
            
            li {
                margin: 0 !important;
                padding: 0 !important;
                border: none !important;
                background: none !important;
                display: inline-block;
                position: relative;
                z-index: 1;
                
                &::before,
                &::after {
                    display: none !important;
                }
                
                a {
                    display: block;
                    padding: 0.75rem 1rem;
                    color: var(--font-color);
                    text-decoration: none;
                    font-weight: 600;
                    font-size: 1rem;
                    border-bottom: 3px solid transparent;
                    transition: all 0.2s ease;
                    
                    &:hover {
                        color: var(--primary-color);
                    }
                }
                
                &.active {
                    a {
                        color: var(--primary-color);
                        border-bottom-color: var(--primary-color);
                    }
                }
            }
        }
        
        .woocommerce-Tabs-panel {
            padding: 1rem 0;
            
            > h2:first-child {
                display: none; /* Hide duplicate titles */
            }
        }
    }
    
    /* Reviews section */
    #reviews {
        #comments {
            margin-bottom: 2rem;
            
            .woocommerce-Reviews-title {
                font-size: 1.25rem;
                margin-bottom: 1.5rem;
                color: var(--heading-color);
            }
            
            .commentlist {
                margin: 0 !important;
                padding: 0 !important;
                list-style: none !important;
                
                li {
                    margin-bottom: 1.5rem !important;
                    padding-bottom: 1.5rem !important;
                    border-bottom: 1px solid var(--border-color);
                    
                    &:last-child {
                        border-bottom: none;
                    }
                    
                    .comment_container {
                        display: flex;
                        
                        img.avatar {
                            width: 50px !important;
                            height: 50px !important;
                            border-radius: 50% !important;
                            margin-right: 1rem !important;
                            float: none !important;
                        }
                        
                        .comment-text {
                            flex: 1;
                            margin-left: 0 !important;
                            padding: 0 !important;
                            border: none !important;
                            
                            .star-rating {
                                margin-top: 0.25rem !important;
                                margin-bottom: 0.5rem !important;
                                float: none !important;
                            }
                            
                            .meta {
                                margin-bottom: 0.5rem !important;
                                
                                .woocommerce-review__author {
                                    font-weight: 600;
                                    color: var(--heading-color);
                                }
                                
                                .woocommerce-review__dash {
                                    margin: 0 0.25rem;
                                    opacity: 0.5;
                                }
                                
                                .woocommerce-review__published-date {
                                    font-size: 0.85rem;
                                    opacity: 0.7;
                                }
                            }
                            
                            .description {
                                p {
                                    margin: 0;
                                    line-height: 1.6;
                                }
                            }
                        }
                    }
                }
            }
        }
        
        /* Review form */
        #review_form_wrapper {
            padding: 1.5rem;
            background-color: var(--bg-light);
            border-radius: var(--border-radius);
            border: 1px solid var(--border-color);
            
            #review_form {
                .comment-reply-title {
                    font-size: 1.1rem;
                    margin-bottom: 1rem;
                    display: block;
                    color: var(--heading-color);
                    font-weight: 600;
                }
                
                .comment-notes {
                    font-size: 0.9rem;
                    margin-bottom: 1.5rem;
                    opacity: 0.8;
                }
                
                .comment-form-rating {
                    margin-bottom: 1.5rem;
                    
                    label {
                        display: block;
                        margin-bottom: 0.5rem;
                        font-weight: 600;
                        color: var(--heading-color);
                    }
                    
                    .stars {
                        display: inline-block;
                        margin-bottom: 0;
                        
                        a {
                            color: #FFD700;
                            position: relative;
                            height: 1em;
                            width: 1em;
                            text-indent: -999em;
                            display: inline-block;
                            text-decoration: none;
                            margin-right: 0.25rem;
                            
                            &::before {
                                display: block;
                                position: absolute;
                                top: 0;
                                left: 0;
                                width: 1em;
                                height: 1em;
                                line-height: 1;
                                font-family: WooCommerce;
                                content: "\\e021";
                                text-indent: 0;
                            }
                            
                            &:hover ~ a::before {
                                content: "\\e021";
                            }
                        }
                        
                        &:hover a::before {
                            content: "\\e020";
                        }
                        
                        &:hover a:hover ~ a::before {
                            content: "\\e021";
                        }
                    }
                }
                
                .comment-form-comment,
                .comment-form-author,
                .comment-form-email {
                    margin-bottom: 1.5rem;
                    
                    label {
                        display: block;
                        margin-bottom: 0.5rem;
                        font-weight: 600;
                        color: var(--heading-color);
                    }
                    
                    input,
                    textarea {
                        width: 100%;
                        padding: 0.75rem;
                        border: 1px solid var(--border-color);
                        border-radius: var(--border-radius);
                        background-color: var(--bg-color);
                        color: var(--font-color);
                        font-size: 1rem;
                        transition: border-color 0.2s ease, box-shadow 0.2s ease;
                        
                        &:focus {
                            outline: none;
                            border-color: var(--primary-color);
                            box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
                        }
                    }
                    
                    textarea {
                        min-height: 120px;
                        resize: vertical;
                    }
                }
                
                .form-submit {
                    margin-bottom: 0;
                    
                    input[type="submit"] {
                        padding: 0.75rem 1.5rem;
                        font-size: 1rem;
                        font-weight: 600;
                        text-transform: uppercase;
                        letter-spacing: 0.5px;
                        border-radius: var(--border-radius);
                        background-color: var(--primary-color);
                        color: white;
                        border: none;
                        cursor: pointer;
                        transition: all 0.3s ease;
                        
                        &:hover {
                            background-color: var(--primary-color-hover);
                            transform: translateY(-2px);
                            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
                        }
                        
                        &:active {
                            transform: translateY(0);
                        }
                    }
                }
            }
        }
    }
}

/* Related and Upsell Products */
.single-product.woocommerce {
    .related.products,
    .up-sells.upsells.products {
        margin-top: var(--section-spacing);
        
        > h2 {
            font-size: 1.5rem;
            margin-bottom: 1.5rem;
            color: var(--heading-color);
            text-align: left;
        }
        
        ul.products {
            margin: 0 -0.5rem !important;
            padding: 0 !important;
            display: flex;
            flex-wrap: wrap;
            list-style: none !important;
            
            li.product {
                width: 100% !important;
                float: none !important;
                margin: 0 0 1rem 0 !important;
                padding: 0.5rem !important;
                box-sizing: border-box;
                
                .woocommerce-loop-product__link {
                    display: flex;
                    flex-direction: column;
                    height: 100%;
                    padding: 1rem;
                    background-color: var(--bg-light);
                    border: 1px solid var(--border-color);
                    border-radius: var(--border-radius);
                    transition: all 0.3s ease;
                    text-decoration: none;
                    
                    &:hover {
                        transform: translateY(-5px);
                        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
                    }
                    
                    img {
                        width: 100%;
                        height: auto;
                        margin-bottom: 1rem;
                        border-radius: calc(var(--border-radius) - 4px);
                    }
                    
                    .woocommerce-loop-product__title {
                        font-size: 1rem;
                        margin-bottom: 0.5rem;
                        color: var(--heading-color);
                        text-align: center;
                    }
                    
                    .star-rating {
                        margin: 0 auto 0.5rem auto;
                    }
                    
                    .price {
                        font-size: 1.1rem !important;
                        margin-bottom: 0.5rem;
                        text-align: center;
                    }
                }
                
                .btn {
                    margin-top: auto;
                    width: 100%;
                    text-align: center;
                }
            }
        }
    }
}

/* Responsive styles */
@media (min-width: 576px) {
    .single-product.woocommerce {
        .container {
            max-width: 540px;
        }
        
        /* Related and Upsell Products - 2 columns */
        .related.products,
        .up-sells.upsells.products {
            ul.products {
                li.product {
                    width: 50% !important;
                }
            }
        }
    }
}

@media (min-width: 768px) {
    .single-product.woocommerce {
        .container {
            max-width: 720px;
        }
        
        /* Product title */
        .product_title {
            font-size: 1.75rem;
        }
        
        /* Product layout - 2 columns */
        .product {
            display: grid;
            grid-template-columns: 1fr 1fr;
            grid-gap: 2rem;
            
            .woocommerce-product-gallery {
                grid-column: 1;
                margin-bottom: 0;
            }
            
            .summary.entry-summary {
                grid-column: 2;
                margin-top: 0;
            }
            
            .woocommerce-tabs,
            .related.products,
            .up-sells.upsells.products {
                grid-column: 1 / -1;
            }
        }
        
        /* Add to cart button and quantity */
        .woocommerce-variation-add-to-cart {
            flex-direction: row;
            align-items: center;
            
            .quantity {
                width: 120px;
                margin-right: 1rem;
                margin-bottom: 0;
            }
            
            .single_add_to_cart_button {
                flex: 1;
            }
        }
        
        /* Reviews */
        #reviews {
            #comments {
                .commentlist {
                    li {
                        .comment_container {
                            img.avatar {
                                width: 60px !important;
                                height: 60px !important;
                            }
                        }
                    }
                }
            }
        }
    }
}

@media (min-width: 992px) {
    .single-product.woocommerce {
        .container {
            max-width: 960px;
        }
        
        /* Product title */
        .product_title {
            font-size: 2rem;
        }
        
        /* Related and Upsell Products - 3 columns */
        .related.products,
        .up-sells.upsells.products {
            ul.products {
                li.product {
                    width: 33.333% !important;
                }
            }
        }
    }
}

@media (min-width: 1200px) {
    .single-product.woocommerce {
        .container {
            max-width: 1140px;
        }
        
        /* Related and Upsell Products - 4 columns */
        .related.products,
        .up-sells.upsells.products {
            ul.products {
                li.product {
                    width: 25% !important;
                }
            }
        }
    }
}
