/* =====================================================
   Elua Configuratore v3 – Frontend CSS
   Palette: rosa cipria #b08d7a / beige #f0ece8 / bianco
   ===================================================== */

/* ── Canvas area ──────────────────────────────────── */
.elua-canvas-area {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
}

.elua-canvas-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #faf8f6;
    border-radius: 8px;
    overflow: hidden;
}

.elua-canvas-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c0b4ac;
    font-size: .85rem;
    font-style: italic;
    text-align: center;
    padding: 24px;
    transition: opacity .3s;
}

.elua-canvas-placeholder.hidden { opacity: 0; pointer-events: none; }

.elua-canvas-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .3s ease;
}

.elua-canvas-layer.visible { opacity: 1; }

.elua-canvas-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(250,248,246,.8);
    border-radius: 8px;
}

.elua-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e8e2dc;
    border-top-color: #b08d7a;
    border-radius: 50%;
    animation: elua-spin .7s linear infinite;
}
@keyframes elua-spin { to { transform: rotate(360deg); } }

/* ── Selettori attributo ──────────────────────────── */
.elua-configuratore {
    margin: 0 0 24px;
}

.elua-attr-section {
    margin-bottom: 20px;
}

.elua-attr-label {
    font-size: .78rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #999;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.elua-attr-label strong {
    color: #2d2d2d;
    text-transform: none;
    letter-spacing: 0;
    font-size: .9rem;
}

.elua-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Swatch generico ──────────────────────────────── */
.elua-swatch {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #faf8f6;
    transition: border-color .18s, transform .18s, box-shadow .18s, opacity .18s;
    outline: none;
    padding: 0;
    overflow: hidden;
}

.elua-swatch:hover:not(.elua-disabled) {
    border-color: #b08d7a;
    transform: scale(1.06);
}

.elua-swatch.elua-selected {
    border-color: #b08d7a;
    box-shadow: 0 0 0 3px rgba(176,141,122,.2);
}

.elua-swatch.elua-selected::after {
    content: '✓';
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 11px;
    font-weight: 700;
    color: #b08d7a;
    line-height: 1;
}

.elua-swatch.elua-disabled {
    opacity: .35;
    cursor: not-allowed;
    filter: grayscale(.5);
}

/* ── Swatch colore (cerchietto) ───────────────────── */
.elua-swatch-color {
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
    border-width: 2px !important;
    outline-offset: 3px;
}

.elua-swatch-color.elua-selected {
    outline: 2px solid #b08d7a;
    outline-offset: 3px;
}

.elua-swatch-color .elua-swatch-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}

/* ── Swatch immagine miniatura ────────────────────── */
.elua-swatch-image {
    width: 64px;
    height: 64px;
    padding: 6px;
}

.elua-swatch-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ── Swatch testo (fallback) ──────────────────────── */
.elua-swatch-text {
    padding: 6px 12px;
    font-size: .82rem;
    color: #555;
    white-space: nowrap;
    border-radius: 6px !important;
}

.elua-swatch.elua-selected .elua-swatch-text { color: #b08d7a; font-weight: 600; }

/* ── Messaggio disponibilità ──────────────────────── */
.elua-availability {
    font-size: .8rem;
    margin-top: 6px;
    min-height: 1.2em;
    color: #c0392b;
    transition: opacity .2s;
}

.elua-availability.ok { color: #27ae60; }

/* ── Prezzo variante ──────────────────────────────── */
.elua-price-wrap {
    margin: 12px 0 4px;
    min-height: 2em;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d2d2d;
    transition: opacity .2s;
}

/* ── Messaggio errore validazione ─────────────────── */
.elua-error-msg {
    background: #fdf0ee;
    border-left: 3px solid #e74c3c;
    padding: 10px 14px;
    font-size: .85rem;
    color: #c0392b;
    border-radius: 0 6px 6px 0;
    margin: 8px 0;
    display: none;
}

/* ── Input nascosti ───────────────────────────────── */
.elua-hidden-inputs { display: none; }

/* ── Tooltip nome swatch (tooltip nativo) ─────────── */
.elua-swatch[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #2d2d2d;
    color: #fff;
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
    .elua-swatch-color  { width: 32px; height: 32px; }
    .elua-swatch-image  { width: 56px; height: 56px; }
    .elua-canvas-wrap   { aspect-ratio: 4 / 3; }
}

@media (min-width: 768px) {
    .elua-canvas-area {
        /* Su desktop il canvas si affianca al pannello opzioni
           grazie al layout WooCommerce a due colonne */
        margin-bottom: 0;
    }
}
