/* ===== SIMULATOR CONFIGURATOR STYLES - VERSIONE OTTIMIZZATA E CONSOLIDATA ===== */

/* ========================================
   1. VARIABILI CSS
   ======================================== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --dark2-gray: #2f353b;
    --border-radius: 10px;
    --box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* ========================================
   2. RESET E BASE
   ======================================== */
.simulator-configurator * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.simulator-configurator {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* ========================================
   3. LAYOUT PRINCIPALE
   ======================================== */
.configurator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.6s ease-out;
}

.configurator-header {
    text-align: center;
    margin-bottom: 0;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.configurator-header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2.2rem;
    font-weight: 600;
}

.configurator-header h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.8rem;
    font-weight: 500;
}

.configurator-header p {
    color: var(--dark-gray);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   4. AREA STICKY E SCORREVOLE
   ======================================== */
.configurator-fixed-area {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: #f8f8f8;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: top center;
}

.configurator-columns {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    padding: 0 20px;
}

.configurator-scroll-area {
    display: flex;
    gap: 30px;
    padding: 30px 20px 50px;
}

.scroll-column-left,
.scroll-column-right {
    flex: 1;
    min-width: 0;
}

.product-preview {
    flex: 2;
    max-width: 66%;
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--box-shadow);
    min-width: 0;
}

.configurator-content {
    flex: 1;
    max-width: 30%;
    min-width: 250px;
}

/* ========================================
   5. BRAND LOGO GRID E ACCORDION
   ======================================== */
.brand-logo-grid {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.brand-logo-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.3s ease, filter 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(180deg, #1b1b1f, #121216);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
}

.brand-logo-btn img {
    max-height: 26px;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(255,48,79,.20));
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.brand-logo-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255,48,79,.5);
    box-shadow: 0 8px 20px rgba(255,48,79,.12);
}

.brand-logo-btn:hover img {
    opacity: 1;
    transform: scale(1.1);
}

.brand-logo-btn.active {
    border-color: rgba(255,48,79,.85);
    box-shadow: 0 0 0 2px rgba(255,48,79,.25), 0 10px 24px rgba(0,0,0,.5);
}

.brand-logo-btn.active img {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(231,76,60,0.6));
    transform: scale(1.1);
}

/* Accordion Styling */
.brand-accordion {
    border: none;
    border-radius: 8px;
    margin: 0;
    overflow: hidden;
}

.brand-accordion .accordion-header {
    display: none;
}

.brand-accordion .accordion-content {
    display: none;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    box-shadow: none;
}

.brand-accordion.open .accordion-content {
    display: block;
}

.brand-accordion-wrap,
.brand-accordion-wrap .brand-accordion {
    margin: 0;
    padding: 0;
    border: 0;
}

.brand-accordion-wrap hr,
.brand-accordion-wrap .wp-block-separator,
.brand-accordion-wrap .accordion-separator {
    display: none;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.brand-accordion-wrap::before,
.brand-accordion-wrap::after,
.brand-accordion::before,
.brand-accordion::after {
    content: none;
    display: none;
}

.brand-selection-block {
    display: none;
}

.brand-selection-block.active {
    display: block;
}

/* ========================================
   6. LAYOUT ORIZZONTALE BASE/VOLANTE
   ======================================== */
.base-wheel-horizontal-wrapper {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 30px;
    padding-top: 0;
    border-top: none;
}

.wheel-selection-column {
    flex: 0 0 50%;
    max-width: 50%;
    min-width: 0; /* evita overflow */

}

.wheel-base-options,
.steering-wheel-options {
    display: flex;
    flex-wrap: wrap;     /* consente 2+ card per riga */
    gap: 12px;
}

/* ========================================
   7. ANTEPRIMA PRODOTTO
   ======================================== */
.preview-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, var(--light-gray) 0%, var(--medium-gray) 100%);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
}

.preview-base,
.preview-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-base {
    z-index: 1;
}

.preview-layer {
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-layer.active {
    opacity: 1;
}

/* Controlli Layer */
.layer-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.layer-btn {
    padding: 10px 16px;
    background: var(--medium-gray);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dark-gray);
}

.layer-btn:hover,
.layer-btn.active {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
}

.layer-btn.active {
    border-color: var(--primary-color);
}

/* ========================================
   8. CONFIGURAZIONE E OPZIONI
   ======================================== */
.current-selections {
    margin-top: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border-left: none;
}

.current-selections h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 1.3rem;
    font-weight: 600;
}

.config-item {
    padding: 5px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-item strong {
    color: var(--primary-color);
    font-weight: 600;
}

.option-group {
    background: white;
    border-radius: var(--border-radius);
    padding: 0;
    margin-bottom: 0;
    box-shadow: var(--box-shadow);
    border: none;
}

.option-group + .option-group {
    margin-top: 25px;
}

.option-group h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    padding: 15px 10px 5px 10px;
    border-bottom: 1px solid var(--medium-gray);
    font-size: 1.4rem;
    font-weight: 600;
}

/* Accordion toggle per option groups */
.option-group h3.accordion-toggle {
    position: relative;
    padding-right: 20px;
    cursor: pointer;
}

.option-group h3.accordion-toggle::after {
    content: '▼';
    position: absolute;
    right: 0;
    top: 0;
    font-size: 0.8em;
    transition: transform 0.2s;
}

.option-group.open h3.accordion-toggle::after {
    transform: rotate(-180deg);
}

/* ========================================
   9. OPZIONI COLORE
   ======================================== */
.color-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px;
}

.color-item {
    width: 25px;
    height: 25px;
    border: 3px solid var(--medium-gray);
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.color-item:hover {
    transform: scale(1.08);
    border-color: var(--secondary-color);
}

.color-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px white, 0 0 0 3px var(--accent-color);
    transform: scale(1.05);
}

.color-preview {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    transition: var(--transition);
}

/* ========================================
   10. TOGGLE OPTIONS
   ======================================== */
.toggle-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
}

.toggle-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border: 2px solid var(--medium-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--light-gray);
}

.toggle-option:hover {
    border-color: var(--secondary-color);
    transform: translateX(5px);
}

.toggle-option.active {
    border-color: var(--accent-color);
    background: rgba(231, 76, 60, 0.05);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.2);
}

.toggle-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.toggle-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.toggle-price {
    color: var(--success-color);
    font-size: 0.95rem;
    font-weight: 500;
}

.toggle-switch {
    width: 54px;
    height: 28px;
    background: var(--dark-gray);
    border-radius: 14px;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle-option.active .toggle-switch {
    background: var(--accent-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-option.active .toggle-switch::after {
    transform: translateX(26px);
}

/* ========================================
   11. OPTION ITEMS (Generico)
   ======================================== */
.option-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
}

.option-item {
    flex: 1;
    min-width: 120px;
    border: 2px solid var(--medium-gray);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    animation: fadeIn 0.4s ease-out;
}

.option-item:hover {
    border-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.2);
}

.option-item.selected {
    border-color: var(--accent-color);
    background: rgba(231, 76, 60, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.2);
}

.option-item img {
    max-width: 100%;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 4px;
}

.option-item div:first-of-type,
.option-item .option-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.option-item .price {
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Stati disabilitato e loading */
.option-item.disabled,
.toggle-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.option-item.loading {
    position: relative;
    overflow: hidden;
}

.option-item.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

/* ========================================
   12. SEZIONI SPECIFICHE (Monitor, Livery, Fashion)
   ======================================== */
#monitor-options .option-item,
#livery-options .option-item,
#fashion-options .option-item {
    background: #2b2b2b;
    border: 2px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    color: #fff;
}

#monitor-options .option-item .option-name,
#livery-options .option-item .option-name,
#fashion-options .option-item .option-name {
    color: #fff;
    font-weight: 700;
}

#monitor-options .option-item .price,
#livery-options .option-item .price,
#fashion-options .option-item .price {
    color: var(--success-color);
    font-weight: 700;
}

#monitor-options .option-item:hover,
#livery-options .option-item:hover,
#fashion-options .option-item:hover {
    border-color: rgba(52,152,219,0.55);
    box-shadow: 0 0 10px rgba(52,152,219,0.35);
}

#monitor-options .option-item.selected,
#livery-options .option-item.selected,
#fashion-options .option-item.selected {
    background: #262626;
    border-color: rgba(255,255,255,0.35);
    box-shadow: 0 0 12px rgba(255,255,255,0.25);
}

/* ========================================
   13. ACCORDION GEAR/HANDBRAKE/BASEWHEEL
   ======================================== */
#gearshifter-options,
#handbrake-options,
#basewheel-options {
    border: 1px solid var(--medium-gray);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

#gearshifter-options h3,
#handbrake-options h3,
#basewheel-options h3 {
    background: var(--light-gray);
    cursor: pointer;
    padding: 15px;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    position: relative;
}

#gearshifter-options h3::after,
#handbrake-options h3::after,
#basewheel-options h3::after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
}

#gearshifter-options.open h3::after,
#handbrake-options.open h3::after,
#basewheel-options.open h3::after {
    content: '–';
}

#gearshifter-options .option-items,
#handbrake-options .option-items,
#basewheel-options .option-items {
    display: none;
    padding: 15px;
}

#gearshifter-options.open .option-items,
#handbrake-options.open .option-items,
#basewheel-options.open .option-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* ========================================
   14. RIEPILOGO PREZZO
   ======================================== */
.price-summary {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 20px;
    box-shadow: var(--box-shadow);
    border: 2px solid var(--light-gray);
}

.price-summary h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
}

.price-breakdown {
    margin: 20px 0;
    padding: 20px;
    background: var(--light-gray);
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #dee2e6;
}

.price-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.price-item span:first-child {
    color: var(--dark-gray);
    font-weight: 500;
}

.price-item span:last-child {
    color: var(--primary-color);
    font-weight: 600;
}

.total-price {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--accent-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 2px solid var(--medium-gray);
    margin-top: 15px;
}

.total-price span:first-child {
    font-size: 1.3rem;
    color: var(--primary-color);
}

/* ========================================
   15. SERIAL NUMBER
   ======================================== */
.serial-number-input-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--medium-gray);
}

.serial-number-input-container label {
    display: block;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.input-check-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

#serial-number-input {
    flex-grow: 1;
    padding: 10px;
    border: 2px solid var(--medium-gray);
    border-radius: 6px;
    font-size: 1rem;
    max-width: 150px;
}

#serial-check-btn {
    flex-shrink: 0;
    padding: 10px 15px;
    font-weight: 600;
}

#serial-availability-status {
    margin-top: 10px;
    padding: 10px;
    text-align: left;
    font-weight: 600;
}

#serial-availability-status i {
    margin-right: 5px;
}

/* ========================================
   16. NOTIFICHE E UTILITY
   ======================================== */
.configurator-notice {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid var(--secondary-color);
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    text-align: center;
    color: #333;
}

.configurator-notice p {
    color: #333;
    margin: 0;
    font-size: 0.85rem;
}

/* Utility Classes */
.configurator-hidden {
    display: none;
}

.configurator-visible {
    display: block;
}

.configurator-text-center {
    text-align: center;
}

.configurator-text-success {
    color: var(--success-color);
}

.configurator-text-warning {
    color: var(--warning-color);
}

.configurator-text-error {
    color: var(--accent-color);
}

/* ========================================
   17. ANIMAZIONI
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* ========================================
   18. INTEGRAZIONE WOOCOMMERCE
   ======================================== */
.woocommerce .simulator-configurator {
    margin: 20px 0;
}

.woocommerce .configurator-container {
    padding: 0;
}

/* ========================================
   19. MEDIA QUERIES - RESPONSIVE
   ======================================== */

/* Tablet e sotto */
@media (max-width: 1024px) {
    .configurator-fixed-area {
        position: static;
        width: 100%;
        box-shadow: none;
        background: transparent;
        padding-bottom: 0;
        transform: none !important;
        opacity: 1 !important;
    }
    
    .configurator-scroll-area {
        padding-top: 0;
    }
    
    .configurator-columns {
        flex-direction: column;
        padding: 0;
    }

    .product-preview,
    .configurator-content {
        flex: auto;
        max-width: 100%;
        min-width: 100%;
    }
    
    .product-preview {
        background: white;
        border-radius: var(--border-radius);
        padding: 25px;
        box-shadow: var(--box-shadow);
        margin-bottom: 20px;
    }
    
    .configuration-options .option-group:first-child,
    .product-preview,
    .configuration-options {
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .configurator-header {
        position: static;
        margin-bottom: 30px;
    }

    .configurator-content {
        margin-bottom: 30px;
    }
}

@media (max-width: 768px) {
    .configurator-container {
        padding: 15px;
    }
    
    .configurator-header h1 {
        font-size: 1.8rem;
    }
    
    .configurator-header h2 {
        font-size: 1.5rem;
    }
    
    .preview-container {
        height: 300px;
    }
    
    .color-options {
        gap: 10px;
    }
    
    .color-item {
        width: 30px;
        height: 30px;
    }
    
    .option-items {
        gap: 8px;
    }
    
    .option-item,
    #monitor-options .option-item,
    #livery-options .option-item,
    #fashion-options .option-item {
        min-width: calc(50% - 8px);
    }
    
    .layer-controls {
        justify-content: center;
    }
    
    .layer-btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
	
	.base-wheel-horizontal-wrapper {
		flex-direction: row;  /* resta affiancato anche su mobile */
		gap: 6px;
	}
	
	.base-wheel-horizontal-wrapper .option-items .option-item {
      flex: 1 1 100%;
      max-width: 100%;
      min-width: 100%;
  	}

    #gear-shifter-container .brand-selection-block .option-item,
    #hand-brake-container .brand-selection-block .option-item {
        flex: 1 1 calc(50% - 8px);
        max-width: none;
    }
}

@media (max-width: 480px) {
    .configurator-header {
        padding: 15px;
    }
    
    .configurator-header h1 {
        font-size: 1.5rem;
    }
    
    .preview-container {
        height: 250px;
    }
    
	.option-items { gap: 8px; } /* coerenza col breakpoint 768 */
	.option-item,
	#monitor-options .option-item,
	#livery-options .option-item,
	#fashion-options .option-item,
	#gear-shifter-container .brand-selection-block .option-item,
	#hand-brake-container .brand-selection-block .option-item {
		min-width: calc(50% - 8px);  /* sempre almeno 2-up */
	}

    .color-item {
        width: 30px;
        height: 30px;
    }
    
    .toggle-option {
        padding: 15px;
    }
    
    .total-price {
        font-size: 1.4rem;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Seconda parte: da due colonne a una colonna sotto 1024px per gli oggetti divisi in due colonne */
@media (max-width: 1024px) {
  .configurator-scroll-area {
    flex-direction: column;         /* <— riga chiave */
    gap: 20px;                      /* opzionale: gap un filo più stretto su mobile */
  }

  .scroll-column-left,
  .scroll-column-right {
    flex: none;                     /* non farle “spingere” orizzontalmente */
    width: 100%;                    /* occupano tutta la larghezza */
    min-width: 100%;
  }

  /* Ordine esplicito: prima SX, poi DX */
/* 
  .scroll-column-left  { order: 1; }
  .scroll-column-right { order: 2; }
 */
}

/* (Facoltativo) se vuoi forzare l’ordine solo su mobile “stretto” */
@media (max-width: 768px) {
  .configurator-scroll-area { gap: 16px; }

  /* se in futuro userai 'order' anche su desktop, qui lo ribadiamo */
/* 
  .scroll-column-left  { order: 1; }
  .scroll-column-right { order: 2; }
 */
}

/* (Facoltativo) reset esplicito per desktop, utile se altrove imposti order */
/* 
@media (min-width: 1025px) {
  .scroll-column-left,
  .scroll-column-right {
    order: 0;                       /* torna all’ordine naturale DOM su desktop 
  }
 
}
*/

/* ========================================
   20. DARK MODE
   ======================================== */
@media (prefers-color-scheme: dark) {
    .simulator-configurator {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .configurator-fixed-area {
        background: #2d2d2d;
        box-shadow: 0 4px 6px rgba(255, 255, 255, 0.05);
    }
    
    .configurator-header,
    .product-preview,
    .option-group,
    .price-summary,
    .option-item {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #444;
        box-shadow: 0 5px 15px rgba(255,255,255,0.05);
    }

    .configurator-header h1,
    .configurator-header h2,
    .current-selections h3,
    .option-group h3,
    .price-summary h3,
    .config-item strong,
    .toggle-name,
    .option-item div:first-of-type,
    .price-item span:last-child,
    .total-price span:first-child {
        color: #f0f0f0;
    }

    .configurator-header p,
    .price-item span:first-child {
        color: #bbb;
    }
    
    .current-selections,
    .price-breakdown,
    .toggle-option {
        background: #3d3d3d;
        border-color: #444;
    }

    .layer-btn {
        background: #444;
        color: #e0e0e0;
    }

    .layer-btn:hover,
    .layer-btn.active {
        background: var(--secondary-color);
        color: white;
    }

    .toggle-option.active {
        background: rgba(231, 76, 60, 0.15);
        border-color: var(--accent-color);
    }
    
    .preview-container {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .config-item {
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .option-group h3 {
        border-bottom: 1px solid #555;
    }

    .total-price {
        border-top: 2px solid #555;
    }
    
    .configurator-notice p {
        color: #e0e0e0;
    }
}

/* ========================================
   21. STAMPA
   ======================================== */
@media print {
    .simulator-configurator {
        background: white;
        color: black;
    }
    
    .layer-controls,
    .configurator-notice,
    .configurator-fixed-area {
        display: none;
    }
    
    .configurator-scroll-area {
        padding-top: 0;
        flex-direction: column;
        gap: 0;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .scroll-column-left,
    .scroll-column-right {
        flex: auto;
        min-width: 100%;
    }
    
    .option-group {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* === PEDALS & GAMING PC SECTIONS (responsive grid layout) === */
#pedals-container .horizontal-list,
#gamingpc-container .horizontal-list {
    display: flex;
    flex-wrap: wrap;           /* ora le card vanno a capo */
    justify-content: flex-start;
    gap: 20px;
    padding: 15px;
    overflow-x: hidden;        /* niente scroll orizzontale */
    box-sizing: border-box;
}

/* card base */
#pedals-container .option-item,
#gamingpc-container .option-item {
    flex: 1 1 220px;           /* base 220px ma flessibile */
    max-width: 280px;
    min-width: 160px;
    box-sizing: border-box;
}

/* adattamento responsive */
@media (max-width: 900px) {
    #pedals-container .option-item,
    #gamingpc-container .option-item {
        flex: 1 1 45%;        /* due per riga su tablet */
    }
}
@media (max-width: 600px) {
    #pedals-container .option-item,
    #gamingpc-container .option-item {
      flex: 1 1 48%;        /* due per riga su mobile */
      max-width: none;
    }
}


/* ========================================
 21.b  MOBILE/TABLET: preview sticky anche oltre i pulsanti, senza toccare l'HTML 
   ======================================== */

@media (max-width:1024px){
  .configurator-fixed-area,
  .configurator-columns { overflow: visible; } /* già coerente con le tue regole */
}


/* opzionale: su mobile stretto puoi avvicinare un po’ */
@media (max-width: 480px) {
  .product-preview .preview-container,
  .preview-container {
    top: 8px;
  }
}

/* ========================================
   22. PEDALS & GAMING PC – CARD SELECTION STATES
   ======================================== */
#pedals-container .option-item,
#gamingpc-container .option-item {
    cursor: pointer;
    border: 2px solid var(--dark-gray); /* bordo grigio neutro */
    border-radius: 10px;
    transition: border-color 0.2s ease, transform 0.2s ease;
    background: none;
}

/* Hover – leggero movimento, nessun colore extra */
#pedals-container .option-item:hover,
#gamingpc-container .option-item:hover {
    transform: translateY(-2px);
}

/* Stato selezionato – solo bordo blu */
#pedals-container .option-item.selected,
#gamingpc-container .option-item.selected {
    border-color: var(--secondary-color); /* blu o colore principale del tuo tema */
    transform: translateY(-2px);
}

/* Nessun effetto di opacità o filtro */
#pedals-container .option-item.dimmed,
#gamingpc-container .option-item.dimmed {
    opacity: 1;
    filter: none;
}

/* ========================================
   23. Stile per il bottone export PDF
   ======================================== */

#export-pdf-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 15px 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#export-pdf-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#export-pdf-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* STATI PULSANTE */
#export-pdf-btn.pdf-loading {
    animation: pulse 1.5s infinite;
}

#export-pdf-btn.success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

#export-pdf-btn.error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* MESSAGGI TEMPORANEI */
.pdf-success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #c8e6c9;
    font-weight: 500;
}

.pdf-error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #ffcdd2;
    font-weight: 500;
}

.pdf-info-message {
    background: #e3f2fd;
    color: #1565c0;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #bbdefb;
    font-weight: 500;
}

/* MIGLIORAMENTI PREVIEW PER PDF */
#simulator-preview {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.preview-layer.active {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    filter: none !important;
}

/* ELEMENTI DA NASCONDERE NEL PDF */
.configurator-controls,
.add-to-cart-btn,
.brand-logo-grid,
.layer-controls {
    /* Nascondi elementi non necessari */
}

/* MIGLIORA CONTRASTO PER STAMPA */
.option-item.selected {
    border: 3px solid #2196F3 !important;
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px #2196F3 !important;
}

.color-item.selected {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px #2196F3, 0 0 0 3px #fff;
}

.toggle-option.active {
    background: #2196F3 !important;
    color: white !important;
    border-color: #1976D2 !important;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    #export-pdf-btn {
        width: 100%;
        justify-content: center;
        margin: 10px 0;
    }
}

/* Miglioramenti per le immagini nei prodotti nel PDF */
.option-item img {
    border-radius: 4px;
    border: 2px solid #f0f0f0;
    transition: border-color 0.3s ease;
}

.option-item.selected img {
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}