/* @author [Webdojo] - Stili Portale Post-Vendita */

.wd-portal-wrapper {
    max-width: 860px;
}

.wd-portal-wrapper h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wd-portal-order-ref {
    color: #888;
    font-size: 14px;
    margin-bottom: 0;
}

/* @author [Webdojo] - Riepilogo Prodotto in Testata */
.wd-portal-product-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fdfdfd;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #eee;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.wd-summary-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    display: block;
    background: #fff;
}

.wd-summary-details {
    flex: 1;
}

.wd-summary-details h2 {
    margin-bottom: 5px !important;
}

@media (max-width: 600px) {
    .wd-portal-product-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    .wd-summary-image img {
        width: 100px;
        height: 100px;
    }
}

.wd-portal-back {
    display: inline-block;
    margin-bottom: 16px;
    color: #ef9000;
    text-decoration: none;
    font-weight: 500;
}
.wd-portal-back:hover {
    text-decoration: underline;
}

/* =====================================================
   LISTA PERSONALIZZAZIONI — CARD LAYOUT
   Sostituisce la vecchia tabella .wd-portal-table.
   Mobile-first: card verticali scrollabili;
   Desktop: riga orizzontale con colonne fisse.
   @author [Webdojo]
   ===================================================== */

.wd-portal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.wd-portal-card {
    background: #fff;
    border: 1px solid #ebebeb;
    border-left: 4px solid #f59100;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.wd-portal-card--done {
    border-left-color: #10b981;
}

.wd-portal-card:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.07);
}

/* Header: ordine + data */
.wd-portal-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 6px;
}

.wd-portal-card__order {
    font-size: 13px;
    font-weight: 700;
    color: #222;
}

.wd-portal-card__date {
    font-size: 12px;
    color: #bbb;
}

/* Nome prodotto */
.wd-portal-card__product {
    margin: 0 !important;
    padding: 6px 16px 10px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #333 !important;
    line-height: 1.4 !important;
    background: none !important;
    border: none !important;
}

/* Footer: stato + pulsante azione */
.wd-portal-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 14px;
    border-top: 1px solid #f5f5f5;
    gap: 10px;
}

.wd-portal-card__status {
    font-size: 13px;
    flex-shrink: 0;
}

/* Layout desktop: ogni card diventa una riga orizzontale */
@media (min-width: 769px) {
    .wd-portal-card {
        display: flex;
        align-items: stretch;
        border-radius: 10px;
    }

    .wd-portal-card__head {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        padding: 16px 20px;
        min-width: 100px;
        border-right: 1px solid #f5f5f5;
        gap: 2px;
    }

    .wd-portal-card__product {
        flex: 1;
        display: flex !important;
        align-items: center;
        padding: 16px 20px !important;
    }

    .wd-portal-card__foot {
        border-top: none;
        border-left: 1px solid #f5f5f5;
        padding: 16px 20px;
        min-width: 210px;
        justify-content: flex-end;
        gap: 12px;
    }
}

.wd-status-pending {
    color: #e67e22;
    font-weight: 600;
}
.wd-status-completed {
    color: #27ae60;
    font-weight: 600;
}

/* =====================================================
   RAGGRUPPAMENTO PERSONALIZZAZIONI PER ORDINE
   Ogni gruppo = un ordine. Le card prodotto stanno
   dentro il gruppo senza bordo sinistro proprio.
   @author [Webdojo]
   ===================================================== */

.wd-portal-group {
    border: 1px solid #e8e8e8;
    border-left: 4px solid #f59100;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.18s ease;
}

.wd-portal-group--done {
    border-left-color: #10b981;
}

.wd-portal-group:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

/* Header gruppo: ordine + data + mini progress */
.wd-portal-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 13px 16px 11px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.wd-portal-group__meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wd-portal-group__order {
    font-size: 14px;
    font-weight: 700;
    color: #222 !important;
    text-decoration: none !important;
}

.wd-portal-group__order:hover {
    color: #f59100 !important;
}

.wd-portal-group__date {
    font-size: 12px;
    color: #bbb;
}

.wd-portal-group__count {
    font-size: 12px;
    color: #bbb;
}

.wd-portal-group__count::before {
    content: "·";
    margin-right: 6px;
}

/* Mini progress bar */
.wd-portal-group__progress {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wd-portal-group__progress-label {
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    white-space: nowrap;
}

.wd-portal-group--done .wd-portal-group__progress-label {
    color: #0a8a63;
}

.wd-portal-group__progress-track {
    width: 70px;
    height: 5px;
    background: #f0e2cf;
    border-radius: 99px;
    overflow: hidden;
    flex-shrink: 0;
}

.wd-portal-group__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59100, #ffb347);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.wd-portal-group--done .wd-portal-group__progress-bar {
    background: linear-gradient(90deg, #10b981, #34d399);
}

/* Card prodotto NESTED: niente bordo proprio, separatore orizzontale */
.wd-portal-group__items .wd-portal-card {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #f5f5f5;
    box-shadow: none;
}

.wd-portal-group__items .wd-portal-card:last-child {
    border-bottom: none;
}

.wd-portal-group__items .wd-portal-card:hover {
    background: #fffdf9;
    box-shadow: none;
}

/* Desktop ≥769px: card nested in riga (product | status + action) */
@media (min-width: 769px) {
    .wd-portal-group__items .wd-portal-card {
        display: flex;
        align-items: stretch;
        border-radius: 0;
    }

    .wd-portal-group__items .wd-portal-card .wd-portal-card__product {
        flex: 1;
        padding: 14px 20px !important;
        display: flex !important;
        align-items: center;
    }

    .wd-portal-group__items .wd-portal-card .wd-portal-card__foot {
        border-top: none;
        border-left: 1px solid #f5f5f5;
        padding: 14px 20px;
        min-width: 210px;
        justify-content: flex-end;
        gap: 12px;
    }
}

.wd-btn-configure {
    background-color: #ef9000 !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 18px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    transition: background-color 0.2s;
}
.wd-btn-configure:hover {
    background-color: #d68000 !important;
}

.wd-btn-view {
    background-color: #f0f0f0 !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
    padding: 8px 18px !important;
    border-radius: 4px !important;
}

/* Form di configurazione */

/* =====================================================
   TAB MULTI-UNITÀ
   ===================================================== */

.wd-unit-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 6px 6px 0 0;
}

.wd-unit-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid #ccc;
    border-radius: 20px;
    background: #fff;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.wd-unit-tab:hover {
    border-color: #ef9000;
    color: #ef9000;
}

.wd-unit-tab.is-active {
    background: #ef9000;
    border-color: #ef9000;
    color: #fff;
    font-weight: 600;
}

.wd-unit-tab .wd-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255,255,255,0.3);
    color: inherit;
}

.wd-unit-tab.is-draft .wd-tab-badge {
    background: #f0ad4e;
    color: #fff;
}

.wd-unit-tab.is-done .wd-tab-badge {
    background: #5cb85c;
    color: #fff;
}

.wd-unit-panel {
    display: none;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 20px;
    margin-bottom: 24px;
    background: #fff;
}

.wd-unit-panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #444;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e0e0e0;
}


.wd-portal-form {
    margin-top: 20px;
}

.wd-portal-field {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.2s;
}

.wd-portal-field:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: #ef9000;
}

.wd-portal-field.wd-field-error {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.wd-field-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
    user-select: none;
}

.wd-field-header:hover {
    background: #f5f5f5;
}

.wd-portal-label {
    display: block;
    font-weight: 600;
    font-size: 16px;
    margin: 0 !important;
    color: #333;
}

.wd-toggle-icon {
    width: 10px;
    height: 10px;
    border-right: 2px solid #999;
    border-bottom: 2px solid #999;
    transform: rotate(45deg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 5px;
    margin-top: -4px;
    flex-shrink: 0;
}

.wd-portal-field.is-open .wd-toggle-icon {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.wd-field-content {
    padding: 20px;
    border-top: 1px solid #eee;
    display: none; /* jQuery gestisce show/hide con slideToggle */
}

.wd-required {
    color: #e74c3c;
}

/* Drag & Drop Zone */
.wd-drag-drop-zone {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 20px;
}
.wd-drag-drop-zone:hover, .wd-drag-drop-zone.is-dragover {
    border-color: #ef9000;
    background: #fff9f0;
}
.wd-drop-zone-content {
    pointer-events: none;
}
.wd-drop-icon {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23ef9000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>') no-repeat center;
    background-size: contain;
}
.wd-drop-text {
    font-size: 16px;
    color: #333;
    margin: 0;
    font-weight: 500;
}
.wd-drop-text span {
    color: #ef9000;
    text-decoration: underline;
}

/* Cropper Controls & Actions */
.wd-cropper-controls {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 25px;
    padding: 20px;
    background: #fdfdfd;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}
.wd-cropper-presets {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.wd-cropper-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Base Button Style */
.wd-preset-btn, .wd-btn-confirm-crop, .wd-btn-cancel-crop, .wd-btn-start-crop {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 26px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px solid transparent;
    text-decoration: none !important;
    line-height: 1;
}

/* Preset Buttons (Rect/Oval) */
.wd-preset-btn {
    background: #f8f9fa;
    color: #555;
    border-color: #e9ecef;
}
.wd-preset-btn:hover {
    border-color: #d88200;
    color: #d88200;
}
.wd-preset-btn.is-active {
    background: #e67e22; /* Arancione più caldo */
    color: #ffffff !important;
    border-color: #e67e22;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

/* Action Buttons */
.wd-btn-confirm-crop {
    background: #219150; /* Verde più scuro e leggibile */
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(33, 145, 80, 0.2);
}
.wd-btn-confirm-crop:hover {
    background: #1a7a43;
    transform: translateY(-2px);
}

.wd-btn-cancel-crop {
    background: #ffffff;
    color: #666;
    border-color: #ddd;
}
.wd-btn-cancel-crop:hover {
    background: #f1f1f1;
    color: #333;
}

.wd-btn-start-crop {
    background: #e67e22;
    color: #ffffff !important;
    margin-top: 15px;
}

/* Icons refinement */
.wd-icon-rect, .wd-icon-oval, .wd-icon-square {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
}
.wd-icon-rect { border-radius: 2px; }
.wd-icon-square { border-radius: 0; }
.wd-icon-oval { border-radius: 50%; }

.wd-cropper-feedback {
    text-align: center;
    font-size: 13px;
    color: #1a7a43;
    font-weight: 600;
    margin-top: 15px;
    padding: 12px;
    background: #e9f7ef;
    border-radius: 8px;
    border: 1px solid #d4efdf;
}

/* Previews Improvement */
.wd-upload-previews {
    justify-content: flex-start;
}
.wd-preview-item {
    max-width: 180px;
}
.wd-upload-preview {
    margin-bottom: 12px;
    position: relative;
    display: inline-block;
}
.wd-upload-preview img {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #ddd;
    object-fit: cover;
    display: block;
}
.wd-delete-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #d63638;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s;
    z-index: 10;
    padding: 0;
    line-height: 1;
}
.wd-delete-image:hover {
    background: #b32d2e;
    transform: scale(1.1);
}
.wd-upload-preview img:hover {
    transform: scale(1.02);
}

/* Cropper Oval Mask */
.is-oval .cropper-view-box,
.is-oval .cropper-face {
    border-radius: 50%;
}
.is-oval .cropper-view-box {
    box-shadow: 0 0 0 1px #ef9000;
    outline: none;
}

/* Gallery Grid */
.wd-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

/* Gallery con pochi item: colonne ridotte con item più grandi e leggibili */
.wd-gallery-grid--xs {
    grid-template-columns: repeat(2, minmax(0, 180px));
}
.wd-gallery-grid--sm {
    grid-template-columns: repeat(3, minmax(0, 160px));
}
.wd-gallery-grid--md {
    grid-template-columns: repeat(5, minmax(0, 130px));
}
.wd-gallery-item {
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.wd-gallery-item:hover {
    border-color: #ef9000;
}
.wd-gallery-item input[type="radio"] {
    position: absolute;
    opacity: 0;
}
.wd-gallery-item input[type="radio"]:checked + img {
    opacity: 1;
}
.wd-gallery-item input[type="radio"]:checked ~ img,
.wd-gallery-item:has(input:checked) {
    border-color: #ef9000;
    box-shadow: 0 0 0 3px rgba(239, 144, 0, 0.3);
}
.wd-gallery-item:has(input:checked) {
    border-color: #ef9000;
    box-shadow: 0 0 0 3px rgba(239, 144, 0, 0.3);
}
.wd-gallery-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.wd-gallery-item:hover img {
    opacity: 1;
}

/* Gallery Zoom Button */
.wd-gallery-zoom {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: rgba(239, 144, 0, 0.9);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
    z-index: 5;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.wd-gallery-item:hover .wd-gallery-zoom {
    opacity: 1;
    transform: translateY(0);
}

.wd-gallery-zoom:hover {
    background: #d68000;
    transform: scale(1.1) !important;
}

.wd-gallery-item-name {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    padding: 5px 4px 4px;
    color: #444;
    word-break: break-word;
    background: #fff;
}

.wd-icon-zoom {
    display: block;
    width: 16px;
    height: 16px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>') no-repeat center;
    background-size: contain;
}

/* Lightbox Modal */
.wd-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wd-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.wd-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wd-lightbox-img-wrapper {
    overflow: auto;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.wd-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transition: all 0.3s ease;
    cursor: zoom-in;
}

.wd-lightbox-img.is-original {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

.wd-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.wd-lightbox-close:hover {
    color: #ef9000;
}

.wd-lightbox-nav {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.wd-lightbox-btn-zoom-orig {
    background: #ef9000 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 25px !important;
    border-radius: 20px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: background 0.2s, transform 0.2s !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2) !important;
}

.wd-lightbox-btn-zoom-orig:hover {
    background: #d68000 !important;
    transform: translateY(-1px) !important;
}

.wd-lightbox-btn-zoom-orig.is-active {
    background: #ffffff !important;
    color: #ef9000 !important;
    box-shadow: 0 4px 15px rgba(239, 144, 0, 0.4) !important;
}

/* Text fields group */
.wd-text-fields-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.wd-field-row label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 4px;
    color: #555;
}
.wd-field-row input[type="text"],
.wd-field-row input[type="date"],
.wd-field-row textarea,
.wd-field-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.wd-field-row input:focus,
.wd-field-row textarea:focus,
.wd-field-row select:focus {
    border-color: #ef9000;
    outline: none;
    box-shadow: 0 0 0 2px rgba(239, 144, 0, 0.15);
}

/* Dedica toggle */
.wd-dedica-toggle {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
}
.wd-dedica-toggle label {
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
}
.wd-dedica-libera {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}
/* Carosello dediche predefinite */
.wd-dedica-carousel {
    display: none;
    margin-top: 6px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.wd-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: #f7f7f7;
    border-bottom: 1px solid #e0e0e0;
}
.wd-carousel-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 14px;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.wd-carousel-btn:hover:not(:disabled) {
    background: #efefef;
    border-color: #aaa;
}
.wd-carousel-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
.wd-carousel-counter {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}
.wd-carousel-slides {
    position: relative;
    overflow: hidden;
    min-height: 80px;
}
.wd-carousel-slide {
    display: none;
    padding: 18px 16px 14px;
    transition: transform 0.28s ease, opacity 0.28s ease;
}
.wd-carousel-slide.is-active {
    display: block;
}
.wd-carousel-slide.is-selected {
    background: #fdf9f0;
}
/* Slide entrante da destra */
.wd-carousel-slide.slide-enter-right {
    transform: translateX(100%);
    opacity: 0;
}
/* Slide entrante da sinistra */
.wd-carousel-slide.slide-enter-left {
    transform: translateX(-100%);
    opacity: 0;
}
/* Slide uscente verso sinistra */
.wd-carousel-slide.slide-exit-left {
    transform: translateX(-100%);
    opacity: 0;
    position: absolute;
    top: 0; left: 0; right: 0;
}
/* Slide uscente verso destra */
.wd-carousel-slide.slide-exit-right {
    transform: translateX(100%);
    opacity: 0;
    position: absolute;
    top: 0; left: 0; right: 0;
}
.wd-carousel-text {
    font-size: 14px;
    line-height: 1.75;
    color: #444;
    margin-bottom: 14px;
    font-style: italic;
}
.wd-carousel-select-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: #ef9000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}
.wd-carousel-select-btn:hover {
    background: #d68000;
}
.wd-carousel-select-btn.is-selected {
    background: #27ae60;
    cursor: default;
}
.wd-carousel-selected-info {
    padding: 9px 14px;
    background: #f0faf3;
    border-top: 1px solid #c8e6c9;
    font-size: 13px;
    color: #27ae60;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.wd-carousel-deselect {
    background: none;
    border: none;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    margin-left: 2px;
}
.wd-carousel-deselect:hover {
    color: #c00;
}

/* Text simple */
.wd-portal-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}

/* Preset select */
.wd-portal-field > select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Actions */
.wd-portal-actions {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.wd-btn-save {
    background-color: #ef9000 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 32px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}
.wd-btn-save:hover {
    background-color: #d68000 !important;
    transform: translateY(-1px);
}
.wd-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.wd-portal-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #eee;
    border-top-color: #ef9000;
    border-radius: 50%;
    animation: wd-spin 0.6s linear infinite;
}
@keyframes wd-spin {
    to { transform: rotate(360deg); }
}

/* Modal Popup - Forza Overlay */
#wd-portal-modal.wd-modal {
    position: fixed !important;
    z-index: 99999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0,0,0,0.7) !important;
    display: none; /* Inizialmente nascosto */
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(5px);
}

#wd-portal-modal .wd-modal-content {
    background-color: #fff !important;
    padding: 40px !important;
    border-radius: 15px !important;
    width: 90% !important;
    max-width: 500px !important;
    text-align: center !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3) !important;
    position: relative !important;
    margin: auto !important;
}

#wd-portal-modal .wd-modal-icon {
    font-size: 60px !important;
    margin-bottom: 20px !important;
    display: block !important;
}

#wd-portal-modal .wd-modal-text {
    font-size: 18px !important;
    color: #333 !important;
    margin-bottom: 25px !important;
    font-weight: 500 !important;
}

#wd-portal-modal .wd-modal-close {
    position: absolute !important;
    right: 20px !important;
    top: 15px !important;
    font-size: 28px !important;
    cursor: pointer !important;
    color: #999 !important;
}

#wd-portal-modal .wd-modal-btn-close {
    background-color: #ef9000 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 40px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

/* Icone Stati */
#wd-portal-modal.is-success .wd-modal-icon::before {
    content: "✓";
    color: #46b450;
}
#wd-portal-modal.is-error .wd-modal-icon::before {
    content: "✕";
    color: #d63638;
}

/* Responsive Fix */
@media (max-width: 768px) {
    #wd-portal-modal .wd-modal-content {
        width: 95% !important;
        padding: 30px 20px !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .wd-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    .wd-dedica-toggle {
        flex-direction: column;
        gap: 8px;
    }

    /* Bottoni forma ritaglio: colonna full-width su mobile */
    .wd-cropper-controls {
        padding: 14px;
        gap: 16px;
    }
    .wd-cropper-presets {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .wd-preset-btn {
        width: 100%;
        padding: 13px 20px;
        justify-content: center;
    }
}

/* =====================================================
   Font Selector - Chips compatte + Anteprima live
   ===================================================== */

.wd-font-row {
    margin-top: 6px;
}

/* ── Contenitore chips ── */
.wd-font-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* ── Singola chip ── */
.wd-font-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    border: 1.5px solid #d5d5d5;
    border-radius: 20px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    user-select: none;
    white-space: nowrap;
    line-height: 1.3;
}

.wd-font-chip span {
    font-size: 13px;
    color: #333;
    pointer-events: none;
}

.wd-font-chip:hover {
    border-color: #ef9000;
    background: #fff9f0;
}

/* Chip selezionata */
.wd-font-chip:has(input:checked) {
    border-color: #ef9000;
    background: #fff3e0;
    box-shadow: 0 0 0 2px rgba(239, 144, 0, 0.25);
}

/* Nasconde il radio button nativo */
.wd-font-chip input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Stato disabilitato */
.wd-font-chip:has(input:disabled) {
    cursor: default;
    opacity: 0.75;
}

/* ── Box anteprima live ── */
.wd-font-preview-box {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8f8f8;
    border: 1px solid #e4e4e4;
    border-radius: 6px;
    min-height: 52px;
}

.wd-font-preview-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    margin: 0 0 6px;
    font-weight: 600;
}

.wd-font-preview-text {
    display: block;
    font-size: 18px;
    color: #2c2c2c;
    line-height: 1.5;
    transition: font-family 0.2s;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .wd-font-chips  { gap: 5px; }
    .wd-font-chip   { padding: 4px 10px; }
    .wd-font-chip span { font-size: 12px; }
    .wd-font-preview-text { font-size: 15px; }
}
