.fvto-product-picker { margin: 8px 0 12px; }
#fvto-product-search { width: 100%; max-width: 360px; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 8px; }
#fvto-product-results { 
    list-style: none; 
    padding: 6px 0 0; 
    margin: 0; 
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}
#fvto-product-results .fvto-product-item { 
    display: flex; 
    flex-direction: column;
    align-items: center;
    gap: 8px; 
    padding: 10px 8px; 
    border: 1px solid #e5e7eb; 
    border-radius: 8px; 
    cursor: pointer; 
    background: #fff;
    text-align: center;
    transition: all 0.2s ease;
}
#fvto-product-results .fvto-product-item img { 
    max-width: 56px; 
    max-height: 56px; 
    width: auto;
    height: auto;
    object-fit: contain; 
    border-radius: 6px;
    border: 1px solid #f3f4f6;
    /* Fallback per browser che non supportano object-fit */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
#fvto-product-results .fvto-product-item span {
    font-size: 12px;
    line-height: 1.3;
    color: #374151;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#fvto-product-results .fvto-product-item:hover { 
    background: #f9fafb; 
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.fvto-container {
    max-width: 900px;
    margin: 24px auto;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    /* Isolamento CSS per evitare conflitti con il tema */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* titolo rimosso */

/* brand accent removed */

/* Modal */
.fvto-modal-open { overflow: hidden; }
.fvto-modal { position: fixed; inset: 0; z-index: 99999; display: block; opacity: 0; transition: opacity .2s ease; }
.fvto-modal.open { opacity: 1; }
.fvto-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); }
.fvto-modal-dialog { position: relative; max-width: 1040px; margin: 40px auto; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 22px 70px rgba(0,0,0,0.35); transform: translateY(10px); transition: transform .2s ease; }
.fvto-modal.open .fvto-modal-dialog { transform: translateY(0); }
.fvto-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #eee; background: linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%); }
.fvto-modal-body { padding: 18px; max-height: calc(100vh - 160px); overflow: auto; background: #fff; }
.fvto-modal-close { background: transparent; border: none; font-size: 24px; cursor: pointer; line-height: 1; color: #667085; border-radius: 6px; padding: 2px 6px; }
.fvto-modal-close:hover { background: #eef2f7; color: #111; }

.fvto-upload-section {
    margin-bottom: 0;
    padding: 18px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #eef2f7;
    text-align: center;
}

/* Pair layout: prodotto + utente */
.fvto-pair { display: inline-flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
.fvto-slot { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 120px; 
    height: 120px; 
    border: none; 
    border-radius: 12px; 
    background: transparent; 
    overflow: hidden; 
    box-sizing: border-box; 
    /* Garantisce che le immagini si adattino correttamente */
    position: relative;
}
.fvto-slot-user { border: none; background: transparent; }
.fvto-slot-product img, .fvto-thumb-pair { 
    max-width: 120px; 
    max-height: 120px; 
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px; 
    display: block; 
    /* Fallback per browser che non supportano object-fit */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.fvto-plus { font-weight: 600; color: #6b7280; }
.fvto-upload-drop--square { width: 120px; height: 120px; padding: 0; border: 1px dashed #e5e7eb; display: flex; align-items: center; justify-content: center; border-radius: 12px; overflow: hidden; background: transparent; box-sizing: border-box; }
.fvto-slot-user .fvto-upload-drop--square { width: 100%; height: 100%; }
.fvto-upload-drop--square.has-file { border: none; background: transparent; }
.fvto-upload-drop--square.has-file img { 
    max-width: 120px; 
    max-height: 120px; 
    width: auto;
    height: auto;
    object-fit: contain; 
    border-radius: 12px; 
    display: block; 
    /* Fallback per browser che non supportano object-fit */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.fvto-product-ph { cursor: pointer; }
.fvto-upload-drop--square .fvto-upload-text { font-size: 12px; }

/* Pulsante sotto i riquadri */
.fvto-upload-section .button { display: block; width: 100%; max-width: 360px; margin: 10px auto 0; }

/* CTA shimmer */
.fvto-cta { position: relative; overflow: hidden; background: #111; color: #fff; border: 1px solid #111; }
.fvto-cta::before { content: ""; position: absolute; top: 0; left: -150%; width: 50%; height: 100%; background: linear-gradient(120deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.8) 50%, rgba(255,255,255,0) 100%); filter: blur(1px); transform: skewX(-20deg); opacity: .6; animation: fvto-shimmer 1.8s linear infinite; }
@keyframes fvto-shimmer { 0% { left: -150%; } 100% { left: 150%; } }

.fvto-upload-section h4 {
    display: none;
}

.fvto-instructions { color: #6b7280; font-size: 13px; margin-bottom: 8px; line-height: 1.5; }

.fvto-preview-section {
    margin-bottom: 20px;
    text-align: center;
}
/* Sezione preview rimossa dall'UI corrente */

.fvto-preview-section img {
    max-width: 300px;
    max-height: 400px;
    border: 2px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fvto-result-section { margin-top: 12px; text-align: center; }
/* removed external note */
/* Etichetta risultato non necessaria ora */

.fvto-result-viewer { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 100%; 
    height: 60vh; 
    background: #f5f7fb; 
    border: 1px solid #eef2f7; 
    border-radius: 12px; 
    overflow: hidden; 
    touch-action: none; 
    position: relative;
}
.fvto-result-section img { max-width: 100%; max-height: 100%; transform-origin: center center; transition: transform .06s ease; user-select: none; -webkit-user-drag: none; object-fit: contain; }

/* Header risultato per pagina singola */
.fvto-result-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 0 15px 0;
    border-bottom: 1px solid #eef2f7;
    position: relative;
}

.fvto-result-title {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: #374151;
}

/* Stile per h4 se usato come titolo */
.fvto-result-title h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: #374151;
}

.fvto-close-result-single {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
}

/* Controlli per shortcode */
.fvto-result-section {
    position: relative;
}

.fvto-close-result {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.fvto-close-btn {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fvto-close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    transform: translateY(-1px);
}

.fvto-new-try-btn {
    text-align: center;
    margin-top: 20px;
}

.fvto-new-try {
    background: #111;
    color: white;
    border: 1px solid #111;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fvto-new-try:hover {
    background: #333;
    border-color: #333;
    transform: translateY(-1px);
}

/* viewer ring removed */
.fvto-credits { margin-top: 8px; font-size: 13px; color: #555; }

.fvto-result-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Nascondi pulsanti di azione nella pagina singola (non shortcode) */
.fvto-result-section:not(.shortcode-mode) .fvto-result-actions {
    display: none;
}

/* Nascondi header con titolo e pulsante CHIUDI nel popup */
.fvto-modal-open .fvto-result-header {
    display: none;
}

.fvto-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.fvto-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    text-align: center;
}

.fvto-tryon-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fvto-person-silhouette {
    position: absolute;
    width: 40px;
    height: 60px;
    background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
    border-radius: 20px 20px 10px 10px;
    animation: person-breathe 2s ease-in-out infinite;
}

.fvto-person-silhouette::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
    border-radius: 50%;
}

.fvto-garment {
    position: absolute;
    width: 50px;
    height: 45px;
    background: linear-gradient(135deg, #007cba, #005a8b);
    border-radius: 8px;
    opacity: 0;
    animation: garment-appear 3s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.fvto-garment::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 8px;
    background: inherit;
    border-radius: 4px;
}

.fvto-connection-lines {
    position: absolute;
    width: 100%;
    height: 100%;
}

.fvto-connection-lines::before,
.fvto-connection-lines::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, transparent, #007cba, transparent);
    animation: connection-flow 2s ease-in-out infinite;
}

.fvto-connection-lines::before {
    left: 30px;
    top: 20px;
    animation-delay: 0s;
}

.fvto-connection-lines::after {
    right: 30px;
    top: 25px;
    animation-delay: 1s;
}

.fvto-magic-sparkles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.fvto-magic-sparkles::before,
.fvto-magic-sparkles::after,
.fvto-magic-sparkles {
    content: '✨';
    position: absolute;
    font-size: 12px;
    color: #007cba;
    animation: sparkle-float 2.5s ease-in-out infinite;
}

.fvto-magic-sparkles::before {
    top: 15px;
    left: 20px;
    animation-delay: 0.5s;
}

.fvto-magic-sparkles::after {
    bottom: 20px;
    right: 25px;
    animation-delay: 1.5s;
}

.fvto-loading-text {
    max-width: 300px;
}

.fvto-loading-main {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    animation: ai-text-pulse 2s ease-in-out infinite;
}

.fvto-loading-sub {
    font-size: 13px;
    color: #666;
    margin: 0;
    opacity: 0.8;
}

@keyframes person-breathe {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: scale(1.05);
        opacity: 1;
    }
}

@keyframes garment-appear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    20% {
        opacity: 0.3;
        transform: scale(0.9) translateY(-5px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1) translateY(0);
    }
    80% {
        opacity: 0.9;
        transform: scale(1.02) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
}

@keyframes connection-flow {
    0% {
        opacity: 0;
        transform: scaleY(0);
    }
    50% {
        opacity: 1;
        transform: scaleY(1);
    }
    100% {
        opacity: 0;
        transform: scaleY(0);
    }
}

@keyframes sparkle-float {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-5px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-15px) scale(0.5);
    }
}

@keyframes ai-text-pulse {
    0%, 100% { 
        opacity: 1;
    }
    50% { 
        opacity: 0.7;
    }
}

/* Fallback per browser che non supportano animazioni avanzate */
@supports not (animation: person-breathe 2s ease-in-out infinite) {
    .fvto-person-silhouette {
        animation: spin 1s linear infinite;
    }
    
    .fvto-garment,
    .fvto-connection-lines,
    .fvto-magic-sparkles {
        display: none;
    }
}

/* Fallback spinner originale per compatibilità */
.fvto-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fvto-product-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #007cba;
}

.fvto-product-info h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.fvto-product-details {
    display: flex;
    align-items: center;
    gap: 15px;
}

.fvto-product-details img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    border: 2px solid #ddd;
}

.fvto-product-text h5 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
}

.fvto-product-price {
    font-size: 18px;
    font-weight: bold;
    color: #007cba;
    margin: 0;
}

.fvto-product-tryon {
    margin: 20px 0;
}

#fvto-open-tryon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 6px;
}

.button { padding: 10px 20px; border-radius: 6px; cursor: pointer; margin: 5px; font-size: 14px; transition: all 0.2s ease; text-decoration: none; display: inline-block; }

.button.secondary {
    background: #6c757d;
    color: white;
}

.button.secondary:hover {
    background: #545b62;
}

/* Hidden native file input (replaced by dropzone) */
#fvto-photo-upload { display: none; }
.fvto-hidden-file { display: none; }
.fvto-upload-drop {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 360px;
    min-height: 88px;
    padding: 14px;
    border: 1px dashed #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    transition: all .2s ease;
}
.fvto-upload-drop:hover { border-color: #e5e7eb; background: #fafafa; }
.fvto-upload-drop.drag-over { border-color: #111; background: #f5f5f5; }
.fvto-upload-drop.has-file { border-color: #e5e7eb; background: #f8fafc; }
.fvto-upload-icon { width: 24px; height: 24px; opacity: .7; color: #6b7280; }
.fvto-upload-icon svg { width: 24px; height: 24px; display: block; }
.fvto-upload-text { font-size: 13px; color: #6b7280; }
.fvto-file-name { display: none !important; }

/* Thumbnail anteprima */
.fvto-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* Messaggi di feedback */
.fvto-message {
    position: static;
    margin: 8px 0;
    padding: 12px 14px;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.fvto-success {
    background: #28a745;
}

.fvto-error {
    background: #dc3545;
}

.fvto-warning {
    background: #ffc107;
    color: #333;
}

/* Evidenziazione interfaccia */
.fvto-highlight {
    animation: highlight 2s ease-in-out;
}

@keyframes highlight {
    0%, 100% { 
        box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    }
    50% { 
        box-shadow: 0 0 20px rgba(0,124,186,0.5); 
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .fvto-container {
        margin: 10px;
        padding: 15px;
    }
    
    .fvto-preview-section img {
        max-width: 100%;
        max-height: 300px;
    }
    
    #fvto-open-tryon {
        width: 100%;
        margin: 10px 0;
    }
    
    .fvto-product-details {
        flex-direction: column;
        text-align: center;
    }
    
    .fvto-result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .fvto-message { left: auto; right: auto; top: auto; }
    
    /* Risultati ricerca su mobile: torna a colonna singola */
    #fvto-product-results {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    #fvto-product-results .fvto-product-item {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        padding: 8px;
    }
    
    #fvto-product-results .fvto-product-item img {
        max-width: 40px;
        max-height: 40px;
        width: auto;
        height: auto;
    }
    
    #fvto-product-results .fvto-product-item span {
        font-size: 12px;
        white-space: normal;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .fvto-container {
        padding: 10px;
    }
    
    .fvto-upload-section,
    .fvto-product-info {
        padding: 10px;
    }
    
    .button {
        width: 100%;
        margin: 5px 0;
    }
}

/* Schermi grandi: più colonne per i risultati */
@media (min-width: 1200px) {
    #fvto-product-results {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }
    
    #fvto-product-results .fvto-product-item img {
        max-width: 60px;
        max-height: 60px;
        width: auto;
        height: auto;
    }
    
    #fvto-product-results .fvto-product-item span {
        font-size: 13px;
    }
}
