/**
 * WCFM WooCommerce T-Shirt Frontend 3 Styles
 */

/* Artist Info */
.wcfm-tshirt-artist-info {
    margin-bottom: 20px;
    font-size: 14px;
}

.wcfm-tshirt-artist-name {
    font-weight: bold;
}

.wcfm-tshirt-artist-link {
    color: #333;
    text-decoration: none;
}

.wcfm-tshirt-artist-link:hover {
    text-decoration: underline;
}

/* Layout adjustments for WooCommerce product page */
.single-product div.product {
    display: flex;
    flex-wrap: wrap;
}

.single-product div.product .wcfm-tshirt-design-container {
    width: 48%;
    float: left;
    margin-right: 4%;
    margin-bottom: 20px;
}

.single-product div.product .summary {
    width: 48%;
    float: right;
    clear: none;
    margin-bottom: 20px;
}

/* Hide default WooCommerce product image */
.single-product div.product .woocommerce-product-gallery {
    display: none !important;
}

/* T-Shirt Design Container */
.wcfm-tshirt-design-container {
    margin-bottom: 30px;
    width: 100%;
}

.wcfm-tshirt-design-heading {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
}

.wcfm-tshirt-design-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    min-height: 500px; /* Ensure consistent height */
}

.wcfm-tshirt-design-view {
    position: relative;
    display: none;
    width: 100%;
    height: 100%;
    min-height: 500px; /* Ensure consistent height */
}

.wcfm-tshirt-design-view.active {
    display: block;
}

.wcfm-tshirt-background {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center; /* Center the image */
}

.wcfm-tshirt-background-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 500px; /* Limit height */
    object-fit: contain; /* Maintain aspect ratio */
}

.wcfm-tshirt-design {
    position: absolute;
    z-index: 2;
    pointer-events: none; /* Prevent design from interfering with clicks */
}

.wcfm-tshirt-design-image {
    width: 100%;
    height: 100%;
    display: block;
}

/* T-Shirt Controls */
.wcfm-tshirt-design-controls {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.wcfm-tshirt-side-button {
    padding: 10px 20px;
    margin: 0 5px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.wcfm-tshirt-side-button:hover {
    background-color: #e5e5e5;
}

.wcfm-tshirt-side-button.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

/* Product Selection */
.wcfm-tshirt-product-selection {
    margin-bottom: 30px;
}

.wcfm-tshirt-design-title {
    font-size: 18px;
    margin-bottom: 15px;
}

.wcfm-tshirt-product-description {
    margin-bottom: 20px;
}

.wcfm-tshirt-product-options {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wcfm-tshirt-product-option {
    margin-bottom: 15px;
}

.wcfm-tshirt-product-option label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.wcfm-tshirt-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wcfm-tshirt-product-price {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
}

.wcfm-tshirt-price-label {
    font-size: 16px;
    font-weight: normal;
    margin-right: 10px;
}

.wcfm-tshirt-add-to-cart {
    margin-top: 20px;
}

.wcfm-tshirt-add-to-cart .quantity {
    margin-bottom: 15px;
}

.wcfm-tshirt-add-to-cart .quantity label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.wcfm-tshirt-add-to-cart .quantity input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wcfm-tshirt-add-to-cart button {
    width: 100%;
    padding: 12px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wcfm-tshirt-add-to-cart button:hover {
    background-color: #555;
}

/* Gallery Images */
.wcfm-tshirt-gallery-images {
    margin-top: 30px;
    margin-bottom: 30px;
    clear: both;
    width: 100%;
}

.wcfm-tshirt-gallery-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wcfm-tshirt-gallery-item {
    width: calc(25% - 10px);
    max-width: 150px;
}

.wcfm-tshirt-gallery-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.wcfm-tshirt-gallery-thumbnail:hover {
    border-color: #333;
}

/* Fix for color variations */
#wcfm-tshirt-pa_color option[value="white"] {
    background-color: #fff;
}

#wcfm-tshirt-pa_color option[value="black"] {
    background-color: #000;
    color: #fff;
}

#wcfm-tshirt-pa_color option[value="red"] {
    background-color: #ff0000;
}

#wcfm-tshirt-pa_color option[value="blue"] {
    background-color: #0000ff;
    color: #fff;
}

#wcfm-tshirt-pa_color option[value="green"] {
    background-color: #008000;
    color: #fff;
}

#wcfm-tshirt-pa_color option[value="gray"],
#wcfm-tshirt-pa_color option[value="grey"] {
    background-color: #808080;
    color: #fff;
}

/* Loading indicator */
.wcfm-tshirt-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    display: none;
}

.wcfm-tshirt-loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    margin-left: -20px;
    border-radius: 50%;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    animation: wcfm-tshirt-spin 1s linear infinite;
}

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

@media (max-width: 768px) {
    .single-product div.product .wcfm-tshirt-design-container,
    .single-product div.product .summary {
        width: 100%;
        float: none;
        margin-right: 0;
    }
    
    .wcfm-tshirt-gallery-item {
        width: calc(33.33% - 10px);
    }
}

@media (max-width: 480px) {
    .wcfm-tshirt-gallery-item {
        width: calc(50% - 10px);
    }
    
    .wcfm-tshirt-side-button {
        padding: 8px 15px;
        font-size: 12px;
    }
} 

/* Hide default WooCommerce variation form and all duplicates */
.wcfm-tshirt-product .variations_form.cart,
.wcfm-tshirt-product form.variations_form,
.wcfm-tshirt-product form.cart:not(.wcfm-tshirt-add-to-cart form.cart),
.wcfm-tshirt-product .woocommerce-variation-add-to-cart,
form.variations_form.cart {
    display: none !important;
}

/* Hide duplicate variation controls */
.wcfm-tshirt-product table.variations,
.wcfm-tshirt-product .reset_variations,
.wcfm-tshirt-product .woocommerce-variation {
    display: none !important;
}

/* Hide duplicate add to cart button */
.wcfm-tshirt-product .single_add_to_cart_button:not(.wcfm-tshirt-add-to-cart .single_add_to_cart_button) {
    display: none !important;
}

/* Hide duplicate wcfm-tshirt elements that appear AFTER the description text */
/* Keep only the one in the main product area (before summary) */
.wcfm-tshirt-product .entry-content .wcfm-tshirt-design-container,
.wcfm-tshirt-product .entry-content .wcfm-tshirt-options,
.wcfm-tshirt-product .entry-content .wcfm-tshirt-pricing,
.wcfm-tshirt-product #tab-description .wcfm-tshirt-design-container,
.wcfm-tshirt-product #tab-description .wcfm-tshirt-options,
.wcfm-tshirt-product #tab-description .wcfm-tshirt-pricing,
.wcfm-tshirt-product .woocommerce-Tabs-panel .wcfm-tshirt-design-container,
.wcfm-tshirt-product .woocommerce-Tabs-panel .wcfm-tshirt-options,
.wcfm-tshirt-product .woocommerce-Tabs-panel .wcfm-tshirt-pricing {
    display: none !important;
}

/* Hide any duplicate product forms that appear below the main product area */
.wcfm-tshirt-product .entry-content form.cart,
.wcfm-tshirt-product #tab-description form.cart,
.wcfm-tshirt-product .woocommerce-Tabs-panel form.cart {
    display: none !important;
}

/* Hide duplicate summary sections that appear in description/tabs */
.wcfm-tshirt-product .entry-content .summary,
.wcfm-tshirt-product #tab-description .summary,
.wcfm-tshirt-product .woocommerce-Tabs-panel .summary {
    display: none !important;
}

/* More specific: hide any duplicate variation selects in content areas */
.wcfm-tshirt-product .entry-content select,
.wcfm-tshirt-product #tab-description select {
    display: none !important;
}

/* Nuclear option: Hide EVERYTHING in description tab except the actual description text */
/* This targets the duplicate product form elements that appear after the description */
.wcfm-tshirt-product #tab-description > *:not(p):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) {
    display: none !important;
}

/* Also hide in the main entry-content area */
.wcfm-tshirt-product .entry-content > *:not(p):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) {
    display: none !important;
}

/* Ensure description paragraphs and headings are still visible */
.wcfm-tshirt-product #tab-description p,
.wcfm-tshirt-product #tab-description h1,
.wcfm-tshirt-product #tab-description h2,
.wcfm-tshirt-product #tab-description h3,
.wcfm-tshirt-product #tab-description h4,
.wcfm-tshirt-product #tab-description h5,
.wcfm-tshirt-product #tab-description h6,
.wcfm-tshirt-product .entry-content p {
    display: block !important;
}

/* CRITICAL: Hide ALL WooCommerce variation forms in description/content areas */
/* This prevents other products' forms from showing up */
.wcfm-tshirt-product #tab-description form.variations_form,
.wcfm-tshirt-product .entry-content form.variations_form,
.wcfm-tshirt-product #tab-description .variations_form,
.wcfm-tshirt-product .entry-content .variations_form,
.wcfm-tshirt-product .woocommerce-Tabs-panel form.variations_form,
.wcfm-tshirt-product .woocommerce-Tabs-panel .variations_form {
    display: none !important;
}

/* Also hide any table.variations (the attribute selection table) */
.wcfm-tshirt-product #tab-description table.variations,
.wcfm-tshirt-product .entry-content table.variations,
.wcfm-tshirt-product .woocommerce-Tabs-panel table.variations {
    display: none !important;
}

/* Hide any labels for wcfm-tshirt-product in description/content areas */
.wcfm-tshirt-product #tab-description label[for="wcfm-tshirt-product"],
.wcfm-tshirt-product .entry-content label[for="wcfm-tshirt-product"],
.wcfm-tshirt-product .woocommerce-Tabs-panel label[for="wcfm-tshirt-product"],
.wcfm-tshirt-product #tab-description label,
.wcfm-tshirt-product .entry-content label {
    display: none !important;
}

/* Hide any remaining form elements and divs in description */
.wcfm-tshirt-product #tab-description div,
.wcfm-tshirt-product .entry-content div {
    display: none !important;
}

/* But allow description text paragraphs */
.wcfm-tshirt-product #tab-description p {
    display: block !important;
}

/* ULTIMATE FIX: Hide ALL duplicate product content that appears after the summary */
/* Keep only: main design area, summary sidebar, and tabs */

/* Hide the duplicate price/product info section that appears between summary and tabs */
.wcfm-tshirt-product div.product > .woocommerce-product-details__short-description {
    display: block !important; /* Keep short description */
}

/* But hide everything that comes AFTER short description, EXCEPT tabs */
.wcfm-tshirt-product div.product > *:not(.wcfm-tshirt-design-container):not(.summary):not(.woocommerce-tabs):not(.related):not(.upsells):not(#reviews) {
    /* Only show: design container, summary, tabs, related, upsells, reviews */
}

/* FINAL SOLUTION: Hide ALL content between summary and tabs */
/* Target the specific duplicate section that contains price, product style, etc. */
.wcfm-tshirt-product .summary ~ *:not(.woocommerce-tabs):not(.related):not(.upsells):not(#reviews):not(script):not(style) {
    display: none !important;
}

/* Also hide product_meta (SKU, Category, Tag) if it appears after summary */
.wcfm-tshirt-product .product_meta {
    display: none !important;
}

/* Hide the Ask a Question and Store sections if they appear as duplicates */
.wcfm-tshirt-product .summary ~ p,
.wcfm-tshirt-product .summary ~ h1,
.wcfm-tshirt-product .summary ~ h2,
.wcfm-tshirt-product .summary ~ h3,
.wcfm-tshirt-product .summary ~ h4,
.wcfm-tshirt-product .summary ~ div:not(.woocommerce-tabs):not(.related):not(.upsells) {
    display: none !important;
}

/* Override to ensure tabs still show */
.wcfm-tshirt-product .woocommerce-tabs {
    display: block !important;
}

/* CRITICAL: Hide duplicate summary sections */
/* Keep only the FIRST summary (the one next to the design), hide all others */
.wcfm-tshirt-product .wcfm-tshirt-design-container ~ .summary.entry-summary {
    /* This is the correct summary next to the design - KEEP IT */
    display: block !important;
}

/* Hide ANY summary that appears AFTER the main summary */
.wcfm-tshirt-product .summary.entry-summary ~ .summary.entry-summary,
.wcfm-tshirt-product .summary + .summary {
    display: none !important;
}

/* If there are multiple summaries, hide all but the first one */
.wcfm-tshirt-product div.product > .summary:nth-of-type(n+2) {
    display: none !important;
}

/* ========================================
   CLEAN DESCRIPTION TAB - Targeted Fixes Only
   ======================================== */

/* Clean description wrapper styling */
.wcfm-tshirt-product .wcfm-clean-description {
    padding: 0;
    margin: 0;
}

.wcfm-tshirt-product .wcfm-clean-description p {
    margin: 0 0 1em 0;
    line-height: 1.6;
}

/* Hide specific duplicate product elements if they slip through */
.wcfm-tshirt-product #tab-description .wcfm-tshirt-product-selection,
.wcfm-tshirt-product #tab-description .wcfm-tshirt-design-container,
.wcfm-tshirt-product #tab-description form.cart,
.wcfm-tshirt-product #tab-description .wcfm-tshirt-product-option,
.wcfm-tshirt-product #tab-description .wcfm-tshirt-price-breakdown-container {
    display: none !important;
}

/* Hide duplicate summary sections in tabs */
.wcfm-tshirt-product .woocommerce-Tabs-panel .summary,
.wcfm-tshirt-product .woocommerce-Tabs-panel .product:not(.wcfm-tshirt-product) {
    display: none !important;
}

/* BACKUP LAYER: Aggressively hide ALL known duplicate elements in description tab */
.wcfm-tshirt-product #tab-description .wcfm-tshirt-product-selection,
.wcfm-tshirt-product #tab-description .summary.entry-summary,
.wcfm-tshirt-product #tab-description div.product,
.wcfm-tshirt-product #tab-description form,
.wcfm-tshirt-product #tab-description select,
.wcfm-tshirt-product #tab-description input:not([type="hidden"]),
.wcfm-tshirt-product #tab-description button,
.wcfm-tshirt-product #tab-description label:not(.wcfm-clean-description label),
.wcfm-tshirt-product #tab-description .price,
.wcfm-tshirt-product #tab-description .quantity,
.wcfm-tshirt-product .woocommerce-Tabs-panel--description .wcfm-tshirt-product-selection,
.wcfm-tshirt-product .woocommerce-Tabs-panel--description .summary,
.wcfm-tshirt-product .woocommerce-Tabs-panel--description form,
.wcfm-tshirt-product .woocommerce-Tabs-panel--description select,
.wcfm-tshirt-product .woocommerce-Tabs-panel--description input:not([type="hidden"]),
.wcfm-tshirt-product .woocommerce-Tabs-panel--description button {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ONLY allow clean description content */
.wcfm-tshirt-product .wcfm-clean-description,
.wcfm-tshirt-product .wcfm-clean-description * {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}

/* ========================================
   CRITICAL: Hide duplicate summary/product selection after tabs
   ======================================== */

/* Hide any .summary that appears as a sibling AFTER the tabs */
.wcfm-tshirt-product .woocommerce-tabs-wrapper ~ .summary,
.wcfm-tshirt-product .woocommerce-tabs-wrapper ~ * .summary,
.wcfm-tshirt-product .woocommerce-tabs ~ .summary,
.wcfm-tshirt-product #reviews ~ .summary {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide any product selection that appears after tabs */
.wcfm-tshirt-product .woocommerce-tabs-wrapper ~ .wcfm-tshirt-product-selection,
.wcfm-tshirt-product .woocommerce-tabs-wrapper ~ * .wcfm-tshirt-product-selection,
.wcfm-tshirt-product .woocommerce-tabs ~ .wcfm-tshirt-product-selection,
.wcfm-tshirt-product #reviews ~ .wcfm-tshirt-product-selection,
.wcfm-tshirt-product .related ~ .summary,
.wcfm-tshirt-product .related ~ .wcfm-tshirt-product-selection {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide any duplicate content that appears as a sibling after the main product div */
body.single-product .product ~ .summary,
body.single-product .product ~ * .summary,
body.single-product .product ~ .wcfm-tshirt-product-selection,
body.single-product .product ~ * .wcfm-tshirt-product-selection {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* CRITICAL FIX: Hide duplicate summary and tabs after .related products */
.wcfm-tshirt-product .related ~ .summary,
.wcfm-tshirt-product .related ~ * .summary,
.wcfm-tshirt-product .related ~ .entry-summary,
.wcfm-tshirt-product .related ~ * .entry-summary,
.wcfm-tshirt-product .related ~ .woocommerce-tabs-wrapper,
.wcfm-tshirt-product .related ~ * .woocommerce-tabs-wrapper,
.wcfm-tshirt-product .related ~ .woocommerce-tabs,
.wcfm-tshirt-product .related ~ * .woocommerce-tabs,
.wcfm-tshirt-product .upsells ~ .summary,
.wcfm-tshirt-product .upsells ~ * .summary,
.wcfm-tshirt-product .upsells ~ .woocommerce-tabs-wrapper,
.wcfm-tshirt-product .upsells ~ * .woocommerce-tabs-wrapper {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide any duplicate woocommerce-tabs-wrapper (keep only the first one) */
.wcfm-tshirt-product .woocommerce-tabs-wrapper:nth-of-type(n+2),
.wcfm-tshirt-product .woocommerce-tabs:nth-of-type(n+2) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Options and Pricing Section (removed from below image, now in right sidebar only) */
.wcfm-tshirt-options {
    margin-top: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wcfm-tshirt-option-group {
    margin-bottom: 15px;
}

.wcfm-tshirt-option-group:last-of-type {
    margin-bottom: 20px;
}

.wcfm-tshirt-option-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.wcfm-tshirt-option-group .wcfm-tshirt-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.3s ease;
}

.wcfm-tshirt-option-group .wcfm-tshirt-select:hover {
    border-color: #999;
}

.wcfm-tshirt-option-group .wcfm-tshirt-select:focus {
    outline: none;
    border-color: #333;
}

/* Pricing Display */
.wcfm-tshirt-pricing {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #ddd;
}

.wcfm-tshirt-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 16px;
}

.wcfm-tshirt-price-label {
    font-weight: normal;
    color: #666;
}

.wcfm-tshirt-price-value {
    font-weight: 600;
    color: #333;
}

.wcfm-tshirt-price-total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-size: 18px;
}

.wcfm-tshirt-price-total .wcfm-tshirt-price-label {
    font-weight: bold;
    color: #333;
}

.wcfm-tshirt-price-total .wcfm-tshirt-price-value {
    font-weight: bold;
    color: #000;
    font-size: 20px;
} 