/* ==========================================================================
   WC Product Configurator – Frontend
   ========================================================================== */

.wcpc-configurator { margin: 24px 0; }

/* Steps */
.wcpc-step {
    margin-bottom: 20px;
    padding: 20px 22px;
    background: #fff;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
}

.wcpc-step__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* Collapsible */
.wcpc-step--collapsible .wcpc-step__title {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.wcpc-step--collapsible .wcpc-step__title::after {
    content: '▾';
    margin-left: auto;
    font-size: 16px;
    color: #bbb;
    transition: transform .2s;
    flex-shrink: 0;
    font-weight: 400;
}

.wcpc-step--collapsible.is-open .wcpc-step__title {
    margin-bottom: 16px;
}

.wcpc-step--collapsible.is-open .wcpc-step__title::after {
    transform: rotate(-180deg);
    color: #555;
}

.wcpc-step__body {
    display: none;
}

.wcpc-step--collapsible.is-open .wcpc-step__body {
    display: block;
}

.wcpc-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ---- SELETTORE COLORI (cerchietti) ---- */
.wcpc-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
    background: #f7f7f7;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    margin-bottom: 12px;
}

.wcpc-color-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    position: relative;
    transition: background .15s;
}

.wcpc-color-btn:hover { background: rgba(0,0,0,.06); }

.wcpc-swatch {
    display: block;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,.15);
    transition: box-shadow .15s, transform .15s;
    flex-shrink: 0;
}

.wcpc-color-btn.is-selected .wcpc-swatch {
    box-shadow: 0 0 0 3px #1a1a1a;
    transform: scale(1.12);
}

.wcpc-color-btn.has-qty .wcpc-swatch {
    border-color: #43a047;
}

.wcpc-color-btn__name {
    font-size: 10px;
    color: #555;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
}

.wcpc-color-btn.is-selected .wcpc-color-btn__name {
    font-weight: 700;
    color: #1a1a1a;
}

/* Badge quantità sul cerchietto */
.wcpc-color-btn__qty {
    position: absolute;
    top: 0; right: 0;
    background: #43a047;
    color: #fff;
    border-radius: 50%;
    min-width: 17px; height: 17px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 3px;
    box-sizing: border-box;
}

/* ---- PANEL TAGLIE ---- */
.wcpc-size-panels { margin-bottom: 12px; }

.wcpc-size-panel {
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    overflow: hidden;
}

.wcpc-size-panel__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f7f7f7;
    border-bottom: 1px solid #e8e8e8;
}

.wcpc-size-panel__color-name {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}

.wcpc-row-total-wrap {
    margin-left: auto;
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

.wcpc-row-total-wrap strong {
    color: #1a1a1a;
    font-weight: 700;
    font-size: 14px;
}

.wcpc-size-panel__sizes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: 8px;
    padding: 12px 14px;
}

.wcpc-size-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wcpc-size-cell__label {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* Input quantità */
.wcpc-qty {
    width: 100%;
    height: 44px;
    text-align: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    background: #fff;
    -moz-appearance: textfield;
    box-sizing: border-box;
    transition: border-color .12s, background .12s;
}

.wcpc-qty::-webkit-outer-spin-button,
.wcpc-qty::-webkit-inner-spin-button { -webkit-appearance: none; }

.wcpc-qty:focus {
    border-color: #2196f3;
    background: #e8f4ff;
    outline: none;
}

/* Totali per taglia */
.wcpc-col-totals {
    background: #f0f0f0;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.wcpc-col-totals__label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 8px;
}

.wcpc-col-totals__cells {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: 8px;
}

.wcpc-col-total-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.wcpc-col-total-cell__size {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.wcpc-col-total {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.wcpc-col-total-cell--grand .wcpc-col-total-cell__size { color: #555; }
.wcpc-col-total-cell--grand strong { font-size: 17px; color: #c0392b; }

/* ---- PRICE SUMMARY ---- */
.wcpc-price-summary {
    background: #f7f7f7;
    border: 1px solid #e4e4e4;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.wcpc-price-summary__row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
    color: #555;
}

.wcpc-price-summary__row--total {
    border-top: 1px solid #e0e0e0;
    margin-top: 6px;
    padding-top: 8px;
    font-size: 16px;
    color: #1a1a1a;
}

.wcpc-price-summary__row--total strong {
    font-size: 20px;
    color: #c0392b;
}

/* ---- TIERS ---- */
.wcpc-tiers-toggle {
    font-size: 12px;
    margin-bottom: 4px;
}

.wcpc-tiers-toggle summary {
    color: #2196f3;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.wcpc-tiers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 12px;
}

.wcpc-tiers-table th,
.wcpc-tiers-table td {
    padding: 5px 10px;
    border: 1px solid #e8e8e8;
    text-align: left;
}

.wcpc-tiers-table thead th { background: #f5f5f5; font-weight: 600; }
.wcpc-tiers-table tr.tier-active { background: #e8f5e9; font-weight: 700; }

/* ---- OPTIONS (tecnica / posizione) ---- */
.wcpc-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wcpc-option input[type="radio"] { display: none; }

.wcpc-option__label {
    display: inline-block;
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: border-color .12s, background .12s, color .12s;
}

.wcpc-option input:checked + .wcpc-option__label {
    border-color: #1a1a1a;
    background: #1a1a1a;
    color: #fff;
}

.wcpc-option__label:hover { border-color: #999; }

/* ---- UPLOAD ---- */
.wcpc-upload-area {
    border: 2px dashed #c8c8c8;
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    transition: border-color .15s, background .15s;
    cursor: pointer;
}

.wcpc-upload-area.drag-over {
    border-color: #2196f3;
    background: #e3f2fd;
}

.wcpc-upload-area.has-file {
    border-style: solid;
    border-color: #4caf50;
    background: #f1fff3;
}

.wcpc-file-input { display: none; }

.wcpc-upload-icon { font-size: 32px; display: block; margin-bottom: 8px; }

.wcpc-upload-placeholder p {
    margin: 4px 0;
    font-size: 13px;
    color: #555;
}

.wcpc-upload-btn {
    background: none;
    border: none;
    color: #2196f3;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
}

.wcpc-upload-hint { font-size: 11px !important; color: #999 !important; }

.wcpc-upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.wcpc-upload-filename {
    font-size: 13px;
    font-weight: 600;
    color: #2e7d32;
}

.wcpc-upload-remove {
    background: none;
    border: none;
    color: #c62828;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

/* ---- ACTIONS ---- */
.wcpc-step--actions {
    background: transparent;
    border: none;
    padding: 0;
}

#wcpc-messages { margin-bottom: 10px; font-size: 13px; }
.wcpc-msg--error   { color: #c62828; }
.wcpc-msg--success { color: #2e7d32; font-weight: 600; }

.wcpc-btn-add-to-cart {
    width: 100%;
    padding: 14px 24px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    border-radius: 4px !important;
    transition: opacity .2s !important;
}

.wcpc-btn-add-to-cart:disabled {
    opacity: .4;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .wcpc-step { padding: 14px; }
    .wcpc-qty { height: 38px; font-size: 14px; min-width: 52px; }
}

/* ====================================================
   UPLOAD ZONES
==================================================== */
.wcpc-upload-zone {
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 18px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #fafafa;
    user-select: none;
}

.wcpc-upload-zone:hover,
.wcpc-upload-zone.drag-over {
    border-color: #2196f3;
    background: #f0f7ff;
}

.wcpc-upload-zone.has-file {
    border-style: solid;
    border-color: #43a047;
    background: #f1fff3;
}

.wcpc-upload-zone--single {
    padding: 28px 20px;
}

.wcpc-file-input { display: none; }

.wcpc-upload-zone__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wcpc-upload-zone__icon { font-size: 24px; }

.wcpc-upload-zone__text {
    font-size: 13px;
    color: #555;
}

.wcpc-upload-trigger {
    background: none;
    border: none;
    color: #2196f3;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
}

.wcpc-upload-zone__hint {
    font-size: 11px;
    color: #aaa;
    display: block;
    margin-top: 2px;
}

/* Preview file */
.wcpc-upload-zone__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.wcpc-upload-zone__thumb img {
    max-width: 64px;
    max-height: 64px;
    border-radius: 4px;
    object-fit: contain;
    border: 1px solid #e0e0e0;
}

.wcpc-upload-zone__filename {
    font-size: 12px;
    font-weight: 600;
    color: #2e7d32;
    word-break: break-all;
    max-width: 200px;
}

.wcpc-upload-zone__remove {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    color: #c62828;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ====================================================
   POSIZIONI CON UPLOAD (per_position mode)
==================================================== */
.wcpc-upload-hint-text {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

.wcpc-positions-upload-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wcpc-pos-upload-item {
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .15s;
}

.wcpc-pos-upload-item:has(.wcpc-pos-check:checked) {
    border-color: #43a047;
}

.wcpc-pos-upload-item__header {
    padding: 12px 16px;
    background: #f7f7f7;
    cursor: pointer;
}

.wcpc-pos-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.wcpc-pos-toggle input[type="checkbox"] {
    display: none;
}

.wcpc-pos-toggle__box {
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .12s, border-color .12s;
    background: #fff;
}

.wcpc-pos-toggle input:checked + .wcpc-pos-toggle__box {
    background: #43a047;
    border-color: #43a047;
}

.wcpc-pos-toggle input:checked + .wcpc-pos-toggle__box::after {
    content: '✓';
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.wcpc-pos-upload-item__body {
    padding: 12px 16px;
    border-top: 1px solid #e4e4e4;
    background: #fff;
}

/* Zona upload con file mancante (evidenziata al tentativo di ATC) */
.wcpc-upload-zone.missing-file {
    border-color: #e53935 !important;
    background: #fff5f5 !important;
    animation: wcpc-shake .3s ease;
}

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

/* -----------------------------------------------------------------------
   NEUTRO + ANTEPRIME POSIZIONE
----------------------------------------------------------------------- */
.wcpc-neutral-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f8f8;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: border-color .2s;
}
.wcpc-neutral-toggle:has(input:checked) {
    border-color: var(--wcpc-accent, #c0392b);
    background: #fff5f5;
}
.wcpc-neutral-toggle__box {
    width: 20px;
    height: 20px;
    border: 2px solid #999;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s, border-color .2s;
}
.wcpc-neutral-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.wcpc-neutral-toggle input:checked ~ .wcpc-neutral-toggle__box {
    background: var(--wcpc-accent, #c0392b);
    border-color: var(--wcpc-accent, #c0392b);
}
.wcpc-neutral-toggle input:checked ~ .wcpc-neutral-toggle__box::after {
    content: '✓';
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.wcpc-neutral-toggle__label { font-weight: 600; }

.wcpc-pos-preview-img {
    margin: 10px 0 12px;
    text-align: center;
}
.wcpc-pos-preview-img img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    display: block;
    margin: 0 auto;
}
.wcpc-pos-preview-img--radio {
    margin-top: 8px;
    padding: 8px;
    background: #fafafa;
    border-radius: 6px;
}

/* -----------------------------------------------------------------------
   INFO PRODOTTO (lavaggio, certificazioni, packaging)
----------------------------------------------------------------------- */
.wcpc-product-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.wcpc-info-block {
    flex: 1 1 200px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.wcpc-info-block__title {
    display: block;
    padding: 10px 14px;
    background: #f5f5f5;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #e0e0e0;
}
.wcpc-info-block > div {
    padding: 12px 14px;
}
.wcpc-washing-icons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wcpc-washing-icon  { width: 40px; height: 40px; object-fit: contain; }
.wcpc-cert-logos    { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.wcpc-cert-logo     { max-height: 60px; max-width: 80px; object-fit: contain; }
.wcpc-packaging-text { margin: 0 0 8px; font-size: 14px; }
.wcpc-packaging-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.wcpc-packaging-img  { max-height: 80px; border-radius: 4px; border: 1px solid #e0e0e0; }

/* -----------------------------------------------------------------------
   NOTA CLIENTE
----------------------------------------------------------------------- */
.wcpc-customer-note {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

/* -----------------------------------------------------------------------
   NON HO IL FILE
----------------------------------------------------------------------- */
.wcpc-no-file-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: #eef4ff;
    border: 2px solid #b3d0ff;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: border-color .2s;
}
.wcpc-no-file-toggle:has(input:checked) {
    border-color: #2271b1;
    background: #ddeeff;
}
.wcpc-no-file-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.wcpc-no-file-toggle__box {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #2271b1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    transition: background .2s;
}
.wcpc-no-file-toggle:has(input:checked) .wcpc-no-file-toggle__box {
    background: #2271b1;
}
.wcpc-no-file-toggle:has(input:checked) .wcpc-no-file-toggle__box::after {
    content: '✓';
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.wcpc-no-file-toggle__text { display: flex; flex-direction: column; gap: 3px; }
.wcpc-no-file-toggle__text strong { font-size: 14px; color: #2271b1; }
.wcpc-no-file-toggle__text small  { font-size: 12px; color: #555; }

/* -----------------------------------------------------------------------
   BOX ASSISTENZA
----------------------------------------------------------------------- */
.wcpc-assistance-box {
    margin-top: 20px;
    padding: 16px 20px;
    background: #f0f6ff;
    border: 1px solid #b3d0ff;
    border-radius: 10px;
}
.wcpc-assistance-box__title {
    font-weight: 700;
    font-size: 14px;
    color: #1a3a6b;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.wcpc-assistance-box__contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.wcpc-assistance-box__contact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #b3d0ff;
    border-radius: 8px;
    text-decoration: none;
    color: #1a3a6b;
    font-weight: 600;
    font-size: 14px;
    transition: background .2s;
}
.wcpc-assistance-box__contact:hover { background: #ddeeff; }
.wcpc-assistance-box__contact .dashicons { font-size: 18px; }
