/* Farm3 Products CSS - Stili integrati con Tailwind equivalents */

.farm3-products-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f8f8;
    color: #333;
}

/* Utilità Flexbox */
.farm3-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 80rem;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1rem;
}

@media (min-width: 768px) {
    .farm3-main {
        flex-direction: row;
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .farm3-main {
        padding: 2rem 2rem;
    }
}

/* Sidebar Desktop */
.farm3-sidebar {
    display: none;
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-right: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .farm3-sidebar {
        display: block;
        width: 20%;
        padding: 1.5rem;
        margin-right: 2rem;
        margin-bottom: 0;
    }
}

@media (min-width: 1024px) {
    .farm3-sidebar {
        width: 16.666667%;
    }
}

/* Elementi Sidebar */
.farm3-sidebar {
    text-align: left; /* Forza allineamento a sinistra */
}

.farm3-sidebar h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1f2937;
    text-align: left; /* Esplicito allineamento a sinistra */
}

.farm3-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left; /* Assicura che la lista sia allineata a sinistra */
}

.farm3-sidebar li {
    margin-bottom: 0.75rem;
    text-align: left; /* Forza ogni elemento lista a sinistra */
}

.farm3-sidebar-item {
    display: flex; /* Cambiato da block a flex per icone */
    align-items: center; /* Allinea icona e testo verticalmente */
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: left; /* Esplicito allineamento a sinistra */
    justify-content: flex-start; /* Assicura che il contenuto inizi da sinistra */
}

/* Stile per le icone nelle categorie */
.farm3-sidebar-item .category-icon {
    margin-right: 8px; /* Spazio tra icona e testo */
    font-size: 16px;
    width: 20px; /* Larghezza fissa per allineamento uniforme */
    text-align: center; /* Centra l'icona nella sua area */
    flex-shrink: 0; /* Impedisce il restringimento dell'icona */
    color: #6b7280; /* Colore grigio di base */
}

.farm3-sidebar-item.active .category-icon {
    color: white; /* Colore bianco quando attivo, come il testo */
}

.farm3-sidebar-item:hover:not(.active) {
    background-color: #e0e0e0;
    color: #111827;
    transform: translateX(5px);
}

.farm3-sidebar-item:hover:not(.active) .category-icon {
    color: #374151; /* Colore più scuro al hover */
    transform: scale(1.1);
}

.farm3-sidebar-item.active {
    background-color: #2B6CB0; /* Sfondo blu come le tabs mobile */
    color: white; /* Testo bianco */
    font-weight: 600;
    border-left: 4px solid #1E3A8A; /* Bordo blu più scuro per contrasto */
    text-align: left; /* Mantiene allineamento a sinistra anche quando attivo */
}

/* Tabs Mobile */
.farm3-mobile-tabs {
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .farm3-mobile-tabs {
        display: none;
    }
}

.farm3-hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.farm3-hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#farm3-mobile-topic-tabs {
    display: inline-flex;
    gap: 0.75rem;
}

.farm3-topic-tab {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #e5e7eb;
    color: #374151;
    transition: colors 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex; /* Cambiato per supportare icone */
    align-items: center;
    gap: 6px; /* Spazio tra icona e testo */
}

.farm3-topic-tab .category-icon {
    font-size: 14px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.farm3-topic-tab:hover:not(.active) {
    background-color: #c0c0c0;
}

.farm3-topic-tab:hover:not(.active) .category-icon {
    color: #374151;
    transform: scale(1.1);
}

.farm3-topic-tab.active {
    background-color: #2B6CB0;
    color: white;
    font-weight: 600;
}

.farm3-topic-tab.active .category-icon {
    color: white;
}

/* Area Prodotti */
#farm3-product-content {
    flex: 1;
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    width: 100%;
}

@media (min-width: 768px) {
    #farm3-product-content {
        padding: 2rem;
    }
}

#farm3-product-content h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

/* Griglia Prodotti */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Card Prodotto */
.farm3-product-card {
    background-color: #f9fafb;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.farm3-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.farm3-product-card img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
}

.farm3-product-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.farm3-product-card p {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Prezzo */
.farm3-price {
    margin-bottom: 1rem;
    font-weight: 600;
}

.farm3-price.on-sale del {
    color: #6b7280;
    margin-right: 0.5rem;
}

.farm3-price.on-sale ins {
    color: #dc2626;
    text-decoration: none;
    font-weight: bold;
}

/* Pulsante */
.farm3-product-card a {
    margin-top: 1rem;
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #2B6CB0;
    color: white;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
}

.farm3-product-card a:hover {
    background-color: #1E3A8A;
}

.farm3-product-card a:focus {
    outline: 2px solid #2B6CB0;
    outline-offset: 2px;
}

/* Loading */
.farm3-loading {
    text-align: center;
    padding: 2rem;
}

.farm3-loading.hidden {
    display: none;
}

.farm3-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #2B6CB0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: farm3-spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Messaggio nessun prodotto */
.farm3-no-products {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Errore configurazione */
.farm3-products-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
}

.farm3-products-error p {
    color: #dc2626;
    margin: 0;
}

/* Responsive utilities */
@media (min-width: 640px) {
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .md\:flex-row {
        flex-direction: row;
    }
    
    .md\:block {
        display: block;
    }
    
    .md\:hidden {
        display: none;
    }
    
    .md\:w-1\/5 {
        width: 20%;
    }
    
    .md\:px-6 {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .md\:p-6 {
        padding: 1.5rem;
    }
    
    .md\:p-8 {
        padding: 2rem;
    }
    
    .md\:mr-8 {
        margin-right: 2rem;
    }
    
    .md\:mb-0 {
        margin-bottom: 0;
    }
}

@media (min-width: 1024px) {
    .lg\:w-1\/6 {
        width: 16.666667%;
    }
    
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    
    .lg\:px-8 {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Accessibilità */
.farm3-sidebar-item:focus,
.farm3-topic-tab:focus,
.farm3-product-card a:focus {
    outline: 2px solid #2B6CB0;
    outline-offset: 2px;
}

/* Modal/Popup per card singola */
.farm3-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.farm3-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: farm3-fadeIn 0.3s ease;
}

.farm3-modal-content {
    background-color: white;
    border-radius: 1rem;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;
    width: 600px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: farm3-slideUp 0.3s ease;
}

.farm3-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #EBF8FF;
    color: #1f2937;
}

.farm3-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937 !important; /* Testo nero su sfondo blu chiaro */
    display: flex;
    align-items: center;
    text-align: left !important;
}

.farm3-modal-header h3 i {
    margin-right: 8px;
    color: #2B6CB0 !important; /* Icona blu su sfondo blu chiaro */
    font-size: 1.1rem;
    display: inline-block;
}

.farm3-modal-header h3 span {
    color: #1f2937 !important; /* Testo nero */
    display: inline-block;
}

/* Override aggressivo per qualsiasi interferenza */
.farm3-modal-header h3,
.farm3-modal-header h3 *,
.farm3-modal-header h3 span {
    color: #1f2937 !important; /* Testo nero */
    text-align: left !important;
}

.farm3-modal-header h3 i {
    color: #2B6CB0 !important; /* Icona blu */
}

/* Forza X rossa */
.farm3-modal-close,
.farm3-modal-close * {
    color: #dc2626 !important; /* X sempre rossa */
}

.farm3-modal-close:hover,
.farm3-modal-close:hover * {
    color: #b91c1c !important; /* X rosso scuro al hover */
}

/* Forza il background dell'header */
.farm3-modal-header {
    background: #EBF8FF !important;
    color: #1f2937 !important;
}

.farm3-modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #dc2626 !important; /* Rosso per l'icona */
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.farm3-modal-close:hover {
    background-color: rgba(220, 38, 38, 0.1); /* Sfondo rosso chiaro al hover */
    color: #b91c1c !important; /* Rosso più scuro al hover */
    transform: scale(1.1); /* Leggermente più grande al hover */
}

/* Stile specifico per l'icona fa-times-circle */
.farm3-modal-close i.fa-times-circle {
    color: #dc2626 !important; /* Cerchio rosso con X bianca */
    font-size: 1.75rem;
}

.farm3-modal-close:hover i.fa-times-circle {
    color: #b91c1c !important; /* Cerchio rosso più scuro al hover */
    transform: rotate(90deg); /* Rotazione leggera per effetto dinamico */
}

.farm3-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.farm3-modal-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
}

.farm3-modal-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2B6CB0;
    margin: 1rem 0;
}

.farm3-modal-price.on-sale del {
    color: #6b7280;
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

.farm3-modal-price.on-sale ins {
    color: #dc2626;
    text-decoration: none;
    font-weight: bold;
}

.farm3-modal-description {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.farm3-modal-full-description {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Stili per contenuto HTML/CSS nella descrizione completa */
.farm3-modal-full-description * {
    max-width: 100% !important;
}

.farm3-modal-full-description img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.farm3-modal-full-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.farm3-modal-full-description table th,
.farm3-modal-full-description table td {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.farm3-modal-full-description table th {
    background-color: #f9fafb;
    font-weight: 600;
}

.farm3-modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    align-items: center; /* Allinea i pulsanti verticalmente */
}

.farm3-modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.farm3-modal-btn-primary {
    background-color: #2B6CB0;
    color: white;
    flex: 1;
    min-width: 180px; /* Aumentato un po' per "Richiedi Preventivo" */
}

.farm3-modal-btn-primary:hover {
    background-color: #1E3A8A;
    transform: translateY(-1px);
}

.farm3-modal-btn-whatsapp {
    background-color: #25d366;
    color: white;
    width: 45px; /* Leggermente più piccolo */
    height: 45px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.1rem; /* Icona un po' più piccola */
    flex-shrink: 0;
    min-width: auto; /* Override del min-width globale */
}

.farm3-modal-btn-whatsapp:hover {
    background-color: #1ea952;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

/* Animazioni */
@keyframes farm3-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes farm3-slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive modal */
@media (max-width: 768px) {
    .farm3-modal-content {
        width: 95vw;
        max-height: 95vh;
    }
    
    .farm3-modal-header,
    .farm3-modal-body {
        padding: 1rem;
    }
    
    .farm3-modal-image {
        height: 200px;
    }
    
    .farm3-modal-actions {
        flex-direction: row; /* Mantiene layout orizzontale anche su mobile */
        gap: 0.75rem;
        justify-content: center;
        align-items: center;
    }
    
    .farm3-modal-btn-primary {
        flex: 1;
        min-width: 140px; /* Ridotto per mobile */
    }
    
    .farm3-modal-btn-whatsapp {
        width: 40px; /* Ancora più piccolo su mobile */
        height: 40px;
        font-size: 1rem;
        flex-shrink: 0;
    }
}

/* Sezioni Modal Strutturate */
.farm3-modal-section {
    margin: 25px 0;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #eee;
}

.farm3-modal-section h4 {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.farm3-modal-section h4 i {
    margin-right: 10px;
    color: #2B6CB0;
}

/* Griglia Specifiche */
.farm3-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.farm3-spec-item {
    display: flex;
    align-items: center;
    font-size: 0.95em;
    color: #555;
}

.farm3-spec-item i {
    margin-right: 8px;
    color: #2B6CB0;
    width: 16px;
}

/* Lista Varianti */
.farm3-variants-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.farm3-variant-tag {
    background-color: #2B6CB0;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Responsive per sezioni modal */
@media (max-width: 768px) {
    .farm3-specs-grid {
        grid-template-columns: 1fr;
    }
    
    .farm3-modal-section {
        margin: 15px 0;
        padding: 12px;
    }
    
    .farm3-modal-section h4 {
        font-size: 1.1em;
    }
}

/* Animazioni */
.transition-all {
    transition: all 0.2s ease;
}

.transition-colors {
    transition: color 0.2s ease, background-color 0.2s ease;
}

.duration-200 {
    transition-duration: 0.2s;
}

.duration-300 {
    transition-duration: 0.3s;
}

/* ========== OVERRIDE COLORI ARANCIONI ========== */
/* Forza tutti i possibili elementi arancioni ad essere blu */

/* Pulsanti e bottoni - forza blu su qualsiasi classe arancione */
.farm3-product-card button,
.farm3-product-card a,
.farm3-modal-btn,
.farm3-modal-btn-primary,
button[class*="orange"],
a[class*="orange"],
.bg-orange-500,
.bg-orange-600,
.bg-orange-700,
.hover\:bg-orange-500:hover,
.hover\:bg-orange-600:hover,
.hover\:bg-orange-700:hover {
    background-color: #2B6CB0 !important;
    color: white !important;
    border-color: #2B6CB0 !important;
}

/* Hover sui pulsanti */
.farm3-product-card button:hover,
.farm3-product-card a:hover,
.farm3-modal-btn:hover,
.farm3-modal-btn-primary:hover {
    background-color: #1E3A8A !important;
    color: white !important;
}

/* Prezzi - forza il prezzo normale ad essere blu invece che arancione */
.farm3-price,
.farm3-modal-price,
.price,
.woocommerce-Price-amount,
.text-orange-500,
.text-orange-600,
.text-orange-700 {
    color: #2B6CB0 !important;
}

/* Override per elementi con colore arancione inline */
[style*="color: orange"],
[style*="color: #FFA500"],
[style*="color: #ff6600"],
[style*="color: #f97316"],
[style*="background-color: orange"],
[style*="background-color: #FFA500"],
[style*="background-color: #ff6600"],
[style*="background-color: #f97316"] {
    color: #2B6CB0 !important;
    background-color: #2B6CB0 !important;
}

/* Linguette/tabs colorate - forza blu */
.farm3-topic-tab.active,
.farm3-sidebar-item.active {
    background-color: #2B6CB0 !important;
    color: white !important;
    border-color: #2B6CB0 !important;
}

/* Border colorati */
.border-orange-500,
.border-orange-600,
.border-orange-700 {
    border-color: #2B6CB0 !important;
}

/* Focus ring */
.focus\:ring-orange-500:focus,
.focus\:ring-orange-600:focus {
    --tw-ring-color: #2B6CB0 !important;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.5) !important;
}

/* Altri possibili elementi arancioni */
.text-orange-500,
.text-orange-600,
.text-orange-700 {
    color: #2B6CB0 !important;
}

/* Badge e tag arancioni */
.badge-orange,
.tag-orange,
[class*="orange-badge"],
[class*="orange-tag"] {
    background-color: #2B6CB0 !important;
    color: white !important;
}

/* Specifico per il pulsante "Richiedi Preventivo" generato dinamicamente */
.farm3-modal-actions a[href*="contatti"],
.farm3-modal-actions a[href*="contact"],
.farm3-modal-actions a[href*="preventivo"],
a[href*="prodotto="] {
    background-color: #2B6CB0 !important;
    color: white !important;
    border: 1px solid #2B6CB0 !important;
}

.farm3-modal-actions a[href*="contatti"]:hover,
.farm3-modal-actions a[href*="contact"]:hover,
.farm3-modal-actions a[href*="preventivo"]:hover,
a[href*="prodotto="]:hover {
    background-color: #1E3A8A !important;
    color: white !important;
    border-color: #1E3A8A !important;
}

/* ULTRA-SPECIFICO: Override per tutti i possibili conflitti di colore */
.farm3-products-container .farm3-product-card button,
.farm3-products-container .farm3-modal-btn-primary,
.farm3-products-container [class*="bg-orange"],
.farm3-products-container .farm3-modal-actions a {
    background-color: #2B6CB0 !important;
    background: #2B6CB0 !important;
    color: white !important;
}

.farm3-products-container .farm3-product-card button:hover,
.farm3-products-container .farm3-modal-btn-primary:hover,
.farm3-products-container [class*="bg-orange"]:hover,
.farm3-products-container .farm3-modal-actions a:hover {
    background-color: #1E3A8A !important;
    background: #1E3A8A !important;
    color: white !important;
}

/* Override per prezzi che potrebbero essere arancioni */
.farm3-products-container .farm3-price,
.farm3-products-container .farm3-modal-price,
.farm3-products-container [class*="text-orange"] {
    color: #2B6CB0 !important;
}

/* Override per linguette attive */
.farm3-products-container .farm3-topic-tab.active,
.farm3-products-container .farm3-sidebar-item.active {
    background-color: #2B6CB0 !important;
    background: #2B6CB0 !important;
    color: white !important;
    border-left-color: #1E3A8A !important;
}

/* Icone bianche quando attive */
.farm3-products-container .farm3-topic-tab.active .category-icon,
.farm3-products-container .farm3-sidebar-item.active .category-icon {
    color: white !important;
}

/* ========== FINE OVERRIDE COLORI ARANCIONI ==========*/

/* ========== RESET VECCHI STILI GALLERIA JS ========== */
/* Nasconde tutti gli elementi della vecchia implementazione JS */
.farm3-gallery-container,
.farm3-image-display,
.farm3-external-controls,
.farm3-dots-external,
.farm3-dot-external,
#farm3-current-img {
    /* Stili mantenuti per retrocompatibilità ma non utilizzati in CSS pura */
}
/* Forza TUTTO il contenuto della sidebar a sinistra */
.farm3-sidebar,
.farm3-sidebar *,
.farm3-sidebar h2,
.farm3-sidebar .farm3-sidebar-title,
.farm3-sidebar ul,
.farm3-sidebar .farm3-sidebar-list,
.farm3-sidebar li,
.farm3-sidebar a,
.farm3-sidebar .farm3-sidebar-item,
.farm3-sidebar span {
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
}

/* Override per tutte le possibili classi Tailwind */
.farm3-sidebar .text-center,
.farm3-sidebar .text-right,
.farm3-sidebar .justify-center,
.farm3-sidebar .justify-end,
.farm3-sidebar .items-center,
.farm3-sidebar .items-end {
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
}

/* Forza il contenitore sidebar */
.farm3-sidebar {
    display: block !important;
    text-align: left !important;
}

/* Forza gli elementi della lista */
.farm3-sidebar ul {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
}

.farm3-sidebar li {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    list-style: none !important;
    margin: 0 0 0.75rem 0 !important;
    padding: 0 !important;
}

/* Forza i link sidebar */
.farm3-sidebar-item {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.5rem 0.75rem !important;
}

/* Forza il testo dei link */
.farm3-sidebar-item,
.farm3-sidebar-item * {
    text-align: left !important;
}

/* Eccezioni per elementi che devono rimanere centrati */
.farm3-loading {
    text-align: center !important; /* Mantiene il loading centrato */
}

.farm3-no-products {
    text-align: center !important; /* Mantiene i messaggi centrati */
}

/* Override per qualsiasi classe esterna che potrebbe interferire */
.farm3-sidebar .space-y-3 > * {
    text-align: left !important;
}

/* Override per possibili interferenze di Tailwind o altri framework */
.farm3-sidebar .text-center {
    text-align: left !important;
}

.farm3-sidebar .justify-center {
    justify-content: flex-start !important;
}

.farm3-sidebar .items-center {
    align-items: flex-start !important;
}

/* Responsive: mantieni allineamento su tutti i device */
@media (min-width: 768px) {
    .farm3-sidebar {
        text-align: left;
    }
    
    .farm3-sidebar-item {
        justify-content: flex-start;
        text-align: left;
    }
}

@media (min-width: 1024px) {
    .farm3-sidebar {
        text-align: left;
    }
}

/* ========== GALLERIA CSS PURA - OPZIONE B - ZERO JAVASCRIPT ========== */

/* Container principale galleria CSS */
.farm3-css-gallery {
    margin-bottom: 1rem;
    position: relative;
}

/* Nasconde tutti i radio button */
.farm3-gallery-radio {
    display: none;
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

/* Nascondi tutte le immagini di default */
.farm3-gallery-img {
    display: none;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 15px;
    transition: opacity 0.3s ease;
}

/* Mostra l'immagine quando il radio corrispondente è checked */
.farm3-gallery-radio:checked + .farm3-gallery-img {
    display: block;
}

/* Container per i controlli (pallini) */
.farm3-css-controls {
    text-align: center;
    padding: 10px 0;
}

/* Container per i pallini */
.farm3-css-dots {
    display: inline-flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

/* Stile base dei pallini (label) */
.farm3-css-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-block;
    position: relative;
}

/* Hover sui pallini */
.farm3-css-dot:hover {
    transform: scale(1.3);
    background: #2B6CB0;
}

/* Focus per accessibilità */
.farm3-css-dot:focus {
    outline: 2px solid #2B6CB0;
    outline-offset: 2px;
}

/* Pallino attivo quando radio è checked */
.farm3-gallery-radio:checked ~ .farm3-css-controls .farm3-css-dot[for] {
    background: #ccc; /* Reset di base */
}

/* Pallino specifico attivo tramite nth-child */
.farm3-gallery-radio:nth-of-type(1):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(1),
.farm3-gallery-radio:nth-of-type(2):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(2),
.farm3-gallery-radio:nth-of-type(3):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(3),
.farm3-gallery-radio:nth-of-type(4):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(4),
.farm3-gallery-radio:nth-of-type(5):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(5),
.farm3-gallery-radio:nth-of-type(6):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(6),
.farm3-gallery-radio:nth-of-type(7):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(7),
.farm3-gallery-radio:nth-of-type(8):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(8) {
    background: #2B6CB0 !important;
}

/* Effetto aureola per feedback visivo */
.farm3-css-dot::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    opacity: 0;
    background: rgba(43, 108, 176, 0.2);
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.farm3-css-dot:hover::after {
    opacity: 1;
}

/* Immagine singola standard (fallback) */
.farm3-modal-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    display: block;
}

/* Placeholder quando nessuna immagine */
.farm3-no-image {
    height: 250px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Responsive per mobile */
@media (max-width: 768px) {
    .farm3-gallery-img,
    .farm3-modal-image {
        max-height: 300px;
        object-fit: contain;
    }
    
    .farm3-css-controls {
        padding: 8px 0;
    }
    
    .farm3-css-dots {
        gap: 10px;
    }
    
    .farm3-css-dot {
        width: 14px;
        height: 14px;
    }
    
    .farm3-no-image {
        height: 200px;
    }
}

/* Animazione smooth per cambio immagine */
.farm3-gallery-img {
    animation: farm3-fadeIn 0.3s ease-in-out;
}

@keyframes farm3-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Accessibilità migliorata */
.farm3-css-dot:focus-visible {
    outline: 3px solid #2B6CB0;
    outline-offset: 3px;
}

/* Supporto per temi scuri */
@media (prefers-color-scheme: dark) {
    .farm3-css-dot {
        background: #6b7280;
    }
    
    .farm3-css-dot:hover,
    .farm3-gallery-radio:nth-of-type(1):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(1),
    .farm3-gallery-radio:nth-of-type(2):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(2),
    .farm3-gallery-radio:nth-of-type(3):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(3),
    .farm3-gallery-radio:nth-of-type(4):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(4),
    .farm3-gallery-radio:nth-of-type(5):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(5),
    .farm3-gallery-radio:nth-of-type(6):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(6),
    .farm3-gallery-radio:nth-of-type(7):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(7),
    .farm3-gallery-radio:nth-of-type(8):checked ~ .farm3-css-controls .farm3-css-dot:nth-child(8) {
        background: #60a5fa !important;
    }
}
