/**
 * ZD Selector de Atributos — front styles
 * Z Digital · Creative Elements widget
 *
 * Defaults use single-class selectors so the {{WRAPPER}} rules of the widget
 * controls always win.
 */

.zdas {
    --zdas-sw: 32px;
    --zdas-ring: #111827;
    --zdas-ring-w: 2px;
    --zdas-ring-gap: 3px;
    --zdas-sw-border: rgba(0, 0, 0, 0.12);
    --zdas-dim: 0.45;
    --zdas-cross: #9ca3af;
    --zdas-label-gap: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.zdas *,
.zdas *::before,
.zdas *::after {
    box-sizing: border-box;
}

.zdas-group {
    display: flex;
    flex-direction: column;
    gap: var(--zdas-label-gap);
    min-width: 0;
}

.zdas-group--hidden,
.zdas-native-hidden,
.zdas-slot--empty {
    display: none !important;
}

.zdas-layout-inline .zdas-group {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}

.zdas-layout-inline .zdas-label {
    flex: 0 0 90px;
    width: 90px;
}

.zdas-layout-inline .zdas-values,
.zdas-layout-inline .zdas-select-wrap {
    flex: 1 1 auto;
}

/* ---- Label ---------------------------------------------------------- */

.zdas-label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 4px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #111827;
}

.zdas-label-sep {
    margin-left: -4px;
}

.zdas-label-value {
    font-weight: 400;
    color: #6b7280;
}

.zdas-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Values (shared) ------------------------------------------------ */

.zdas-values {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.zdas-val {
    position: relative;
    margin: 0;
    font: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.zdas-val:focus {
    outline: none;
}

.zdas-val:focus-visible {
    outline: 2px solid var(--zdas-ring);
    outline-offset: 3px;
}

.zdas-over {
    display: none !important;
}

.zdas-more {
    font-size: 12px;
    line-height: 1;
    color: #6b7280;
    text-decoration: none;
    padding: 4px 2px;
}

.zdas-more:hover {
    color: #111827;
    text-decoration: underline;
}

/* ---- Swatches ------------------------------------------------------- */

.zdas-val--swatch {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: 0;
    line-height: 1;
}

.zdas-swatch-fill {
    display: block;
    width: var(--zdas-sw);
    height: var(--zdas-sw);
    border-radius: 50%;
    background-color: #e5e7eb;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px var(--zdas-sw-border), 0 0 0 0 transparent;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.zdas-shape-rounded .zdas-swatch-fill {
    border-radius: 8px;
}

.zdas-shape-square .zdas-swatch-fill {
    border-radius: 0;
}

.zdas-val--swatch:hover .zdas-swatch-fill {
    transform: scale(1.06);
}

.zdas-val--swatch.is-active .zdas-swatch-fill {
    box-shadow:
        inset 0 0 0 1px var(--zdas-sw-border),
        0 0 0 var(--zdas-ring-gap) #fff,
        0 0 0 calc(var(--zdas-ring-gap) + var(--zdas-ring-w)) var(--zdas-ring);
}

.zdas-val--swatch .zdas-swatch-fill.is-light {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.zdas-val--swatch.is-active .zdas-swatch-fill.is-light {
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.22),
        0 0 0 var(--zdas-ring-gap) #fff,
        0 0 0 calc(var(--zdas-ring-gap) + var(--zdas-ring-w)) var(--zdas-ring);
}

.zdas-swatch-name {
    font-size: 12px;
    color: #4b5563;
    max-width: calc(var(--zdas-sw) + 24px);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Buttons / pills ------------------------------------------------ */

.zdas-val--buttons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 42px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.1;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 999px;
}

.zdas-val--buttons:hover {
    border-color: #111827;
}

.zdas-val--buttons.is-active {
    color: #ffffff;
    background-color: #111827;
    border-color: #111827;
}

/* ---- Select --------------------------------------------------------- */

.zdas-select-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.zdas-select {
    display: block;
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 42px 0 14px;
    font: inherit;
    font-size: 14px;
    color: #111827;
    background-color: #ffffff;
    background-image: none;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.zdas-select:hover {
    border-color: #9ca3af;
}

.zdas-select:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.zdas-select-arrow {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    fill: none;
    stroke: #6b7280;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/* ---- Price cards ---------------------------------------------------- */

.zdas-values--cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    align-items: stretch;
    width: 100%;
}

.zdas-val--cards {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-height: 64px;
    padding: 12px;
    text-align: left;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.zdas-val--cards:hover {
    border-color: #9ca3af;
}

.zdas-val--cards.is-active {
    background-color: #f9fafb;
    border-color: #111827;
    box-shadow: 0 0 0 1px #111827;
}

.zdas-card-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.zdas-card-price {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: #111827;
}

.zdas-card-price:empty,
.zdas-card-regular:empty {
    display: none;
}

.zdas-card-regular {
    font-size: 12px;
    line-height: 1.2;
    color: #9ca3af;
    text-decoration: line-through;
}

.zdas-card-oos {
    display: none;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #b91c1c;
}

.zdas-val--cards.is-oos .zdas-card-oos {
    display: block;
}

/* ---- Out of stock / not available ---------------------------------- */

/* Out of stock, crossed (still selectable to see it). */
.zdas-oos-cross .zdas-val.is-oos {
    opacity: var(--zdas-dim);
}

.zdas-oos-cross .zdas-val--buttons.is-oos,
.zdas-oos-cross .zdas-val--cards.is-oos {
    background-image: linear-gradient(to top left, transparent calc(50% - 1px), var(--zdas-cross) calc(50% - 1px), var(--zdas-cross) calc(50% + 0px), transparent calc(50% + 1px));
}

.zdas-oos-cross .zdas-val--swatch.is-oos .zdas-swatch-fill {
    background-image: linear-gradient(to top left, transparent calc(50% - 1px), var(--zdas-cross) calc(50% - 1px), var(--zdas-cross) calc(50% + 0.5px), transparent calc(50% + 1.5px));
}

.zdas-oos-cross .zdas-val.is-oos.is-active,
.zdas-oos-fade .zdas-val.is-oos.is-active {
    opacity: 1;
}

.zdas-oos-fade .zdas-val.is-oos {
    opacity: var(--zdas-dim);
}

.zdas-oos-hide .zdas-val.is-oos:not(.is-active) {
    display: none;
}

/* Combination that does not exist with the other choices. */
.zdas-na-fade .zdas-val.is-na {
    opacity: calc(var(--zdas-dim) * 0.8);
    border-style: dashed;
}

.zdas-na-hide .zdas-val.is-na {
    display: none;
}

/* ---- Stock ---------------------------------------------------------- */

.zdas-stock {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.zdas-stock:empty {
    display: none;
}

.zdas-stock::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.zdas-stock.is-in {
    color: #15803d;
}

.zdas-stock.is-low {
    color: #c2410c;
}

.zdas-stock.is-out {
    color: #b91c1c;
}

/* ---- Miniature add-to-cart ----------------------------------------- */

.zdas--mini {
    gap: 10px;
}

.zdas--mini .zdas-label {
    font-size: 12px;
}

.zdas-add {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    padding: 8px 16px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background-color: #111827;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.18s ease, opacity 0.18s ease;
}

.zdas-add:hover {
    background-color: #374151;
}

.zdas-add:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.zdas-add-spin {
    display: none;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: zdas-spin 0.7s linear infinite;
}

.zdas-add.is-loading .zdas-add-spin {
    display: inline-block;
}

.zdas-add.is-added::after,
.zdas-add.is-error::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    animation: zdas-flash 0.9s ease;
}

.zdas-add.is-added::after {
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.55);
}

.zdas-add.is-error::after {
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.6);
}

.zdas-add.is-error {
    animation: zdas-shake 0.35s ease;
}

/* ---- Product-page cart button when the combination is out of stock - */

.zdas-cart-off {
    opacity: 0.45 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* ---- Miniature placeholder (before AJAX) ---------------------------- */

.zdas-slot {
    min-height: 1px;
}

.zdas-slot[data-zdas-state="loading"] {
    min-height: 32px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.04));
    background-size: 200% 100%;
    animation: zdas-shimmer 1.2s linear infinite;
}

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

@keyframes zdas-flash {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes zdas-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-3px);
    }
    75% {
        transform: translateX(3px);
    }
}

@keyframes zdas-shimmer {
    from {
        background-position: 200% 0;
    }
    to {
        background-position: -200% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zdas-val,
    .zdas-swatch-fill,
    .zdas-add {
        transition: none;
    }
    .zdas-slot[data-zdas-state="loading"],
    .zdas-add.is-error {
        animation: none;
    }
}
