/* ============================================================
   CAMBIOBICI.COM — style.css (Completo e Definitivo)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --white: #FFFFFF; --black: #000000; --yellow: #F3BA40; --yellow-dark: #D9A52F;
  --gray-light: #F2F2F2; --gray-mid: #6B6B6B; --gray-border: #E5E5E5;
  --danger: #D9534F; --success: #2E9E5B;
  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-pill: 999px;
  --shadow: 0 4px 16px rgba(0,0,0,.06); --shadow-hover: 0 8px 24px rgba(0,0,0,.10);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1280px; --header-h: 72px;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--black); background: var(--white); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--yellow-dark); }
button { font-family: inherit; cursor: pointer; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5 { font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.section { padding: 72px 0; }
.section--gray { background: var(--gray-light); }
.section--dark { background: var(--black); color: var(--white); }
.section--yellow { background: var(--yellow); color: var(--black); }
.section--white { background: var(--white); }
.section__head { margin-bottom: 40px; text-align: center; }
.section__head h2 { margin-bottom: 8px; }
.section__head p { color: var(--gray-mid); max-width: 620px; margin: 0 auto; }
.section--dark .section__head p { color: #bbb; }

/* ---------- BOTTONI ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 22px; height: 44px; border: 2px solid transparent; border-radius: var(--radius-sm); font-weight: 800; font-size: .95rem; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--yellow); color: var(--black); }
.btn--primary:hover { background: var(--yellow-dark); color: var(--black); box-shadow: var(--shadow-hover); }
.btn--secondary { background: var(--black); color: var(--yellow); }
.btn--secondary:hover { background: #1a1a1a; color: var(--yellow); box-shadow: var(--shadow-hover); }
.btn--outline { background: transparent; color: var(--black); border-color: var(--black); }
.btn--outline:hover { background: var(--black); color: var(--yellow); }
.btn--ghost { background: transparent; color: var(--white); border-color: var(--white); }
.btn--ghost:hover { background: var(--white); color: var(--black); }
.btn--sm { padding: 0 14px; height: 36px; font-size: .85rem; }
.btn--lg { padding: 0 32px; height: 56px; font-size: 1.05rem; }
.btn--block { width: 100%; }

.btn--header-cta {
  border: 2px solid var(--yellow);
  background: var(--white);
  color: var(--black);
  font-weight: 800;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  transition: all .15s ease;
}
.btn--header-cta:hover {
  background: var(--yellow);
  color: var(--black);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

/* ---------- BADGE ---------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.badge--premium { background: var(--yellow); color: var(--black); }
.badge--new { background: var(--black); color: var(--yellow); }
.badge--sold { background: var(--danger); color: var(--white); }
.badge--gray { background: var(--gray-light); color: var(--gray-mid); }

/* ---------- CARD (Generiche) ---------- */
.card { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; box-shadow: var(--shadow); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--yellow); }
.card__media { position: relative; aspect-ratio: 4/3; background: var(--gray-light); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .card__media img { transform: scale(1.04); }
.card__media .badge { position: absolute; top: 10px; left: 10px; z-index: 2; }
.card__body { padding: 16px; }
.card__title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__meta { font-size: .85rem; color: var(--gray-mid); display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.card__price { font-size: 1.2rem; font-weight: 800; color: var(--black); }

/* ---------- AD-CARD (Base per Annunci) ---------- */
.ad-card { 
    position: relative; 
    display: block; 
    border-radius: var(--radius-lg); 
    overflow: hidden; 
    aspect-ratio: 4 / 3;
    background: var(--gray-light); 
    box-shadow: var(--shadow); 
    transition: transform .2s ease, box-shadow .2s ease; 
}
.ad-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.ad-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.ad-card:hover img { transform: scale(1.05); }
.ad-card__overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.45) 70%, rgba(0,0,0,0.85) 100%); z-index: 1; }
.ad-card__content { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px; color: var(--white); z-index: 2; }
.ad-card__category { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--yellow); margin-bottom: 6px; }
.ad-card__title { font-size: 1.15rem; font-weight: 800; line-height: 1.25; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ad-card__meta { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: #e8e8e8; }
.ad-card__price { font-weight: 800; color: var(--white); font-size: 1.05rem; }
.ad-card__tag { position: absolute; top: 14px; right: 14px; z-index: 3; background: var(--yellow); color: var(--black); font-size: .7rem; font-weight: 800; text-transform: uppercase; padding: 5px 10px; border-radius: var(--radius-pill); letter-spacing: .04em; }

/* ---------- GRIGLIE ---------- */
.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--6 { grid-template-columns: repeat(6, 1fr); }

.grid--ad-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
@media (max-width: 1024px) {
    .grid--ad-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .grid--ad-4 { grid-template-columns: 1fr; }
}

.grid--theme-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    margin: 0 auto;
}
@media (max-width: 768px) {
    .grid--theme-2x2 { grid-template-columns: 1fr; }
}

/* ---------- HEADER ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--white); border-bottom: 1px solid var(--gray-border); height: var(--header-h); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 24px; }
.site-header__logo { display: flex; align-items: center; gap: 10px; height: 100%; flex-shrink: 0; }
.site-header__logo img { height: 38px; width: auto; max-height: 100%; object-fit: contain; display: block; }
.site-header__nav { display: flex; gap: 20px; align-items: center; }
.site-header__nav > a, .site-header__nav > .nav-item > a { font-weight: 600; font-size: .95rem; padding: 8px 0; display: inline-block; position: relative; transition: color .2s ease; }
.site-header__nav > a:hover, .site-header__nav > .nav-item > a:hover { color: var(--yellow-dark); }
.site-header__nav > a::after, .site-header__nav > .nav-item > a::after { content: ""; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background: var(--yellow); transition: width .2s ease; }
.site-header__nav > a:hover::after, .site-header__nav > .nav-item > a:hover::after { width: 100%; }
.site-header__nav > .nav-item { position: relative; }
.site-header__nav > .nav-item.has-mega > a::after {
  content: ""; display: inline-block; margin-left: 4px;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor;
  vertical-align: middle; transition: transform .2s ease; position: static; width: auto; height: auto; background: none;
}
.site-header__nav > .nav-item.has-mega:hover > a::after { transform: rotate(180deg); }

.mega-menu { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius); box-shadow: var(--shadow-hover); padding: 20px; min-width: 480px; display: none; z-index: 200; }
.nav-item.has-mega:hover .mega-menu, .nav-item.has-mega.is-open .mega-menu { display: block; }
.mega-menu__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mega-menu__grid a { padding: 8px 10px; border-radius: var(--radius-sm); font-size: .9rem; }
.mega-menu__grid a:hover { background: var(--gray-light); }
.mega-menu__title { grid-column: 1 / -1; font-weight: 800; font-size: .8rem; text-transform: uppercase; color: var(--gray-mid); padding: 4px 10px; margin-bottom: 4px; }

.site-header__actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.site-header__icon { position: relative; display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 50%; background: var(--gray-light); }
.site-header__icon:hover { background: var(--yellow); color: var(--black); }
.site-header__burger { display: none; }
.dropdown { position: relative; }
.dropdown__menu { position: absolute; right: 0; top: calc(100% + 10px); min-width: 200px; background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius); box-shadow: var(--shadow-hover); padding: 8px 0; display: none; z-index: 210; }
.dropdown.is-open .dropdown__menu { display: block; }
.dropdown__menu a { display: block; padding: 10px 16px; font-size: .92rem; }
.dropdown__menu a:hover { background: var(--gray-light); color: var(--black); }

/* ---------- HERO ---------- */
.hero { position: relative; min-height: 520px; display: flex; align-items: center; background: var(--black) center/cover no-repeat; color: var(--white); overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.75)); z-index: 0; }
.hero__inner { position: relative; z-index: 1; width: 100%; text-align: center; padding: 80px 20px; }
.hero h1 { margin-bottom: 14px; }
.hero p { font-size: 1.1rem; color: #e8e8e8; margin-bottom: 32px; max-width: 640px; margin-left: auto; margin-right: auto; }

/* ---------- SEARCHBAR ---------- */
.searchbar { display: flex; gap: 0; max-width: 900px; margin: 0 auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-hover); overflow: hidden; align-items: stretch; }
.searchbar input, .searchbar select { border: none; padding: 16px 18px; font-size: 1rem; outline: none; background: transparent; }
.searchbar input { flex: 1; min-width: 0; }
.searchbar__select-wrap { position: relative; border-left: 1px solid var(--gray-border); display: flex; align-items: center; }
.searchbar select { appearance: none; -webkit-appearance: none; padding-right: 40px; max-width: 220px; cursor: pointer; background: transparent; border: none; height: 100%; }
.searchbar__select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--black); pointer-events: none; }
.searchbar .btn { border-radius: 0; padding: 16px 28px; border-left: 1px solid var(--gray-border); height: auto; }

/* ---------- CATEGORIE ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px; }
.cat-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px 8px; background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius); text-align: center; font-weight: 700; font-size: 0.8rem; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.cat-card:hover { transform: translateY(-3px); border-color: var(--yellow); box-shadow: var(--shadow-hover); }
.cat-card img { width: 48px; height: 48px; object-fit: contain; transition: transform .2s ease; }
.cat-card:hover img { transform: scale(1.1); }
.cat-card svg { display: none; }

/* ---------- STEPS ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.step { text-align: center; padding: 30px 20px; background: rgba(255,255,255,0.03); border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.1); transition: background .2s ease; }
.step:hover { background: rgba(255,255,255,0.06); }
.step__icon { width: 64px; height: 64px; margin: 0 auto 16px; color: var(--yellow); }
.step__icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }
.step h3 { margin-bottom: 12px; color: var(--white); font-size: 1.4rem; }
.step p { color: #bbb; font-size: .95rem; line-height: 1.6; }

/* ---------- CTA PREMIUM ---------- */
.cta-premium-section {
    background-color: var(--yellow);
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='%23000000' stroke-opacity='0.06' stroke-width='2'/%3E%3C/svg%3E");
    padding: 80px 0;
    overflow: hidden;
}
.cta-premium-layout { display: flex; align-items: center; gap: 40px; flex-wrap: wrap; }
.cta-premium-text { flex: 1; min-width: 300px; }
.cta-premium-text h2 { font-size: clamp(2.5rem, 5vw, 4.5rem); line-height: 1.1; margin-bottom: 16px; color: var(--black); }
.cta-premium-text p { font-size: clamp(1.1rem, 2vw, 1.4rem); margin-bottom: 32px; color: #332200; font-weight: 600; }
.cta-premium-image { flex: 1; min-width: 300px; max-width: 600px; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-hover); border: 4px solid var(--black); }
.cta-premium-image img { width: 100%; height: auto; display: block; }

/* ---------- MAGAZINE ---------- */
.magazine-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.mag-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.mag-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.mag-card__img { aspect-ratio: 16/9; overflow: hidden; background: var(--gray-light); }
.mag-card__img img { width: 100%; height: 100%; object-fit: cover; }
.mag-card__body { padding: 24px; }
.mag-card__cat { font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--yellow-dark); margin-bottom: 8px; letter-spacing: .05em; }
.mag-card__title { font-size: 1.25rem; font-weight: 800; margin-bottom: 8px; line-height: 1.3; }
.mag-card__excerpt { font-size: .95rem; color: var(--gray-mid); line-height: 1.5; }

/* ---------- AZIENDE ---------- */
.aziende-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.azienda-card { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius); padding: 20px; text-align: center; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.azienda-card:hover { transform: translateY(-3px); border-color: var(--yellow); box-shadow: var(--shadow-hover); }
.azienda-card__logo { width: 64px; height: 64px; margin: 0 auto 10px; background: var(--gray-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.4rem; color: var(--black); }
.azienda-card__name { font-weight: 700; font-size: .9rem; }
.azienda-card__meta { font-size: .8rem; color: var(--gray-mid); margin-top: 4px; }

/* ---------- NEWSLETTER (fascia nera) ---------- */
.newsletter-bar { 
    background: var(--black); 
    padding: 48px 0; 
    border-bottom: 1px solid #222222;
}
.newsletter-bar .container { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 24px; 
    flex-wrap: wrap; 
}
.newsletter-bar h3 { 
    font-size: 1.4rem; 
    margin-bottom: 6px; 
    color: var(--white); 
}
.newsletter-bar p { 
    font-size: .95rem; 
    color: #ccc; 
}
.newsletter-bar form { 
    display: flex; 
    gap: 8px; 
    flex: 1; 
    max-width: 460px; 
    min-width: 280px; 
}
.newsletter-bar input { 
    flex: 1; 
    padding: 12px 16px; 
    border: 1px solid #333; 
    border-radius: var(--radius-sm); 
    font-size: 1rem; 
    outline: none; 
    background: #111; 
    color: var(--white); 
}
.newsletter-bar button { 
    white-space: nowrap; 
}

/* ---------- FORM ---------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px 14px; font-size: 1rem; font-family: inherit; border: 1px solid var(--gray-border); border-radius: var(--radius-sm); background: var(--white); outline: none; transition: border-color .15s ease; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--yellow); }
.form-group textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: .82rem; color: var(--gray-mid); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---------- ALERT ---------- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 20px; border-left: 4px solid; }
.alert--error { background: #fdecea; color: #8a1f1b; border-color: var(--danger); }
.alert--success { background: #e8f6ee; color: #1e6b3e; border-color: var(--success); }
.alert--info { background: #fff7e0; color: #7a5b12; border-color: var(--yellow); }

/* ---------- FOOTER ---------- */
.site-footer { background: var(--black); color: #ccc; padding: 56px 0 24px; }
.site-footer h4 { color: var(--white); margin-bottom: 14px; font-size: 1rem; }
.site-footer a { color: #ccc; font-size: .9rem; }
.site-footer a:hover { color: var(--yellow); }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer__brand p { font-size: .9rem; margin: 12px 0; max-width: 320px; }
.footer__brand img { max-height: 32px; width: auto; }
.footer__social { display: flex; gap: 10px; margin-top: 16px; }
.footer__social a { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.08); display: inline-flex; align-items: center; justify-content: center; transition: background .15s; }
.footer__social a:hover { background: var(--yellow); }
.footer__social a:hover svg { stroke: var(--black); }
.footer__social svg { width: 18px; height: 18px; stroke: var(--white); fill: none; stroke-width: 1.8; }
.footer__col ul li { margin-bottom: 8px; }
.footer__bottom { border-top: 1px solid #222222; padding-top: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: .82rem; color: #888; }
.footer__starprivacy { margin-top: 16px; display: inline-block; }
.footer__starprivacy img { max-height: 50px; width: auto; opacity: 0.9; transition: opacity .15s; }
.footer__starprivacy img:hover { opacity: 1; }

/* ---------- BANNER ---------- */
.banner-header, .banner-footer {
    background: var(--white);
    text-align: center;
}
.banner-header { border-bottom: 1px solid var(--gray-border); }
.banner-footer { border-top: 1px solid var(--gray-border); }
.banner-header img, .banner-footer img {
    max-width: 100%;
    height: auto;
    max-height: 120px;
    display: inline-block;
}
@media (max-width: 768px) {
    .banner-header img, .banner-footer img { max-height: 80px; }
}

/* ---------- UTILITIES ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--gray-mid); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; }

/* ============================================================
   LAYOUT ANNUNCIO (Desktop vs Mobile Separati)
   ============================================================ */
.listing-desktop {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.listing-desktop .listing-col-sx { display: flex; flex-direction: column; gap: 24px; }
.listing-desktop .listing-col-dx { display: flex; flex-direction: column; gap: 24px; }
.listing-mobile { display: none; }
@media (max-width: 900px) {
  .listing-desktop { display: none !important; }
  .listing-mobile { display: block !important; }
}

/* ============================================================
   LAYOUT RICERCA (Desktop vs Mobile)
   ============================================================ */
.search-desktop-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 30px;
  align-items: start;
}
.search-filters-desktop { position: sticky; top: 90px; }
.search-mobile-layout { display: none; }
@media (max-width: 900px) {
  .search-desktop-layout { display: none !important; }
  .search-mobile-layout { display: block !important; }
}

/* ============================================================
   MENU MOBILE ACCORDION
   ============================================================ */
.mobile-nav-item { border-bottom: 1px solid var(--gray-light); }
.mobile-nav-toggle { font-weight: 600; padding: 10px 0; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.mobile-nav-toggle span { font-weight: 800; font-size: 1.2rem; color: var(--yellow-dark); }
.mobile-nav-sub { display: none; flex-direction: column; padding-left: 16px; padding-bottom: 10px; }
.mobile-nav-sub a { border-bottom: none; padding: 6px 0; font-size: 0.95rem; }

/* ============================================================
   BARRA DI RICERCA CON ANGOLI ARROTONDATI
   ============================================================ */
.searchbar { border-radius: var(--radius); overflow: hidden; }
.searchbar input { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.searchbar__select-wrap { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.searchbar select { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.searchbar .btn { border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.card .searchbar { border-radius: var(--radius); overflow: hidden; }

/* ============================================================
   SELECT "ORDINA PER" ARROTONDATA
   ============================================================ */
select[name=order] {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    padding: 8px 32px 8px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--black);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23000000' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color .15s ease;
}
select[name=order]:hover { border-color: var(--yellow); }
select[name=order]:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(243, 186, 64, 0.2); }
@media (max-width: 768px) {
    select[name=order] { padding: 6px 28px 6px 10px; font-size: 0.85rem; }
}

/* ============================================================
   CARD TEMATICHE (Esplora per sezione)
   ============================================================ */
.ad-card--theme {
    aspect-ratio: 16 / 9 !important;
    height: auto;
    max-height: 280px;
    width: 100%;
}
.ad-card--theme img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ad-card--theme .ad-card__content { padding: 24px; text-align: left; display: flex; flex-direction: column; justify-content: flex-end; }
.ad-card--theme .ad-card__title { font-size: 1.8rem; color: var(--white); margin-bottom: 4px; }
.ad-card--theme .ad-card__subtitle { font-size: 0.95rem; color: var(--yellow); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 768px) {
    .ad-card--theme {
        aspect-ratio: 16 / 9 !important;
        max-height: none;
    }
}

/* ============================================================
   SCARPETTE VOTO
   ============================================================ */
.scarpe-voto { display: inline-flex; gap: 6px; align-items: center; }
.scarpa-wrapper { position: relative; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.scarpa-wrapper .cerchio-bg { position: absolute; inset: 0; border-radius: 50%; background: var(--gray-light); border: 2px solid var(--gray-border); z-index: 1; transition: background 0.3s ease, border-color 0.3s ease; }
.scarpa-wrapper .scarpa-img { position: relative; z-index: 2; width: 24px; height: 24px; object-fit: contain; filter: opacity(0.4) grayscale(100%); transition: filter 0.3s ease, transform 0.2s ease; }
.scarpa-wrapper.piena .cerchio-bg { background: var(--yellow); border-color: var(--yellow-dark); }
.scarpa-wrapper.piena .scarpa-img { filter: opacity(1) grayscale(0%); }
.scarpa-wrapper.mezza .cerchio-bg { background: linear-gradient(90deg, var(--yellow) 50%, var(--gray-light) 50%); border-color: var(--gray-border); }
.scarpa-wrapper.mezza .scarpa-img { filter: opacity(1) grayscale(0%); }
.star-btn:hover .scarpa-wrapper .cerchio-bg { transform: scale(1.1); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .magazine-grid { grid-template-columns: 1fr; }
  .aziende-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .site-header__nav { display: none; }
  .site-header__burger { display: inline-flex; }
  .mega-menu { display: none !important; }
  .site-header__actions .btn--header-cta { display: none; }
}

@media (max-width: 768px) {
  .section { padding: 52px 0; }
  .searchbar { flex-wrap: wrap; }
  .searchbar input { flex: 1 1 100%; border-top-right-radius: var(--radius); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .searchbar__select-wrap { flex: 1 1 100%; border-left: none; border-top: 1px solid var(--gray-border); }
  .searchbar select { max-width: none; width: 100%; }
  .searchbar .btn { flex: 1 1 100%; border-left: none; border-top: 1px solid var(--gray-border); border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .newsletter-bar .container { flex-direction: column; align-items: stretch; text-align: center; }
  .newsletter-bar form { max-width: none; }
  .footer__grid { grid-template-columns: 1fr; gap: 28px; }
  .hero { min-height: 440px; }
  .ad-card--theme .ad-card__title { font-size: 1.4rem; }
  .aziende-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero__inner { padding: 56px 16px; }
  .btn { padding: 11px 18px; font-size: .9rem; }
  .site-header__logo img { height: 30px; }
  .site-header { --header-h: 60px; }
  .aziende-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Menu mobile */
.mobile-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--white); border-bottom: 2px solid var(--yellow); box-shadow: var(--shadow-hover); padding: 16px 20px; flex-direction: column; gap: 4px; z-index: 99; }
.mobile-nav.is-open { display: flex; }
.mobile-nav a { font-weight: 600; padding: 10px 0; border-bottom: 1px solid var(--gray-light); }
.mobile-nav a:last-child { border-bottom: none; }
@media (min-width: 901px) { .mobile-nav { display: none !important; } }

/* ============================================================ */
/* FIX: CUORE PREFERITI — forza visibilità sopra overlay e card  */
/* Cuore a DESTRA, badge condizione a SINISTRA                   */
/* ============================================================ */
.ad-card,
.card__media {
    overflow: visible !important;
}

.card-heart,
.js-card-heart {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    left: auto !important;
    z-index: 9999 !important;
    width: 36px !important;
    height: 36px !important;
    background: #111 !important;
    border: 2px solid rgba(0,0,0,0.35) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-size: 16px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35) !important;
    line-height: 1 !important;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Il cuore resta sopra tutto, anche in search */
.card__media .js-card-heart,
.card__media .card-heart,
.ad-card .js-card-heart,
.ad-card .card-heart {
    z-index: 9999 !important;
}

.ad-card__overlay { z-index: 1 !important; }
.ad-card__tag { z-index: 3 !important; }
.ad-card__content { z-index: 2 !important; }

/* ============================================================ */
/* FIX: DASHBOARD MOBILE — statistiche e azioni rapide           */
/* ============================================================ */
@media (max-width: 768px) {
    .section .grid.grid--4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .section .grid.grid--4 > .card {
        padding: 16px 12px !important;
        text-align: center !important;
    }
    .section .grid.grid--4 > .card > div:first-child {
        width: 40px !important;
        height: 40px !important;
        margin: 0 auto 6px !important;
    }
    .section .grid.grid--4 > .card > div:first-child svg {
        width: 20px !important;
        height: 20px !important;
    }
    .section .grid.grid--4 > .card > div:nth-child(2) {
        font-size: 1.5rem !important;
    }
    .section .grid.grid--4 > .card > div:nth-child(3) {
        font-size: 0.78rem !important;
        line-height: 1.2 !important;
    }

    .section .grid.grid--4:has(> a.card) {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .section .grid.grid--4 > a.card {
        flex-direction: column !important;
        text-align: center !important;
        padding: 16px 10px !important;
        gap: 8px !important;
        min-height: auto !important;
    }
    .section .grid.grid--4 > a.card > div:first-child {
        width: 44px !important;
        height: 44px !important;
        margin: 0 auto !important;
    }
    .section .grid.grid--4 > a.card > div:first-child svg {
        width: 22px !important;
        height: 22px !important;
    }
    .section .grid.grid--4 > a.card > div:last-child {
        text-align: center !important;
    }
    .section .grid.grid--4 > a.card > div:last-child > div:first-child {
        font-size: 0.9rem !important;
        line-height: 1.2 !important;
    }
    .section .grid.grid--4 > a.card > div:last-child > div:last-child {
        font-size: 0.75rem !important;
    }

    .section .flex-between h1 {
        font-size: 1.4rem !important;
    }

    .section .card table {
        font-size: 0.82rem !important;
    }
    .section .card table th,
    .section .card table td {
        padding: 8px 6px !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 380px) {
    .section .grid.grid--4 {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================ */
/* GRIGLIA ANNUNCI UNIFICATA (home)                              */
/* Foto grandi 4/3, 4 col desktop → 2 tablet → 1 mobile          */
/* ============================================================ */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
@media (max-width: 1024px) {
    .listings-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}
@media (max-width: 640px) {
    .listings-grid { grid-template-columns: 1fr; gap: 16px; }
}
.listings-grid .card { display: flex; flex-direction: column; }
.listings-grid .card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--gray-light);
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}
.listings-grid .card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.listings-grid .card__body { padding: 16px; }
.listings-grid .card__title { font-size: 1rem; }

/* ============================================================ */
/* SEARCH MOBILE — 1 colonna come home, foto grandi 4/3         */
/* Questa regola vince su fix.css (.search-mobile-layout .grid)  */
/* ============================================================ */
@media (max-width: 768px) {
    .search-mobile-layout .listings-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .search-mobile-layout .listings-grid .card {
        overflow: hidden !important;
        background: var(--white) !important;
        border: 1px solid var(--gray-border) !important;
        border-radius: var(--radius) !important;
    }
    .search-mobile-layout .listings-grid .card__media {
        aspect-ratio: 4 / 3 !important;
        overflow: hidden !important;
        border-radius: var(--radius) var(--radius) 0 0 !important;
        background: var(--gray-light) !important;
    }
    .search-mobile-layout .listings-grid .card__media img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
    }
    .search-mobile-layout .listings-grid .card__body { padding: 14px !important; }
    .search-mobile-layout .listings-grid .card__title { font-size: 1rem !important; }
    .search-mobile-layout .listings-grid .card__price { font-size: 1.15rem !important; }
    .search-mobile-layout .listings-grid .card__meta { font-size: 0.85rem !important; }
}