/* =========================================
   CONTAINER PRINCIPALE
   ========================================= */
.mrp-search-container {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px; /* Arrotondato */
    box-shadow: 0 10px 25px rgba(0,0,0,0.08); /* Ombra più morbida */
    
    /* Layout */
    width: 100%;
    max-width: 100%; /* Si adatta al contenitore padre del tema */
    box-sizing: border-box;
    margin: 20px auto;
    
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    position: relative;
}

.mrp-search-header { text-align: center; margin-bottom: 30px; }
.mrp-search-header h2 { margin: 0 0 10px 0; color: #2c3e50; font-size: 24px; }
.mrp-search-header p { margin: 0; color: #7f8c8d; font-size: 15px; }

/* =========================================
   INDICATORE STEP (WIZARD)
   ========================================= */
.mrp-steps-indicator { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    margin-bottom: 30px; 
    margin-top: 15px; 
}

.mrp-step { 
    width: 35px; 
    height: 35px; 
    border-radius: 50%; 
    background: #eee; 
    color: #999; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: bold; 
    font-size: 14px; 
    transition: all 0.3s ease;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mrp-step.active { 
    background: #3498db; 
    color: #fff; 
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.mrp-line { 
    width: 50px; 
    height: 2px; 
    background: #eee; 
    margin: 0 10px; 
}

/* Titoli delle sezioni interne */
.mrp-section-title {
    font-size: 14px;
    text-transform: uppercase;
    color: #95a5a6;
    font-weight: 700;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-top: 25px;
    letter-spacing: 0.5px;
}

/* Rimuove margine top al primo titolo dello step visibile */
#mrp-step-1 .mrp-section-title:first-of-type,
#mrp-step-2 .mrp-section-title:first-of-type,
#mrp-step-3 .mrp-section-title:first-of-type { margin-top: 0; }

/* =========================================
   FORM LAYOUT & INPUTS
   ========================================= */
.mrp-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

/* Classe utility per griglie a 2 colonne */
.mrp-grid-2 { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
}

.mrp-form-group { flex: 1; margin-bottom: 20px; }

.mrp-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #34495e;
    font-size: 14px;
}

.mrp-form-group input, 
.mrp-form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0; /* Bordo più moderno */
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
    height: 50px; /* Altezza fissa uniforme */
}

/* Fix per allineamento testo input date/time */
.mrp-form-group input[type="date"],
.mrp-form-group input[type="time"] {
    line-height: 1.2;
}

.mrp-form-group input:focus,
.mrp-form-group select:focus { 
    border-color: #3498db; 
    outline: none; 
    background-color: #fcfcfc;
}

/* =========================================
   CALCOLATORE VOLUME (Oggetti)
   ========================================= */
.mrp-items-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; 
    margin-bottom: 20px; 
}

.mrp-item-box { 
    border: 1px solid #eee; 
    border-radius: 8px; 
    padding: 15px 10px; 
    text-align: center; 
    cursor: pointer; 
    transition: 0.2s; 
    position: relative; 
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.mrp-item-box:hover { 
    border-color: #3498db; 
    background: #f0f7ff; 
    transform: translateY(-2px);
}

.mrp-item-box:active { transform: scale(0.98); }

.mrp-icon { font-size: 24px; color: #3498db; margin-bottom: 8px; }
.mrp-label { font-size: 13px; color: #555; font-weight: 500; }

/* Badge Quantità */
.mrp-qty { 
    position: absolute; 
    top: -8px; 
    right: -8px; 
    background: #d63638; 
    color: white; 
    border-radius: 50%; 
    width: 24px; 
    height: 24px; 
    font-size: 12px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    opacity: 0; 
    transition: 0.2s;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mrp-item-box.has-qty { border-color: #d63638; background: #fff5f5; }
.mrp-item-box.has-qty .mrp-qty { opacity: 1; }

.mrp-volume-summary { 
    background: #333; 
    color: #fff; 
    padding: 12px 20px; 
    border-radius: 8px; 
    margin-top: 15px; 
    text-align: center; 
    font-weight: bold; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

.mrp-btn-reset { 
    background: rgba(255,255,255,0.2); 
    border: none; 
    color: #fff; 
    padding: 4px 10px; 
    font-size: 11px; 
    cursor: pointer; 
    border-radius: 4px; 
    text-transform: uppercase;
}
.mrp-btn-reset:hover { background: rgba(255,255,255,0.3); }

/* =========================================
   SERVIZI AGGIUNTIVI
   ========================================= */
.mrp-services-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #eee;
}

.mrp-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.mrp-service-item { 
    background: #fff; 
    padding: 10px; 
    border-radius: 6px; 
    border: 1px solid #e0e0e0; 
}

.mrp-checkbox-label { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    font-size: 14px; 
    margin: 0; 
    font-weight: 500;
}
.mrp-checkbox-label input { width: auto; margin: 0; height: auto; }

/* =========================================
   BOTTONI & FOOTER
   ========================================= */
.mrp-form-footer { margin-top: 30px; text-align: center; }

/* Bottone Primario (Avanti/Cerca) */
.mrp-btn-primary {
    background-color: #3498db; 
    color: white;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3);
}

.mrp-btn-primary:hover { 
    background-color: #2980b9; 
    transform: translateY(-2px); 
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.4); 
}

/* Bottone Secondario (Indietro) */
.mrp-btn-secondary { 
    background: #95a5a6; 
    color: white; 
    border: none; 
    padding: 15px; 
    border-radius: 50px; 
    cursor: pointer; 
    font-weight: bold; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    transition: background 0.3s;
}
.mrp-btn-secondary:hover { background: #7f8c8d; }

/* =========================================
   RESPONSIVE FORM
   ========================================= */
@media (max-width: 600px) {
    .mrp-form-row { flex-direction: column; gap: 10px; }
    .mrp-grid-2 { grid-template-columns: 1fr; gap: 0; }
    .mrp-items-grid { grid-template-columns: repeat(2, 1fr); }
    
    .mrp-search-container { padding: 20px; }
    
    .mrp-form-footer {
        display: flex;
        flex-direction: column-reverse; /* Su mobile, tasto "Indietro" sotto */
        gap: 10px;
    }
    .mrp-btn-secondary, .mrp-btn-primary { flex: auto !important; width: 100%; }
}

/* =========================================
   CONTENITORE RISULTATI - FULL WIDTH
   ========================================= */
#mrp-results-container {
    width: 100%;
    max-width: 100%; /* [FIX v1.7] Rimosso limite 800px - ora full width */
    margin: 20px 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================================
   HEADER RISULTATI
   ========================================= */
.mrp-results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 20px 25px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 15px;
}

.mrp-results-header-left h3 {
    margin: 0 0 5px 0;
    font-size: 1.4em;
    color: #333;
}

.mrp-results-subtitle {
    font-size: 0.95em;
    color: #666;
}

.mrp-back-link {
    text-decoration: none;
    color: #666;
    font-size: 0.9em;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 6px;
    transition: all 0.2s;
    background: #f5f5f5;
}

.mrp-back-link:hover {
    background: #eee;
    color: #333;
}

/* =========================================
   LISTA RISULTATI - FULL WIDTH
   ========================================= */
.mrp-results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* =========================================
   SCHEDA VEICOLO - FULL WIDTH
   ========================================= */
.mrp-card-fullwidth {
    width: 100%;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 20px 25px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.mrp-card-fullwidth:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-3px);
    border-color: #d0d0d0;
}

.mrp-card-fullwidth .mrp-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 25px;
    width: 100%;
}

.mrp-card-fullwidth .mrp-card-main {
    flex: 1;
    min-width: 0;
}

.mrp-card-fullwidth .mrp-card-title {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mrp-card-fullwidth .mrp-vehicle-info {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 6px;
}

.mrp-card-fullwidth .mrp-distance-info {
    font-size: 0.9em;
    color: #777;
}

.mrp-card-fullwidth .mrp-card-price-box {
    text-align: right;
    min-width: 160px;
    flex-shrink: 0;
}

.mrp-card-fullwidth .mrp-price-label {
    display: block;
    font-size: 0.75em;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
}

.mrp-card-fullwidth .mrp-price-value {
    display: block;
    font-size: 1.6em;
    font-weight: bold;
}

.mrp-card-fullwidth .mrp-btn-book {
    border: none;
    color: white;
    padding: 12px 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 12px;
    width: 100%;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.mrp-card-fullwidth .mrp-btn-book:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* =========================================
   BADGE PRO/FREE
   ========================================= */
.mrp-badge {
    font-size: 0.7em;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mrp-badge-pro {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mrp-badge-free {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* =========================================
   NO RESULTS & MESSAGGI
   ========================================= */
.mrp-no-results {
    text-align: center;
    background: #fff;
    padding: 50px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.mrp-no-results h3 { 
    color: #333; 
    margin-top: 0;
    font-size: 1.4em;
}

.mrp-no-results p { 
    color: #666; 
    margin-bottom: 25px;
    line-height: 1.5;
}

.mrp-actions-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

/* =========================================
   SEZIONE ALTERNATIVE
   ========================================= */
.mrp-alternatives-section {
    margin-top: 30px;
    width: 100%;
}

.mrp-alternatives-header {
    background: linear-gradient(135deg, #fff8e6 0%, #fff3cd 100%);
    border: 1px solid #f0ad4e;
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1em;
    color: #856404;
    font-weight: 500;
}

.mrp-alternatives-header i {
    font-size: 1.5em;
}

.mrp-alternative-group {
    margin-bottom: 30px;
    width: 100%;
}

.mrp-alternative-label {
    padding: 14px 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 1em;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.mrp-alternative-label i {
    margin-right: 12px;
    font-size: 1.1em;
}

.mrp-alternative-label.same-day {
    background: linear-gradient(135deg, #e6f9ed 0%, #d4edda 100%);
    border-left: 5px solid #25D366;
}

.mrp-alternative-label.same-day i {
    color: #25D366;
}

.mrp-alternative-label.other-day {
    background: linear-gradient(135deg, #fff4e6 0%, #ffe8cc 100%);
    border-left: 5px solid #f0ad4e;
}

.mrp-alternative-label.other-day i {
    color: #f0ad4e;
}

/* =========================================
   BOX CAMBIO RICERCA
   ========================================= */
.mrp-change-search-box {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 10px;
    margin-top: 35px;
    border: 1px dashed #ddd;
}

.mrp-change-search-box p {
    margin: 0 0 18px 0;
    color: #666;
    font-size: 1em;
}

.mrp-change-search-box .mrp-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 14px;
}

/* =========================================
   CARD VECCHIO STILE (Retrocompatibilità)
   ========================================= */
.mrp-btn-mini {
    background: #eee;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.mrp-result-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: transform 0.2s;
}

.mrp-result-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
}

.mrp-card-header { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 10px; 
    font-weight: bold; 
}

.mrp-price { 
    color: #25D366; 
    font-size: 18px; 
}

.mrp-btn-book {
    background: #2271b1; 
    color: white; 
    border: none; 
    padding: 10px; 
    width: 100%; 
    border-radius: 6px; 
    cursor: pointer; 
    margin-top: 10px; 
    font-weight: bold;
}

/* =========================================
   RESPONSIVE RISULTATI
   ========================================= */
@media (max-width: 768px) {
    .mrp-card-fullwidth {
        padding: 18px;
    }
    
    .mrp-card-fullwidth .mrp-card-body {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .mrp-card-fullwidth .mrp-card-price-box {
        width: 100%;
        text-align: left;
        padding-top: 15px;
        border-top: 1px solid #eee;
    }
    
    .mrp-card-fullwidth .mrp-vehicle-info,
    .mrp-card-fullwidth .mrp-distance-info {
        display: block;
        margin-bottom: 5px;
    }
    
    .mrp-results-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px 20px;
    }
    
    .mrp-back-link {
        margin-top: 10px;
        width: 100%;
        text-align: center;
    }
    
    .mrp-alternatives-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .mrp-card-fullwidth {
        padding: 15px;
    }
    
    .mrp-card-fullwidth .mrp-card-title {
        font-size: 1.1em;
    }
    
    .mrp-card-fullwidth .mrp-price-value {
        font-size: 1.4em;
    }
    
    .mrp-results-header-left h3 {
        font-size: 1.2em;
    }
    
    .mrp-no-results {
        padding: 35px 25px;
    }
}

/* =========================================
   IKEA QUANTITY CONTROLS
   ========================================= */

/* Lista prodotti aggiunti */
.mrp-ikea-added-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 12px;
}

.mrp-ikea-added-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.mrp-ikea-added-item-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.mrp-ikea-added-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mrp-ikea-added-item-text strong {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mrp-ikea-item-vol {
    font-size: 12px;
    color: #0058a3;
    font-weight: 500;
}

/* Controlli quantità +/- */
.mrp-ikea-qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.mrp-ikea-qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #fff;
    color: #333;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mrp-ikea-qty-btn:hover {
    background: #f0f0f0;
}

.mrp-ikea-btn-minus:hover {
    background: #ffe0e0;
    color: #c00;
}

.mrp-ikea-btn-plus:hover {
    background: #e0ffe0;
    color: #060;
}

.mrp-ikea-qty-display {
    min-width: 40px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding: 0 4px;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

/* Mobile */
@media (max-width: 480px) {
    .mrp-ikea-added-item {
        flex-wrap: wrap;
    }
    .mrp-ikea-added-item-info {
        flex: 1 1 100%;
        margin-bottom: 8px;
    }
    .mrp-ikea-qty-controls {
        margin-left: auto;
    }
}

/* =========================================
   FIX RESPONSIVE MOBILE - Aggiungi alla fine di mrp-frontend.css
   ========================================= */

/* =========================================
   IKEA SECTION - Base Styles
   ========================================= */
.mrp-ikea-section {
    width: 100%;
    box-sizing: border-box;
}

.mrp-ikea-search-row {
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.mrp-ikea-search-row input[type="text"] {
    flex: 1;
    min-width: 0; /* Importante per flex */
    width: 100%;
}

.mrp-ikea-search-row button {
    flex-shrink: 0;
}

/* IKEA Result Card */
.mrp-ikea-product-card {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.mrp-ikea-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.mrp-ikea-product-info {
    flex: 1;
    min-width: 200px;
}

.mrp-ikea-product-actions {
    flex-shrink: 0;
}

/* =========================================
   CALCOLATORE - Fix Colonne
   ========================================= */
.mrp-calculator-columns {
    display: flex;
    gap: 30px;
    width: 100%;
    box-sizing: border-box;
}

.mrp-calculator-column {
    flex: 1;
    min-width: 0; /* Previene overflow */
    box-sizing: border-box;
}

/* =========================================
   RESPONSIVE FIXES - Mobile
   ========================================= */
@media (max-width: 768px) {
    /* Calcolatore: colonne in stack verticale */
    .mrp-calculator-columns {
        flex-direction: column;
        gap: 20px;
    }
    
    .mrp-calculator-column {
        width: 100%;
    }
    
    /* Griglia oggetti: 2 colonne su tablet */
    .mrp-items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 600px) {
    /* IKEA Search: stack verticale */
    .mrp-ikea-search-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .mrp-ikea-search-row input[type="text"] {
        width: 100%;
    }
    
    .mrp-ikea-search-row button {
        width: 100%;
    }
    
    /* IKEA Product Card: stack verticale */
    .mrp-ikea-product-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mrp-ikea-product-image {
        width: 100%;
        height: 150px;
        margin-bottom: 10px;
    }
    
    .mrp-ikea-product-info {
        min-width: 100%;
    }
    
    .mrp-ikea-product-actions {
        width: 100%;
    }
    
    .mrp-ikea-product-actions button {
        width: 100%;
    }
    
    /* IKEA Added List */
    .mrp-ikea-added-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .mrp-ikea-added-item-info {
        width: 100%;
    }
    
    .mrp-ikea-qty-controls {
        align-self: flex-end;
    }
    
    /* Griglia oggetti: 2 colonne su mobile */
    .mrp-items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .mrp-item-box {
        padding: 12px 8px;
    }
    
    .mrp-icon {
        font-size: 20px;
    }
    
    .mrp-label {
        font-size: 11px;
    }
}

@media (max-width: 400px) {
    /* Schermi molto piccoli: oggetti più compatti */
    .mrp-items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .mrp-item-box {
        padding: 10px 6px;
    }
    
    .mrp-icon {
        font-size: 18px;
        margin-bottom: 5px;
    }
    
    .mrp-label {
        font-size: 10px;
    }
    
    .mrp-qty {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: -5px;
        right: -5px;
    }
}