/* --- VARIABILI GLOBALI --- */
:root {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #0f1111;
    --text-muted: #565959;
    --text-blue: #007185;
    --header-bg: #131921; /* Colore scuro Amazon */
    --header-text: #ffffff;
    --primary: #264bab; /* Il tuo colore brand */
    --amazon-btn: #FFD814;
    --amazon-btn-hover: #F7CA00;
    --success: #007600;
    --border-radius: 20px;
    --border-radius-sm: 8px;
    --border-color: #e7e7e7;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --request: #007600;
    --gradient: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
}

/* --- TEMA DARK --- */
[data-theme="dark"] {
    --bg-body: #0f1111;
    --bg-card: #191e24;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-blue: #4cb2c4;
    --header-bg: #131921; /* Resta uguale */
    --border-color: #2a3439;
    --success: #00a600;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --request: #2a3439;
    --gradient: linear-gradient(135deg, rgb(30, 60, 114) 0%, rgb(42, 82, 152) 100%);
}

/* --- BASE --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-body); color: var(--text-main); transition: background-color 0.3s, color 0.3s; overflow-x: hidden;}
a { text-decoration: none; color: var(--text-blue); }
.text-success { color: var(--success); font-weight: 600; }
.text-blue { color: var(--text-blue); }
.font-bold { font-weight: bold; }
.text-sm { font-size: 0.8rem; }

/* --- HEADER --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-img { height: 25px; object-fit: contain; }

.nav-center { flex-grow: 1; max-width: 600px; margin: 0 2rem; }
.search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px; /* Bordi molto arrotondati */
    padding: 0.5rem 1.2rem;
    position: relative;
    width: 100%;
}
.search-icon {
    color: var(--text-muted);
    margin-right: 10px;
    font-size: 1.1rem;
}
.search-bar input {
    flex-grow: 1;
    border: none;
    outline: none;
    color: #0f1111;
    font-size: 1rem;
    background: transparent;
}

.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow);
    min-width: 200px;
    padding: 0.5rem 0;
}
.dropdown-menu.active { display: block; }
.dropdown-menu a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-size: 0.9rem;
}
.dropdown-menu a:hover { background-color: var(--bg-body); }
.text-danger { color: #ef4444 !important; }

.wishlist-icon-wrapper { position: relative; font-size: 1.5rem; color: #fff; }
.badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50px;
}

/* --- LAYOUT PRINCIPALE --- */
.container { max-width: 1400px; margin: 0 auto; padding: 2rem 2rem; }
.btn-back {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.9rem; cursor: pointer; margin-bottom: 1rem; font-weight: 500;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    box-shadow: var(--shadow);
}

.product-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}
@media (min-width: 1024px) {
    /* Sostituito le % con fr per evitare che il gap faccia uscire il contenuto dallo schermo */
    .product-layout { grid-template-columns: 3.5fr 4fr 2.5fr; } 
}

.quick-related-grid {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Colonna 1: Immagine */
.image-container {
    background-color: #ffffff; /* Sfondo sempre bianco per non far vedere gli stacchi delle foto Amazon */
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px; /* Altezza fissa */
    box-shadow: var(--shadow);
}
.product-main-img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; /* Adatta l'immagine senza tagliarla o sformarla */
}
/* Colonna 2: Dettagli (Senza sfondo) */
.badge-minimo {
    display: inline-block;
    background-color: #cc0c39; /* Rosso amazon offerte */
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
}
.product-title { font-size: 1.5rem; font-weight: 600; line-height: 1.3; margin-bottom: 0.5rem; }
.product-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem;}

.quick-card {
    display: flex;
    flex-direction: column;
    width: 110px;
    cursor: pointer;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-sm);
    padding: 10px;
    border: 1px solid var(--border-color);
}
.quick-img-wrapper {
    background: #fff; /* Risolve il problema del dark mode */
    border-radius: 6px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.quick-img-wrapper img { max-height: 100%; max-width: 100%; object-fit: contain; }
.quick-title { 
    font-size: 0.8rem; 
    font-weight: 500; 
    color: var(--text-main); 
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Mostra fino a 2 righe (cambia in 3 se preferisci) */
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    height: 2.5em;
}
.quick-price { font-size: 0.9rem; font-weight: 800; color: var(--text-main); margin-top: 4px; }

/* Colonna 3: Buy Box */
.buybox-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.price-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.current-price { font-size: 2rem; font-weight: 500; }
.cents { font-size: 1rem; position: relative; top: -0.8em; }
.prime-logo i { margin-right: 4px; }
.delivery-info { font-size: 0.9rem; margin-bottom: 1.5rem; color: var(--text-main); }

.btn { display: block; width: 100%; padding: 0.8rem; border-radius: 50px; text-align: center; font-weight: 600; cursor: pointer; border: none; margin-bottom: 1rem; }
.btn-amazon { background-color: var(--amazon-btn); color: #0f1111; }
.btn-amazon:hover { background-color: var(--amazon-btn-hover); }

.action-icons { display: flex; justify-content: center; gap: 1.5rem; border-top: 1px solid var(--border-color); padding-top: 1rem;}
.icon-btn { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; transition: color 0.2s; }
.icon-btn:hover { color: var(--primary); }

/* --- GRAFICO --- */
.card { background-color: var(--bg-card); border-radius: var(--border-radius); padding: 1.5rem; margin-top: 2rem; box-shadow: var(--shadow); }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;}
.time-filters { display: flex; gap: 0.5rem; }
.time-btn { background: var(--bg-body); border: 1px solid var(--border-color); padding: 0.4rem 1rem; border-radius: 20px; cursor: pointer; color: var(--text-main); }
.time-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.chart-container { width: 100%; height: 200px; position: relative; }
.fake-chart { /*width: 100%; */height: 100%; }
.grid-line { stroke: var(--border-color); stroke-width: 1; stroke-dasharray: 4 4; }

.position-relative { position: relative; }
.prime-badge-top {
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--text-blue);
    font-weight: 800;
    font-size: 1.1rem;
}
.badge-availability {
    display: inline-block;
    background-color: var(--success);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.8rem;
}
.history-info {
    background-color: var(--bg-body);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 1.6;
}
.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--border-color);
}
.btn-outline:hover { background: var(--bg-body); }
.action-icons {
    display: flex;
    justify-content: space-around; /* Distanzia equamente le icone */
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1rem;
}
.icon-btn { font-size: 1.4rem; padding: 10px; }

/* --- LAYOUT GRAFICO E INFO --- */
.chart-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    /*margin-top: 2rem;*/
}
@media (min-width: 1024px) {
    .chart-layout { grid-template-columns: 2fr 1fr; } /* Grafico prende 2/3, Info 1/3 */
}

.chart-axis { fill: var(--text-muted); font-size: 14px; font-weight: 500;}
.settings-list { list-style: none; margin-top: 1.5rem; }
.settings-list li { padding: 1rem 0; border-bottom: 1px solid var(--border-color); color: var(--text-main); display: flex; align-items: center; gap: 10px;}
.settings-list li i { color: var(--primary); font-size: 1.2rem; width: 25px;}

/* --- TABELLA SPECIFICHE --- */
.specs-section { margin-top: 2rem; margin-bottom: 4rem;}
.specs-section h2 { margin-bottom: 1.5rem; }
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem;
    background-color: var(--bg-body);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
}
.spec-item span { color: var(--text-muted); }

/* --- SEZIONE ARTICOLI CORRELATI IN FONDO (SENZA BORDURA BIANCA GLOBALE) --- */
.bottom-related-section {
    margin-top: 2.5rem;
    margin-bottom: 4rem;
    background: transparent;
    padding: 0;
    box-shadow: none;
}
.bottom-related-section h2 {
    margin-bottom: 1.5rem;
}
.bottom-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
}
.bottom-related-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}
.bottom-related-card:hover {
    transform: translateY(-3px);
}
.bottom-img-wrapper {
    background: #ffffff;
    border-radius: var(--border-radius-sm);
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
}
.bottom-img-wrapper img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}
.bottom-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em;
}
.bottom-card-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}
.btn-sm {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 0;
}
@media (max-width: 1023px) {
    /* Riordinamento verticale: Immagine -> Titolo/Badge -> BuyBox -> Correlati */
    .product-layout {
        display: flex;
        flex-direction: column;
    }
    .col-details {
        display: contents; /* Permette di ordinare i figli direttamente nel layout principale */
    }
    .col-image { order: 1; width: 100%; }
    .details-header { order: 2; width: 100%; }
    .col-buybox { order: 3; width: 100%; }
    .quick-related { order: 4; width: 100%; margin-top: 1rem; }
}
/* --- REGOLE MOBILE SPECIFICHE (< 768px) --- */
@media (max-width: 767px) {
    /* 1. Layout Generale & Container */
    .container {
        padding: 1rem; /* Riduce i margini laterali su mobile per sfruttare meglio lo schermo */
    }

    /* 2. Header: nasconde il nome utente e mantiene la barra sotto */
    .user-name {
        display: none;
    }
    .navbar {
        flex-wrap: wrap;
        padding: 0.8rem 1rem;
        gap: 0.8rem;
    }
    .nav-left { order: 1; justify-content: center;}
    .nav-right { order: 2; }
    .nav-center { order: 3; width: 100%; max-width: 100%; margin: 0; }

    /* 3. Fix Layout Grafico (Impedisce lo sbordamento della pagina) */
    .chart-layout {
        width: 100%;
        max-width: 100%;
    }
    .chart-layout > * {
        min-width: 0; /* FONDAMENTALE: impedisce a CSS Grid di espandersi oltre lo schermo */
    }
    .chart-box {
        width: 100%;
        max-width: 100%;
        overflow: hidden; /* Blocca qualsiasi fuoriuscita dalla scheda */
    }
    .chart-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto; /* Lo scroll orizzontale rimane circoscritto al solo grafico */
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    .fake-chart {
        min-width: 520px; /* Mantiene le proporzioni e la leggibilità del grafico */
        height: 220px;
        display: block;
    }

    /* 4. Carousel Forzato per i prodotti correlati */
    .quick-related-grid, 
    .bottom-related-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        padding: 0.5rem 0.2rem 1rem 0.2rem;
        -webkit-overflow-scrolling: touch;
    }

    .quick-related-grid::-webkit-scrollbar,
    .bottom-related-grid::-webkit-scrollbar {
        height: 4px;
    }
    .quick-related-grid::-webkit-scrollbar-thumb,
    .bottom-related-grid::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 10px;
    }

    /* Dimensioni Card Carousel */
    .quick-card {
        flex: 0 0 160px !important;
        scroll-snap-align: start;
    }
    .bottom-related-card {
        flex: 0 0 210px !important;
        scroll-snap-align: start;
    }
}

/* =========================================
   PAGINA ESPLORA / VETRINA
   ========================================= */

/* --- HERO PERSONALIZZATA --- */
.hero-personalized {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%); /* Colore in stile immagine fornita */
    border-radius: var(--border-radius);
    padding: 3rem;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    align-items: center;
    margin-bottom: 3rem;
    color: #0f1111; /* Testo scuro per alto contrasto sul verde chiaro */
    box-shadow: var(--shadow);
}

.hero-text-content {
    padding-right: 1rem;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.hero-brand {
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tema Scuro Override per Hero */
[data-theme="dark"] .hero-personalized {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
}

/* --- SEZIONI PRODOTTI (Sconti, Consigliati, Gettonati) --- */
.explore-section {
    margin-bottom: 4rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.see-more-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-blue);
    transition: color 0.2s;
}
.see-more-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* --- CARD PRODOTTO COMPLETA --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.hero-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.hero-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero-product img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    margin-bottom: 0.8rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); /* Ombra sull'immagine per farla staccare dallo sfondo */
}

.hero-product-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

.hero-product-prices {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-product-prices .price-now {
    font-weight: 800;
    font-size: 1.1rem;
}

.hero-product-prices .price-old {
    font-size: 0.8rem;
    text-decoration: line-through;
    opacity: 0.7;
}

.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-4px);
}

.discount-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background-color: var(--success); /* Rosso sconti */
    color: white;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    z-index: 10;
    opacity: 0.8;
}

.card-img-wrapper {
    background: #ffffff;
    border-radius: var(--border-radius-sm);
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 1rem;
}

.card-img-wrapper img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.card-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: auto; /* Spinge i prezzi verso il basso */
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em;
}

.card-pricing {
    margin-top: 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.price-current {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.price-original {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

/* --- RESPONSIVE MOBILE PAGINA ESPLORA --- */
@media (max-width: 1023px) {
    /* Riduciamo a 2 colonne i prodotti hero su tablet/mobile largo */
    .hero-personalized {
        grid-template-columns: 1fr;
        padding: 2rem;
    }
    .hero-products-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        padding-bottom: 0.8rem;
        margin-top: 1.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .hero-products-grid::-webkit-scrollbar {
        height: 4px;
    }
    
    .hero-products-grid::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2); /* Scura e trasparente per risaltare sullo sfondo verde */
        border-radius: 10px;
    }

    /* Da una larghezza fissa alle card per farle scorrere ed evitare che si comprimano */
    .hero-product {
        flex: 0 0 180px !important; /* Misura ideale per contenere immagine, titolo e i due nuovi pulsanti */
        scroll-snap-align: start;
    }
}

@media (max-width: 767px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    /* Trasformazione griglie in Carosello Scrollabile Orizzontale per Mobile */
    .product-grid{
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        padding-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    /* Stile scrollbar del carosello */
    .product-grid::-webkit-scrollbar{
        height: 4px;
    }
    .product-grid::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 10px;
    }

    /* Dimensioni fisse per le card su mobile (evita schiacciamenti) */
    .product-card {
        flex: 0 0 240px !important;
        scroll-snap-align: start;
    }

}

/* --- AGGIORNAMENTO HERO PRODUCT (Uniformato Desktop/Mobile) --- */
.hero-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(255, 255, 255, 0.45); /* Contenitore bianco trasparente per desktop e mobile */
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.hero-product img {
    width: 100%;
    height: 110px;
    object-fit: contain;
    margin-bottom: 0.8rem;
    background-color: #ffffff; /* Sfondo bianco pieno sotto l'immagine per fondere la foto amazon */
    border-radius: 8px; /* Arrotonda i bordi dell'immagine/sfondo bianco */
    padding: 0.5rem; /* Spazio per non far toccare i bordi all'oggetto */
}

/* Modifica opzionale per i prezzi nella hero per allinearli ai nuovi pulsanti */
.hero-product-prices {
    margin-bottom: auto; /* Spinge i pulsanti verso il basso se i titoli hanno lunghezze diverse */
}

/* --- NUOVI PULSANTI DI AZIONE (Per tutte le card) --- */
.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
}

.mt-auto {
    margin-top: auto; /* Utile per le card classiche per tenere i bottoni incollati in basso */
    margin-top: 10px;
}

.btn-amazon-sm {
    flex-grow: 1; /* Fa occupare al pulsante tutto lo spazio rimanente */
    background-color: var(--amazon-btn);
    color: #0f1111;
    padding: 0.5rem 0.4rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-amazon-sm:hover {
    background-color: var(--amazon-btn-hover);
}

.btn-add-list {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    background-color: var(--bg-body);
    color: var(--text-main);
}

.btn-add-list:hover {
    background-color: var(--primary); /* Si colora con il tuo colore brand al passaggio del mouse */
    color: white;
    border-color: var(--primary);
}

/* --- WISHLIST HERO --- */
/* Cambiamo il gradiente per distinguerlo dalla pagina esplora, usando il tuo colore brand */
.wishlist-hero {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); 
}
[data-theme="dark"] .wishlist-hero {
    background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
}

/* --- SEZIONE AGGIUNGI PRODOTTI --- */
.add-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.method-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow);
}

.method-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.method-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.method-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Adatta la barra di ricerca per l'inserimento URL */
.url-input-bar {
    border: 1px solid var(--border-color);
    width: 100%;
    padding: 0.3rem 0.3rem 0.3rem 1.2rem;
}

.btn-submit-url {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-submit-url:hover {
    background-color: #3730a3; /* Tonalità più scura al passaggio del mouse */
}

.method-card .btn-amazon {
    margin-bottom: 0;
    width: 100%;
}

/* --- BANNER AGGIUNGI IN ALTO --- */
.add-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    padding: 2.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    color: #ffffff;
    box-shadow: var(--shadow);
    gap: 2rem;
}

[data-theme="dark"] .add-banner {
    background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
}

.add-banner-text .hero-title {
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
}

.add-banner-text .hero-subtitle {
    margin-bottom: 0;
    opacity: 0.9;
}

.add-banner-actions {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.4rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-link-action {
    background-color: #ffffff;
    color: var(--primary);
}

.btn-amazon-action {
    background-color: var(--amazon-btn);
    color: #0f1111;
}

.btn-amazon-action:hover {
    background-color: var(--amazon-btn-hover);
}

/* --- WISHLIST HERO & GRIGLIA --- */
.wishlist-hero {
    background: linear-gradient(135deg, #fbc2eb 0%, #a18cd1 100%);
    margin-bottom: 3rem;
}

[data-theme="dark"] .wishlist-hero {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* --- ADATTAMENTO MOBILE (< 768px) --- */
@media (max-width: 767px) {
    .add-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
        gap: 1.2rem;
    }

    .add-banner-text .hero-title {
        font-size: 1.8rem;
    }

    /* Nasconde il sottotitolo nel banner */
    .add-banner-text .hero-subtitle {
        display: none;
    }

    /* Mette i pulsanti uno accanto all'altro */
    .add-banner-actions {
        width: 100%;
        flex-direction: row; 
        gap: 0.5rem; /* Spazio ridotto tra i due pulsanti */
    }

    /* Adatta i pulsanti per fari entrare a metà schermo ciascuno */
    .action-btn {
        flex: 1; /* Si dividono lo spazio equamente al 50% */
        padding: 0.8rem 0.5rem; /* Padding laterale ridotto */
        font-size: 0.8rem; /* Font leggermente più piccolo per evitare che vada a capo */
        white-space: nowrap; /* Forza il testo a rimanere su una sola riga */
    }

    /* Griglia 2 colonne per riga, SENZA scroll orizzontale */
    .wishlist-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem;
        display: grid !important;
        overflow-x: visible !important;
    }

    .wishlist-grid .product-card {
        padding: 0.8rem;
    }

    .wishlist-grid .card-img-wrapper {
        height: 110px;
        padding: 0.5rem;
    }

    .wishlist-grid .card-title {
        font-size: 0.8rem;
        height: 2.5em;
    }

    .wishlist-grid .price-current {
        font-size: 1.1rem;
    }

    .wishlist-grid .price-original {
        font-size: 0.75rem;
    }

    .wishlist-grid .btn-amazon-sm {
        font-size: 0.75rem;
        padding: 0.5rem 0;
    }

    .wishlist-grid .btn-add-list {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* =========================================
   PAGINA COMMUNITY / SOCIAL
   ========================================= */

.social-page {
    margin-top: 2rem;
}

.social-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.feed-filters {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.3rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.filter-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 1.2rem;
    border-radius: 15px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--bg-body);
    color: var(--text-muted);
}

/* Layout a due colonne (Feed 2/3, Sidebar 1/3) */
.social-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* --- I POST NEL FEED --- */
.social-post {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.post-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light, #e0e7ff);
}

.post-author {
    font-weight: 700;
    color: var(--text-main);
}

.post-action {
    color: var(--text-muted);
}

.post-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Prodotto Condiviso (Orizzontale) */
.post-product-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    margin-bottom: 1.2rem;
    transition: transform 0.2s;
}

[data-theme="dark"] .post-product-card {
    background: rgba(255, 255, 255, 0.03);
}

.post-product-card:hover {
    transform: translateY(-2px);
}

.post-product-card .discount-badge {
    top: 10px;
    left: 10px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
}

.post-product-img {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.post-product-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.post-product-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer del Post (Interazioni) */
.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.post-social-actions {
    display: flex;
    gap: 1rem;
}

.btn-interaction {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s;
}

.btn-interaction:hover {
    color: var(--primary);
}

.btn-add-list-text {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add-list-text:hover {
    background: var(--primary);
    color: white;
}

/* --- SIDEBAR WIDGETS --- */
.sidebar-widget {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.bg-primary-light {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: none;
}

.widget-title {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hunter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hunter-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.hunter-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hunter-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.hunter-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.hunter-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.hunter-score {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.hunter-rank {
    font-weight: 800;
    font-size: 1.1rem;
}

.text-warning { color: #f59e0b; }
.w-100 { width: 100%; }
.mt-3 { margin-top: 1rem; }

/* --- VERSIONE MOBILE --- */
@media (max-width: 991px) {
    .social-grid {
        grid-template-columns: 1fr; /* Passa a colonna singola */
        gap: 1.5rem;
    }

    /* Inverte l'ordine su mobile: mette la sidebar (Classifiche) prima del feed */
    .social-sidebar {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .social-feed {
        order: 2; /* Spinge il feed sotto la sidebar */
    }

    .social-sidebar {
        order: 1; /* Porta i widget in alto */
    }

    /* Adattamenti estetici mobile */
    .social-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-product-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .post-product-img {
        width: 100%;
        height: 140px;
    }

    .btn-add-list-text {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* --- BARRA DI RICERCA NEL BANNER --- */
.friend-search-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
}

.friend-search-bar {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 50px;
    padding: 0.3rem 0.3rem 0.3rem 1.2rem;
    display: flex;
    align-items: center;
}

.friend-search-bar input {
    border: none;
    outline: none;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.95rem;
}

.btn-search-action {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* --- TAB NAVIGATION & CONTENUTI --- */
.tab-navigation {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    max-width: 800px;
    justify-content: space-evenly;
}

.badge-tab {
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 50px;
    margin-left: 0.4rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- TAB 1: CARD AZIONI PERSONALIZZATE --- */
.action-card {
    margin-bottom: 2rem;
    padding: 1.5rem;
}

/* Colori Sfondo in base all'Azione */
.action-discount {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); /* Verde per Sconti */
}

.action-wishlist {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%); /* Viola/Indaco per Wishlist */
}

.action-card-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: white;
    margin-bottom: 1.2rem;
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.action-time {
    opacity: 0.8;
    font-size: 0.85rem;
}

/* --- TAB 2: GESTIONE AMICI --- */
.friends-section {
    margin-bottom: 3rem;
}

.badge-count {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Richieste di Amicizia (Griglia) */
.requests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.request-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Lista Amici Confermati */
.friends-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.friend-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.user-info-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar-md {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.user-tag {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Bottoni di Azione */
.request-actions, .friend-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-accept {
    background-color: #10b981;
    color: white;
}

.btn-decline {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-more {
    background: transparent;
    color: var(--text-muted);
}

.btn-more:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.btn-chat {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-chat:hover {
    background-color: var(--primary);
    color: white;
}

/* --- MOBILE SPECIFIC (< 768px) --- */
@media (max-width: 767px) {
    .friend-item {
        padding: 0.8rem 1rem;
    }

    .btn-chat .btn-text {
        display: none; /* Nasconde la scritta "Chat" su mobile, lascia solo l'icona */
    }

    .btn-chat {
        padding: 0.5rem;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        justify-content: center;
    }
}

.user-username {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 1rem;
    display: block;
}

.hero-product-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}


.hero-product-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(255, 255, 255, 0.45); /* Contenitore bianco trasparente per desktop e mobile */
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.hero-product-profile img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    margin-bottom: 0.8rem;
    background-color: #ffffff; /* Sfondo bianco pieno sotto l'immagine per fondere la foto amazon */
    border-radius: 20px; /* Arrotonda i bordi dell'immagine/sfondo bianco */
    padding: 0.1rem; /* Spazio per non far toccare i bordi all'oggetto */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.btn-request {
    flex-grow: 1; /* Fa occupare al pulsante tutto lo spazio rimanente */
    background-color: #ffffff;
    padding: 0.5rem 0.4rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-request:hover {
    background-color: var(--request); /* Si colora con il tuo colore brand al passaggio del mouse */
    color: white;
    border-color: var(--primary);
}


/* --- CENTRAGGIO TAB BAR --- */
.tab-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    margin: 0 auto 2rem auto; /* Centra il blocco nello schermo */
    max-width: 500px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* --- BANNER RICERCA & PULSANTE INVITA --- */
.friend-search-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.friend-search-bar {
    flex: 1;
    max-width: 100%;
}

.btn-invite {
    background-color: var(--amazon-btn);
    color: #0f1111;
    border: none;
    border-radius: 50px;
    padding: 0.75rem 1.4rem;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s, transform 0.2s;
}

.btn-invite:hover {
    background-color: var(--amazon-btn-hover);
    transform: translateY(-2px);
}

/* --- NUOVA GRIGLIA & CARD AMICI DEDICATA --- */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.friend-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.friend-card:hover {
    transform: translateY(-3px);
}

/* Avatar circolare perfetto */
.friend-avatar-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 0.8rem;
    border: 3px solid var(--bg-body);
    background-color: var(--bg-body);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.friend-avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.1rem;
}

.friend-card .user-username {
    margin-bottom: 1rem;
}

.friend-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: auto;
}

.btn-chat-action {
    flex-grow: 1;
    background-color: var(--bg-body);
    color: var(--text-main);
    border: none;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: opacity 0.2s;
}

.btn-chat-action:hover {
    opacity: 0.9;
}

/* Responsiveness Mobile per la ricerca */
@media (max-width: 600px) {
    .friend-search-container {
        flex-direction: column;
    }
    .btn-invite {
        width: 100%;
        justify-content: center;
    }
}

/* --- GRIGLIA AMICI MOBILE (2 PER RIGA) --- */
@media (max-width: 767px) {
    .friends-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .friend-card {
        /* padding: 1rem 0.5rem 0.8rem 0.5rem;*/
    }

    .friend-avatar-wrapper {
        width: 65px;
        height: 65px;
        margin-bottom: 0.5rem;
    }

    .friend-name {
        font-size: 0.88rem;
    }

    .friend-card .user-username {
        font-size: 0.75rem;
        margin-bottom: 0.8rem;
    }

    .btn-chat-action {
        padding: 0.5rem 0.3rem;
        font-size: 0.78rem;
        height: 36px;
    }
}

/* --- APP NAVIGATION (Desktop - Stile Moderno) --- */
.app-navigation {
    display: flex;
    justify-content: center;
    gap: 1rem;
    background-color: #191e24; /* Usa il colore del tuo tema */
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 2rem;
    transition: transform 0.3s ease-in-out, background-color 0.3s ease;
}

.nav-item {
    display: flex;
    align-items: center; /* Su desktop, icona e testo affiancati sono più eleganti */
    gap: 0.6rem;
    color: #f8fafc;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.6rem 4rem;
    border-radius: 50px; /* Effetto "Pillola" al passaggio del mouse */
    opacity: 0.7;
    transition: all 0.2s ease;
}

.nav-item:hover {
    opacity: 1;
    background-color: rgba(128, 128, 128, 0.1); /* Sfondo delicato al passaggio */
}

/* Stato Attivo (Pagina Corrente) */
.nav-item.active {
    opacity: 1;
    color: #f8fafc; /* Il colore principale del tuo brand */
    background-color: rgba(79, 70, 229, 0.1); /* Modifica l'RGB se il tuo --primary è diverso */
}

.nav-item i {
    font-size: 1.1rem;
}


/* --- APP NAVIGATION (Mobile Bottom Bar - Stile App Nativa) --- */
@media (max-width: 768px) {
    .app-navigation {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: var(--bg-card);
        border-bottom: none;
        /* Ombra moderna e supporto per la safe-area degli iPhone */
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08); 
        padding: 0.6rem 0.5rem calc(0.6rem + env(safe-area-inset-bottom));
        justify-content: space-around;
        gap: 0;
        z-index: 1000;
        opacity: 0.97;
    }

    .nav-item {
        flex-direction: column; /* Su mobile, icona sopra e testo sotto */
        gap: 0.2rem;
        padding: 0.5rem;
        font-size: 0.75rem;
        border-radius: 12px;
        background-color: transparent;
        color: var(--text-muted);
    }

    /* Annulla lo sfondo a pillola su mobile per l'hover */
    .nav-item:hover {
        background-color: transparent;
    }

    .nav-item.active {
        background-color: var(--bg-body);
        color: var(--text-main);
    }

    /* Animazione per far "saltare" leggermente l'icona attiva */
    .nav-item.active i {
        transform: translateY(-2px);
        font-size: 1.25rem;
        transition: transform 0.2s ease;
    }

    main.container {
        padding-bottom: 90px; /* Spazio extra per non coprire il footer della pagina */
    }

    /* Nasconde la barra fluidamente verso il basso */
    .app-navigation.hidden-on-scroll {
        transform: translateY(120%); 
    }

    .nav-item {
        position: relative;
        flex: 1;
    }

    /* Crea la riga separatrice tra gli elementi */
    .nav-item:not(:last-child)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        height: 40%; /* Altezza della linea verticale */
        width: 1px;
        background-color: var(--text-main); /* Riga bianca pulita */
        opacity: 0.4; /* Opacità per non farla risultare troppo marcata */
    }
}

/* =========================================
   INTEGRAZIONI COMMUNITY & AMICI (COMMERCE OPTIMIZED)
   ========================================= */

/* Highlight per post con calo prezzo di un amico */
.social-post.highlight-deal {
    border: 2px solid #10b981;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.04) 0%, var(--bg-card) 100%);
}

.badge-friend-drop {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-weight: 700;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.post-deal-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-gift-amazon {
    background-color: #ff9900 !important;
    color: #ffffff !important;
}

.btn-gift-amazon:hover {
    background-color: #e68a00 !important;
}

.friend-stats {
    margin-bottom: 1.2rem;
}

.btn-view-wishlist {
    background-color: var(--primary);
    color: #ffffff;
    width: 100%;
}

.btn-view-wishlist:hover {
    background-color: #3730a3;
}

/* Fix spacing ed allineamenti */
.post-footer {
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 767px) {
    .post-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .post-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn-add-list-text, .btn-gift-amazon, .post-actions .btn-amazon-sm {
        width: 100%;
        justify-content: center;
    }
}

/* ================= FEED CARD (NOVITÀ) ================= */
/* Sostituisci questo blocco nel tuo file CSS */
/* Layout base per Mobile (1 colonna) */
.feed-container {
    max-width: 1300px; /* Spazio sufficiente per 3 card affiancate */
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Layout per Tablet (2 colonne) */
@media (min-width: 640px) {
    .feed-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Layout per Desktop (3 colonne fisse) */
@media (min-width: 1024px) {
    .feed-container {
        grid-template-columns: repeat(3, 1fr); /* Forza esattamente 3 colonne uguali */
    }
}

.feed-card {
    background: var(--gradient);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feed-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.feed-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.feed-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.feed-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.feed-user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.feed-action-text {
    font-size: 0.85rem;
    color: var(--text-main);
    opacity: 0.7;
}
.feed-time {
    font-size: 0.75rem;
    color: var(--text-main);
    opacity: 0.7;
}

/* Prodotto nel Feed */
.feed-product-box {
    display: flex;
    gap: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #f1f5f9;
}

.feed-product-image {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.feed-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.feed-product-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

/* Footer Feed */
.feed-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
}

.feed-cta-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive Feed su Mobile */
@media (max-width: 576px) {
    .feed-product-box {
        flex-direction: column;
    }
    .feed-product-image {
        width: 100%;
        height: 140px;
    }
    .feed-card-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    .feed-cta-actions{
        justify-content: space-between;
    }
}

/* ================= COMMUNITY SECTION STYLES ================= */
.community-section {
    margin-bottom: 2.5rem;
}

.section-header-community {
    margin-bottom: 1.25rem;
}

.section-header-community h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

/* Leaderboard / Classifica */
.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.leaderboard-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    position: relative;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rank-1 { border-color: #f59e0b; background: linear-gradient(180deg, #fffbe3 0%, #ffffff 100%); }
.rank-2 { border-color: #94a3b8; }
.rank-3 { border-color: #d97706; }

.rank-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.8rem;
    font-weight: 800;
}

.leaderboard-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    object-fit: cover;
}

.leaderboard-name {
    font-size: 1rem;
    font-weight: 700;
}

.leaderboard-stat {
    font-size: 0.9rem;
    color: #16a34a;
    margin: 4px 0 2px 0;
}

.leaderboard-substat {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.btn-add-community {
    background-color: var(--primary, #2563eb);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-full {
    width: 100%;
}

.mutual-info {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    display: block;
    margin-top: 4px;
}

.mutual-subtext {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    margin-bottom: 10px;
}

.affinity-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: #e11d48;
    display: block;
    margin-top: 4px;
}

.interest-pills-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* =========================================
   AGGIUNTE PER LA LANDING PAGE
   ========================================= */

/* Allineamento al centro per la Hero Banner */
.landing-hero {
    flex-direction: column;
    text-align: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
}

.landing-hero-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Barra di ricerca grande nella Hero */
.landing-search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.landing-search-bar input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    color: #0f1111;
    padding: 0.5rem;
}

.landing-search-bar .btn-amazon-sm {
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
}

/* Griglia per la sezione "Come Funziona" */
.how-it-works-section {
    margin: 4rem 0;
}

.how-it-works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.step-card:hover {
    transform: translateY(-5px);
}

.step-icon {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.step-card h3 {
    margin-bottom: 1rem;
    color: var(--text-main);
}

/* Barra dei Filtri */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.filter-select {
    padding: 0.6rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    font-weight: 500;
}

.filter-select:hover {
    border-color: var(--primary);
}

/* Nasconde la ricerca dell'header su mobile per non affollare lo schermo */
@media (max-width: 767px) {
    .hidden-mobile {
        display: none;
    }
    .landing-hero {
        padding: 3rem 1.5rem;
    }
    .landing-hero .hero-title {
        font-size: 2rem !important;
    }
}

/* =========================================
   OTTIMIZZAZIONE MOBILE PER LE STEP CARDS
   ========================================= */

@media (max-width: 767px) {

    /* Trasformiamo la card in una griglia a 2 colonne */
    .step-card {
        display: grid;
        grid-template-columns: auto 1fr; /* Colonna 1: Icona | Colonna 2: Testo */
        column-gap: 1.25rem;            /* Spazio tra l'icona e il testo */
        text-align: left;               /* Allineiamo il testo a sinistra */
        padding: 1.5rem;                /* Riduciamo un po' il padding per il mobile */
        align-items: center;            /* Centriamo verticalmente l'icona rispetto al contenuto */
    }

    /* Posizionamento dell'icona a sinistra */
    .step-icon {
        grid-column: 1;                 /* Sta nella prima colonna */
        grid-row: 1 / span 2;           /* Si estende per 2 righe (fianco a titolo e testo) */
        font-size: 2.5rem;              /* Riduciamo leggermente l'icona per il mobile */
        margin-bottom: 0;               /* Togliamo il margine inferiore che usavamo su desktop */
    }

    /* Regoliamo i margini dei testi per compattare la card */
    .step-card h3 {
        margin-bottom: 0.3rem;          /* Piccolo spazio tra titolo e descrizione */
        font-size: 1.1rem;              /* Dimensione del titolo adatta al mobile */
    }

    .step-card p {
        font-size: 0.9rem;              /* Dimensione testo leggibile */
        line-height: 1.4;
    }
}