/**
 * Imagelet Product Types - Imagelet Sleeve Frontend Styles
 *
 * Styles specific to the imagelet_sleeve product type on the frontend.
 * Uses Blocksy swatch structure for variation selection.
 *
 * NOTE: This file should NOT override styles from frontend-shared.css
 * The following are handled by frontend-shared.css:
 * - .ipt-price-stock-wrap
 * - .ipt-add-to-cart-wrap
 * - .ipt-stock-status
 *
 * @package Imagelet_Product_Types
 */

/* ====================
   Form Layout
   ==================== */

.ipt-imagelet-sleeve-form.cart {
    max-width: 100%;
}

.ipt-imagelet-sleeve-form .variations {
    width: 100%;
    margin-bottom: 20px;
}

.ipt-imagelet-sleeve-form .variations th.label {
    padding: 10px 0;
    vertical-align: top;
    text-align: left;
    font-weight: 600;
    width: 80px;
    min-width: 80px;
}

.ipt-imagelet-sleeve-form .variations td.value {
    padding: 10px 0;
    vertical-align: middle;
}

/* ====================
   Content Option Swatches
   ==================== */

.ipt-content-option-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ipt-content-option-swatches .ct-swatch-container {
    cursor: pointer;
    transition: all 0.2s ease;
}

.ipt-content-option-swatches .ct-swatch-container .ct-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 2px solid var(--theme-border-color, #e0e0e0);
    border-radius: var(--theme-border-radius, 4px);
    background: var(--theme-palette-color-8, #fff);
    min-height: 40px;
    transition: all 0.2s ease;
}

.ipt-content-option-swatches .ct-swatch-container .ct-swatch-content {
    font-size: 14px;
    font-weight: 500;
    color: var(--theme-text-color, #333);
}

.ipt-content-option-swatches .ct-swatch-container:hover .ct-swatch {
    border-color: var(--theme-palette-color-1, #3b82f6);
    background: var(--theme-palette-color-8, #fff);
}

.ipt-content-option-swatches .ct-swatch-container.active .ct-swatch {
    border-color: var(--theme-palette-color-1, #3b82f6);
    background: var(--theme-palette-color-1, #3b82f6);
}

.ipt-content-option-swatches .ct-swatch-container.active .ct-swatch-content {
    color: #fff;
}

/* ====================
   Size Swatches
   ==================== */

.ipt-imagelet-sleeve-form .ipt-size-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ipt-imagelet-sleeve-form .ipt-size-swatches .ct-swatch-container {
    cursor: pointer;
    transition: all 0.2s ease;
}

.ipt-imagelet-sleeve-form .ipt-size-swatches .ct-swatch-container[style*="display: none"] {
    display: none !important;
}

/* ====================
   Preview Canvas
   ==================== */

.ipt-preview-wrapper {
    position: relative;
    width: 100%;
    background: var(--theme-palette-color-8, #fff);
    border-radius: var(--theme-border-radius, 4px);
    overflow: hidden;
}

.ipt-preview-canvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.ipt-preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.ipt-preview-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--theme-border-color, #e0e0e0);
    border-top-color: var(--theme-palette-color-1, #3b82f6);
    border-radius: 50%;
    animation: ipt-spin 0.8s linear infinite;
}

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

/* ====================
   Responsive Styles
   ==================== */

@media (max-width: 768px) {
    .ipt-imagelet-sleeve-form .variations th.label {
        width: 100%;
        display: block;
        padding-bottom: 5px;
    }

    .ipt-imagelet-sleeve-form .variations td.value {
        display: block;
        width: 100%;
        padding-top: 0;
    }
}

/* ====================
   Hidden Size Row
   ==================== */

.ipt-imagelet-sleeve-form .ipt-size-row.hidden {
    display: none;
}

/* Hide size row if only one size is available */
.ipt-imagelet-sleeve-form .ipt-size-swatches:has(.ct-swatch-container:only-child) {
    display: none;
}

.ipt-imagelet-sleeve-form tr:has(.ipt-size-swatches .ct-swatch-container:only-child) {
    display: none;
}
