/* --- 1. RESET & VARIABLES --- */
:root {
    --primary: #0f172a;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    /* Sfondo chiaro per hover */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-blue: #bfdbfe;
    /* Nuovo bordo blu chiaro per i bottoni */

    --radius-lg: 16px;
    --radius-md: 10px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --font-family: 'Inter', sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

body.no-scroll {
    overflow: hidden;
}

button {
    font-family: inherit;
}

/* --- 2. HEADER (Stile Nuovo) --- */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.8rem 2rem;
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* FIX LOGO: Dimensioni corrette e proporzionate */
.logo-cut {
    height: 45px;
    /* Altezza fissa ottimale per navbar */
    width: auto;
    /* Larghezza automatica per non deformare */
    display: flex;
    align-items: center;
}

.logo-cut img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Bottoni Header con bordo colorato per visibilità */
.profile,
.saved-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    /* Bordo Blu per visibilità */
    background: white;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--accent);
}

.profile:hover,
.saved-btn:hover {
    border-color: var(--accent-hover);
    background: var(--accent-light);
    transform: translateY(-2px);
}

.profile svg,
.saved-icon {
    width: 20px;
    height: 20px;
    fill: var(--primary);
}

.saved-btn {
    position: relative;
}

.saved-icon {
    fill: none;
    stroke: var(--primary);
    stroke-width: 1.5;
}

.saved-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 2px white;
}

/* --- 3. HERO (Aggiornato allo stile Premium) --- */
.hero {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.8)), url('https://placehold.co/1920x600/1e293b/1e293b');
    background-size: cover;
    background-position: center;
    padding: 6rem 1rem;
    text-align: center;
    color: white;
    margin-bottom: 0;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
    animation: fadeHero 0.8s ease-out;
}

@keyframes fadeHero {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 2rem;
    letter-spacing: -1px;
}

.cta-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.cta-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.5);
}

/* --- 4. SEARCH --- */
.search-section {
    max-width: 96%;
    margin: -30px auto 3rem;
    margin-top: 2rem;
    position: relative;
    z-index: 10;
}

.search-bar-wrapper {
    display: flex;
    gap: 12px;
    height: 60px;
}

.search-input-container {
    flex-grow: 1;
    position: relative;
    height: 100%;
}

.search-input-container input {
    width: 100%;
    height: 100%;
    padding: 0 20px 0 54px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    background: white;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    outline: none;
}

.search-input-container input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.search-input-container .search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    fill: var(--text-muted);
    pointer-events: none;
}

/* Bottone Filtri: Contorno Blu per coerenza */
.filter-trigger-btn {
    height: 100%;
    padding: 0 2rem;
    background: white;
    border: 1px solid var(--accent);
    /* Contorno Blu */
    color: var(--accent);
    /* Testo Blu */
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    white-space: nowrap;
}

.filter-trigger-btn:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

.filter-trigger-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* --- 5. GRID --- */
.container {
    max-width: 96%;
    margin: 0 auto;
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.results-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 28px;
    padding-bottom: 4rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-actions {
    padding: 0 1.5rem 1.5rem;
}

.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    background: white;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.sale {
    color: #dc2626;
    background: #fee2e2;
}

.badge.new {
    color: var(--accent);
    background: #eff6ff;
}

.card-img-wrap {
    height: 200px;
    background: #f1f5f9;
    overflow: hidden;
    position: relative;
}

.card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s;
}

.product-card:hover .card-img-wrap img {
    transform: scale(1.05);
}

.card-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
}

.category {
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    background: var(--accent-light);
    padding: 4px 8px;
    border-radius: 4px;
}

.distance-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #059669;
    background: #d1fae5;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.rating {
    color: #f59e0b;
    letter-spacing: 1px;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary);
    line-height: 1.3;
}

.company-location-link {
    text-decoration: none;
    transition: var(--transition);
    display: block;
    width: fit-content;
}

.company-location-link:hover .company-location {
    color: var(--accent);
    text-decoration: underline;
}

.company-location {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition);
}

.card-price {
    margin-top: auto;
    padding-top: 1.2rem;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.rate-label {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    position: relative;
    top: 2px;
}

/* Bottone Segui nella card: Contorno Blu per coerenza */
.btn-save-card {
    width: 100%;
    margin-top: 1.2rem;
    padding: 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent);
    /* Contorno Blu */
    color: var(--accent);
    /* Testo Blu */
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-save-card:hover {
    background: var(--accent-light);
    border-color: var(--accent-hover);
}

/* Stato Attivo (Seguito) */
.btn-save-card.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-save-card svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.btn-save-card.active svg {
    fill: white;
    stroke: white;
}

/* --- 6. DRAWER & SIDEBAR --- */
.drawer-overlay,
.saved-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.drawer-overlay.open,
.saved-overlay.open {
    display: block;
    opacity: 1;
}

.drawer,
.saved-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 400px;
    max-width: 85vw;
    background: white;
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 210;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.drawer.open,
.saved-sidebar.open {
    transform: translateX(0);
}

.drawer-header,
.saved-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.icon-btn-close,
.close-saved {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    display: grid;
    place-items: center;
    transition: var(--transition);
}

.icon-btn-close:hover,
.close-saved:hover {
    background: #f1f5f9;
    color: var(--accent);
}

.drawer-body,
.saved-items {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary);
}

.select-wrapper select,
.input-wrapper input {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    background: #f8fafc;
}

.select-wrapper select:focus,
.input-wrapper input:focus {
    border-color: var(--accent);
    background: white;
}

.drawer-footer,
.saved-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-primary-full {
    background: var(--accent);
    color: white;
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary-full:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

.btn-text:hover {
    color: var(--primary);
}

.saved-item-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
}

.saved-item-img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
}

.btn-remove-sm {
    color: #ef4444;
    background: none;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 5px;
    font-weight: 500;
}

.btn-remove-sm:hover {
    text-decoration: underline;
}

.btn-danger-full {
    background: #fee2e2;
    color: #b91c1c;
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger-full:hover {
    background: #fecaca;
}

/* --- 7. FOOTER (Stile Nuovo Premium) --- */
footer {
    background: linear-gradient(180deg, var(--primary) 0%, #020617 100%);
    /* Sfumatura Premium */
    color: #cbd5e1;
    margin-top: 6rem;
    padding: 5rem 2rem 2rem;
    border-top: 4px solid var(--accent);
    /* Linea superiore colorata */
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-col h4 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.footer-col p {
    line-height: 1.6;
    opacity: 0.8;
}

.footer-col a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-col a:hover {
    color: var(--accent);
    padding-left: 5px;
}

/* Effetto scivolamento a destra */

.footer-bottom {
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 2rem;
}

/* Mobile */
@media(max-width: 768px) {
    .search-bar-wrapper {
        flex-direction: column;
        height: auto;
    }

    .search-input-container,
    .filter-trigger-btn {
        width: 100%;
        height: 50px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .logo-cut {
        height: 35px;
    }

    /* Logo leggermente più piccolo su mobile */
}