/* Psautocolors v3.2.0 Premium Styles */

/* Base container */
.psautocolors-container {
    margin: 1.5rem 0;
}

/* Section spacing */
.psautocolors-section {
    margin-bottom: 1.2rem;
}

/* Titles and labels */
.psautocolors-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Color Selection Section */
.psautocolors-list-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.psautocolors-color-box {
    width: 120px;
    aspect-ratio: 4/5;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.psautocolors-color-box .psautocolors-link {
    display: block;
    height: 100%;
    width: 100%;
}

.psautocolors-visual-wrapper {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
}

.psautocolors-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.psautocolors-color-box:hover {
    transform: translateY(-5px);
    border-color: #a3a3a3;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.psautocolors-color-box:hover .psautocolors-thumbnail {
    transform: scale(1.05);
}

.psautocolors-color-box.active {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a, 0 8px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    z-index: 10;
}

/* Color Circle Style (for solid colors without image) */
.psautocolors-color-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background-color: #fff;
    padding: 3px;
}

.psautocolors-color-circle .psautocolors-link,
.psautocolors-color-circle .psautocolors-visual-wrapper,
.psautocolors-color-circle .psautocolors-color-full-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psautocolors-color-circle .psautocolors-color-full-fallback {
    box-shadow: inset 0 0 4px rgba(0,0,0,0.1);
}

.psautocolors-color-circle:hover {
    transform: translateY(-2px);
    border-color: #999;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.psautocolors-color-circle.active {
    border-color: #1a1a1a;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a;
    z-index: 10;
}

.psautocolors-color-circle .psautocolors-color-name {
    display: none;
}

.psautocolors-item-container {
    max-width: 120px;
}

.psautocolors-color-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #666;
    text-align: center;
    margin-top: 4px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.psautocolors-item-container:hover .psautocolors-color-label {
    color: #000;
}

.psautocolors-color-box.active + .psautocolors-color-label,
.psautocolors-color-circle.active + .psautocolors-color-label {
    color: #000;
    font-weight: 700;
}

/* Fallback for no image */
.psautocolors-color-full-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    text-align: center;
    background-color: #f4f4f4;
}

.psautocolors-color-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #333;
    line-height: 1.1;
    word-break: break-word;
}

/* ── Chips de atributos no-color (tallas, materiales, opciones…) ── */
.psautocolors-attr-group-wrapper {
    margin-top: 1rem;
}

.psautocolors-attr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.psautocolors-attr-chip {
    display: inline-flex;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    position: relative;
}

.psautocolors-attr-chip:hover {
    border-color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.psautocolors-attr-chip.active {
    border-color: #1a1a1a;
    background: #1a1a1a;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a, 0 4px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.psautocolors-attr-chip.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
}

.psautocolors-attr-chip.out-of-stock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 4px;
    right: 4px;
    height: 1px;
    background: #999;
    transform: rotate(-10deg);
    pointer-events: none;
}

.psautocolors-attr-chip-link {
    display: block;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-decoration: none !important;
    white-space: nowrap;
    transition: color 0.2s ease;
    line-height: 1.2;
}

.psautocolors-attr-chip.active .psautocolors-attr-chip-link {
    color: #fff !important;
}

.psautocolors-attr-chip:hover:not(.active) .psautocolors-attr-chip-link {
    color: #000;
}

/* Hide Default PrestaShop Variants to avoid duplication */
.product-variants > .product-variants-item,
.product-variants .product-variants-item .color,
.product-variants .product-variants-item .input-color {
    display: none !important;
}

/* Responsive tweaks */
@media (max-width: 767px) {
    .psautocolors-color-box {
        width: 100px;
    }
    .psautocolors-attr-chip-link {
        padding: 8px 14px;
        font-size: 12px;
    }
}


/* Base container */
.psautocolors-container {
    margin: 1.5rem 0;
}

/* Titles and labels */
.psautocolors-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

/* Color Selection Section */
.psautocolors-list-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.psautocolors-color-box {
    width: 120px;
    aspect-ratio: 4/5;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.psautocolors-color-box .psautocolors-link {
    display: block;
    height: 100%;
    width: 100%;
}

.psautocolors-visual-wrapper {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
}

.psautocolors-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.psautocolors-color-box:hover {
    transform: translateY(-5px);
    border-color: #a3a3a3;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.psautocolors-color-box:hover .psautocolors-thumbnail {
    transform: scale(1.05);
}

.psautocolors-color-box.active {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a, 0 8px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    z-index: 10;
}

/* Color Circle Style (for solid colors without image) */
.psautocolors-color-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background-color: #fff;
    padding: 3px;
}

.psautocolors-color-circle .psautocolors-link,
.psautocolors-color-circle .psautocolors-visual-wrapper,
.psautocolors-color-circle .psautocolors-color-full-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psautocolors-color-circle .psautocolors-color-full-fallback {
    box-shadow: inset 0 0 4px rgba(0,0,0,0.1);
}

.psautocolors-color-circle:hover {
    transform: translateY(-2px);
    border-color: #999;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.psautocolors-color-circle.active {
    border-color: #1a1a1a;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a;
    z-index: 10;
}

/* Hide text in color circles - Now handled in TPL but kept as safety */
.psautocolors-color-circle .psautocolors-color-name {
    display: none;
}

.psautocolors-item-container {
    max-width: 120px;
}

.psautocolors-color-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #666;
    text-align: center;
    margin-top: 4px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.psautocolors-item-container:hover .psautocolors-color-label {
    color: #000;
}

.psautocolors-color-box.active + .psautocolors-color-label,
.psautocolors-color-circle.active + .psautocolors-color-label {
    color: #000;
    font-weight: 700;
}

/* Fallback for no image - Full Name Mode */
.psautocolors-color-full-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    text-align: center;
    background-color: #f4f4f4;
}

.psautocolors-color-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #333;
    line-height: 1.1;
    word-break: break-word;
}

/* Sizes Section */
.psautocolors-list-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.psautocolors-size-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #d1d1d1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.psautocolors-size-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none !important;
    color: #222 !important;
    font-size: 0.95rem;
    font-weight: 500;
}

.psautocolors-size-circle:hover:not(.active) {
    border-color: #1a1a1a;
    transform: scale(1.05);
}

.psautocolors-size-circle.active {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a, 0 4px 8px rgba(0,0,0,0.2);
    transform: scale(1.05);
    z-index: 10;
}

.psautocolors-size-circle.active .psautocolors-size-link {
    color: #fff !important;
}

/* Out of Stock Sizes */
.psautocolors-size-circle.out-of-stock {
    opacity: 0.45;
    background-color: #f5f5f5;
    border-style: solid;
    cursor: not-allowed;
}

.psautocolors-size-circle.out-of-stock::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 1px;
    background: #999;
    transform: rotate(-45deg);
    top: 50%;
    left: 0;
}

/* Hide Default PrestaShop Variants to avoid duplication */
.product-variants > .product-variants-item,
.product-variants .product-variants-item .color,
.product-variants .product-variants-item .input-color {
    display: none !important;
}

/* Responsive tweaks */
@media (max-width: 767px) {
    .psautocolors-color-box {
        width: 100px;
    }
    .psautocolors-size-circle {
        width: 42px;
        height: 42px;
    }
}