/* ==========================================================================
   WC Product Samples — Cart Widget Styles
   Compatibile con YOOtheme e qualsiasi tema WooCommerce
   ========================================================================== */

/* Widget wrapper
   -------------------------------------------------------------------------- */
.wcps-widget {
    margin: 2em 0;
    padding: 24px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Header
   -------------------------------------------------------------------------- */
.wcps-widget__header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f0;
}

.wcps-widget__title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0 0 4px;
    color: inherit;
}

.wcps-widget__subtitle {
    font-size: 0.9em;
    color: #757575;
    margin: 0;
}

/* Barra contatore
   -------------------------------------------------------------------------- */
.wcps-counter {
    margin-bottom: 20px;
}

.wcps-counter__text {
    display: block;
    font-size: 0.85em;
    color: #555;
    margin-bottom: 6px;
}

.wcps-counter__bar {
    height: 6px;
    background: #e9e9e9;
    border-radius: 3px;
    overflow: hidden;
}

.wcps-counter__fill {
    height: 100%;
    background: #7f54b3;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.wcps-counter__fill.is-full {
    background: #00a32a;
}

/* Grid campioncini
   -------------------------------------------------------------------------- */
.wcps-samples-grid {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

/* Singolo campioncino — layout verticale su tutti i breakpoint
   -------------------------------------------------------------------------- */
.wcps-sample-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    border: 2px solid #e2e2e2;
    border-radius: 6px;
    background: #fafafa;
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: default;
}

.wcps-sample-item.is-selected {
    border-color: #7f54b3;
    background: #f9f5ff;
}

/* Immagine — sempre 1:1
   -------------------------------------------------------------------------- */
.wcps-sample-item__image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcps-sample-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 1 / 1;
}

.wcps-sample-item__no-image {
    color: #ccc;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Info testo — senza troncamento
   -------------------------------------------------------------------------- */
.wcps-sample-item__info {
    flex: 1;
}

.wcps-sample-item__name {
    display: block;
    font-weight: 600;
    font-size: 0.92em;
    margin-bottom: 3px;
    white-space: normal;
}

.wcps-sample-item__desc {
    display: block;
    font-size: 0.8em;
    color: #757575;
    margin-bottom: 3px;
    white-space: normal;
}

.wcps-sample-item__stock {
    display: none;
}

/* Controlli quantità — in fondo al card
   -------------------------------------------------------------------------- */
.wcps-sample-item__qty {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.wcps-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}

.wcps-qty-btn:hover:not(:disabled) {
    background: #7f54b3;
    border-color: #7f54b3;
    color: #fff;
}

.wcps-qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.wcps-qty-value {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
    font-size: 1em;
}

/* Azioni
   -------------------------------------------------------------------------- */
.wcps-widget__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.wcps-save-btn {
    /* eredita stile .button da WooCommerce/tema */
    min-width: 180px;
}

.wcps-save-btn.is-loading {
    opacity: 0.7;
    cursor: wait;
}

.wcps-none-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.9em;
    color: #757575;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.wcps-none-btn:hover {
    color: #333;
}

/* Feedback
   -------------------------------------------------------------------------- */
.wcps-feedback {
    margin-top: 12px;
    font-size: 0.9em;
    min-height: 20px;
    transition: opacity 0.3s;
}

.wcps-feedback.is-success {
    color: #00a32a;
}

.wcps-feedback.is-error {
    color: #d63638;
}

.wcps-no-samples-notice {
    padding: 10px 14px;
    background: #f0f6fc;
    border-left: 3px solid #2271b1;
    margin-bottom: 16px;
    font-size: 0.9em;
}

.wcps-reset-choice {
    margin-left: 8px;
    font-size: 0.9em;
}

/* Riepilogo nel totale carrello
   -------------------------------------------------------------------------- */
.wcps-cart-summary th,
.wcps-cart-summary td {
    font-size: 0.9em;
    color: #555;
}

/* Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .wcps-samples-grid {
        grid-template-columns: 1fr;
    }

    .wcps-widget {
        padding: 16px;
    }

    .wcps-widget__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .wcps-save-btn {
        width: 100%;
        text-align: center;
    }

    .wcps-none-btn {
        text-align: center;
    }
}
