/* ============================================================
   CasaRound — Editorial v3 (pkg6d)
   Verifica: grep 'pkg6d' editorial.css
============================================================ */

* { box-sizing: border-box; }

body {
  background: linear-gradient(180deg, #eff6ff 0%, #f0fdfa 100%);
  background-attachment: fixed;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1f2937;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }

/* --- Header --- */
.site-header {
  background: #fff; border-bottom: 3px solid #2563eb; padding: 0.8rem 0 0.4rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04); position: sticky; top: 0; z-index: 100;
}
.site-header .container { display: block; }
.site-header .container:first-child {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem;
}
.site-header .logo { font-size: 1.4rem; font-weight: 700; color: #1e3a8a; text-decoration: none; }
.site-header .logo span { color: #2563eb; font-weight: 400; }
.site-header nav a { margin-left: 1.2rem; color: #374151; text-decoration: none; font-weight: 500; transition: color .15s; }
.site-header nav a:hover { color: #2563eb; }

.header-search { display: flex; gap: 0.4rem; padding-bottom: 0.5rem; }
.header-search input[type="search"] {
  flex: 1; padding: 0.5rem 0.7rem; border: 1.5px solid #d1d5db; border-radius: 6px; font-size: 0.95rem;
}
.header-search input[type="search"]:focus { outline: none; border-color: #2563eb; }
.header-search button {
  padding: 0.5rem 1.2rem; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
  border: 0; border-radius: 6px; cursor: pointer; font-weight: 600;
}

/* --- HERO --- */
.hero {
  margin: 1rem 0 0.8rem; border-radius: 14px; padding: 1.8rem 1.5rem;
  color: #fff; text-align: center; position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(30,58,138,0.15);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.18) 0%, transparent 40%),
              radial-gradient(circle at 20% 80%, rgba(255,255,255,0.10) 0%, transparent 40%);
  pointer-events: none;
}
.hero-comune  { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #06b6d4 100%); }
.hero-via     { background: linear-gradient(135deg, #b91c1c 0%, #ea580c 50%, #f59e0b 100%); }
.hero-home    { background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 50%, #c026d3 100%); }
.hero-regione { background: linear-gradient(135deg, #166534 0%, #16a34a 50%, #84cc16 100%); }
.hero-search  { background: linear-gradient(135deg, #0c4a6e 0%, #0891b2 50%, #06b6d4 100%); }

.hero-content { position: relative; z-index: 1; }
.hero-emoji { font-size: 2.4rem; margin-bottom: 0.3rem; line-height: 1; }
.hero h1 {
  margin: 0 0 0.3rem; font-size: 2rem; font-weight: 800;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3); letter-spacing: -0.01em;
}
.hero-sub { margin: 0; font-size: 1rem; opacity: 0.95; font-weight: 500; }

.hero-search-form, .hero-search { display: flex; gap: 0.4rem; margin: 1rem auto 0; max-width: 540px; }
.hero-search input {
  flex: 1; padding: 0.65rem 0.9rem; border: 0; border-radius: 7px; font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.hero-search input:focus { outline: 2px solid #fff; }
.hero-search button {
  padding: 0.65rem 1.4rem; background: rgba(0,0,0,0.25); color: #fff; border: 1px solid rgba(255,255,255,0.4);
  border-radius: 7px; cursor: pointer; font-weight: 700; backdrop-filter: blur(4px);
}
.hero-search button:hover { background: rgba(0,0,0,0.4); }

@media (max-width: 700px) {
  .hero { padding: 1.2rem 1rem; }
  .hero h1 { font-size: 1.4rem; }
  .hero-emoji { font-size: 1.8rem; }
}

/* --- HERO MAP (Leaflet OSM nelle pagine via) --- */
.hero-map {
  padding: 0; height: 280px; position: relative; overflow: hidden;
  border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  background: #e5e7eb;
}
#hero-osm-map { position: absolute; inset: 0; z-index: 1; }
.hero-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 2rem 1.5rem 1.2rem;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.7) 100%);
  color: #fff; pointer-events: none;
}
.hero-overlay h1 {
  margin: 0 0 0.3rem; font-size: 2rem; font-weight: 800;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6); letter-spacing: -0.01em;
}
.hero-overlay .hero-sub { font-size: 1rem; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }

.leaflet-control-attribution { font-size: 10px !important; }

@media (max-width: 700px) {
  .hero-map { height: 220px; }
  .hero-overlay h1 { font-size: 1.4rem; }
}

/* --- Breadcrumb --- */
.breadcrumb { font-size: 0.85rem; color: #6b7280; padding: 0.6rem 0 0; }
.breadcrumb a { color: #2563eb; text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span[aria-current] { color: #111827; font-weight: 600; }

/* --- Editorial --- */
.editorial { padding: 0; }
.editorial h2 {
  font-size: 1.3rem; margin: 0 0 0.7rem; color: #1e3a8a;
  display: flex; align-items: center; gap: 0.5rem;
}
.editorial h2::before {
  content: ''; width: 4px; height: 22px;
  background: linear-gradient(180deg, #2563eb, #06b6d4); border-radius: 2px;
}
.editorial h3 { font-size: 1rem; margin: 1rem 0 0.4rem; color: #374151; font-weight: 600; }
.editorial p { line-height: 1.6; color: #374151; margin: 0 0 0.7rem; font-size: 0.95rem; }
.editorial p strong { color: #1e3a8a; }

/* --- Card --- */
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 1.1rem 1.3rem; margin-bottom: 0.8rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.card.warning {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
}
.card.disclaimer {
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}
.card.disclaimer p { color: #6b7280; }

/* --- Callout --- */
.callout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem;
  background: linear-gradient(135deg, #dbeafe 0%, #cffafe 100%);
  border: 1px solid #bfdbfe; border-radius: 12px;
  padding: 1rem 1.3rem; margin: 0 0 1rem;
  box-shadow: 0 4px 12px rgba(37,99,235,0.08);
}
.callout-stat { text-align: center; padding: 0.4rem 0.5rem; border-right: 1px solid rgba(37,99,235,0.15); }
.callout-stat:last-child { border-right: 0; }
.callout-label {
  display: block; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: #1e40af; font-weight: 700; margin-bottom: 0.25rem;
}
.callout-value { display: block; font-size: 1.25rem; font-weight: 800; color: #1e3a8a; }

@media (max-width: 700px) {
  .callout-stat { border-right: 0; border-bottom: 1px solid rgba(37,99,235,0.15); }
  .callout-stat:last-child { border-bottom: 0; }
}

/* --- Layout 2 col --- */
.layout-with-sidebar {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2rem; align-items: start;
}
.main-col { min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 0.7rem; position: sticky; top: 5rem; }

@media (max-width: 950px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

/* --- Side cards --- */
.side-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 0.9rem 1rem; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  border-top: 3px solid #2563eb;
}
.side-card:nth-child(2) { border-top-color: #06b6d4; }
.side-card:nth-child(3) { border-top-color: #f59e0b; }
.side-card:nth-child(4) { border-top-color: #ef4444; }
.side-card h3 { margin: 0 0 0.6rem; font-size: 0.95rem; color: #1e3a8a; font-weight: 700; line-height: 1.3; }

.side-search { display: flex; gap: 0.4rem; }
.side-search input {
  flex: 1; padding: 0.45rem 0.6rem; border: 1.5px solid #d1d5db; border-radius: 5px;
  font-size: 0.88rem; min-width: 0;
}
.side-search input:focus { outline: none; border-color: #2563eb; }
.side-search button {
  padding: 0.45rem 0.8rem; background: #2563eb; color: #fff; border: 0;
  border-radius: 5px; cursor: pointer; font-weight: 600; font-size: 0.88rem;
}
.side-search button:hover { background: #1d4ed8; }

.filter-list { list-style: none; padding: 0; margin: 0; }
.filter-list li {
  padding: 0.4rem 0; border-bottom: 1px dashed #e5e7eb; font-size: 0.88rem;
}
.filter-list li:last-child { border-bottom: 0; }
.filter-list a {
  color: #374151; text-decoration: none; display: flex; align-items: center; gap: 0.4rem; transition: color .15s;
}
.filter-list a:hover { color: #2563eb; }
.filter-list .muted { margin-left: auto; font-size: 0.78rem; }

.btn-block {
  display: block !important; padding: 0.65rem 1rem;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff !important; border-radius: 7px;
  text-decoration: none !important; text-align: center; font-weight: 700;
  font-size: 0.9rem; box-shadow: 0 2px 8px rgba(37,99,235,0.3);
  transition: transform .15s, box-shadow .15s;
}
.btn-block:hover {
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

/* --- Tabelle --- */
.data-table {
  width: 100%; border-collapse: collapse; margin: 0.6rem 0; font-size: 0.88rem;
  border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.data-table th {
  background: linear-gradient(180deg, #1e3a8a, #1e40af); color: #fff;
  padding: 0.55rem 0.7rem; text-align: left; font-weight: 600; font-size: 0.82rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.data-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid #f3f4f6; color: #374151; background: #fff; }
.data-table tr:nth-child(even) td { background: #f9fafb; }
.data-table tr:hover td { background: #eff6ff; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Liste vie --- */
.vie-list { list-style: none; padding: 0; margin: 0.4rem 0; }
.vie-list li {
  padding: 0.45rem 0.6rem; border-radius: 5px;
  display: flex; justify-content: space-between; align-items: center; transition: background .15s;
}
.vie-list li:hover { background: #eff6ff; }
.vie-list a { color: #1e3a8a; text-decoration: none; font-weight: 500; }
.vie-list a:hover { text-decoration: underline; }
.two-col-list { columns: 2; column-gap: 1.5rem; }
.two-col-list li { break-inside: avoid; }
@media (max-width: 700px) { .two-col-list { columns: 1; } }

/* --- Ranking cards --- */
.ranking-cards { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.4rem; }
.ranking-card {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 1rem;
  background: linear-gradient(90deg, #fef2f2 0%, #fff 60%);
  border: 1px solid #fee2e2; border-left: 5px solid #dc2626; border-radius: 8px;
  text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s;
}
.ranking-card:hover { transform: translateX(3px); box-shadow: 0 4px 12px rgba(220,38,38,0.15); }
.ranking-card-low {
  background: linear-gradient(90deg, #f0fdf4 0%, #fff 60%);
  border-color: #bbf7d0; border-left-color: #16a34a;
}
.ranking-card-low:hover { box-shadow: 0 4px 12px rgba(22,163,74,0.15); }
.rank-number { font-size: 1.5rem; font-weight: 800; color: #dc2626; min-width: 28px; text-align: center; line-height: 1; }
.ranking-card-low .rank-number { color: #16a34a; }
.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-weight: 600; color: #1f2937; font-size: 0.92rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank-meta { font-size: 0.76rem; color: #6b7280; margin-top: 1px; }
.rank-price { font-size: 1.1rem; font-weight: 800; color: #1e3a8a; white-space: nowrap; line-height: 1; }
.rank-price span { font-size: 0.7rem; color: #6b7280; font-weight: 500; margin-left: 2px; }

/* --- Fascia bars --- */
.fascia-bars { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.4rem 0; }
.fascia-bar-row { display: grid; grid-template-columns: 170px 1fr 80px; align-items: center; gap: 0.7rem; }
.fascia-bar-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.fascia-bar-track {
  height: 20px; background: #f3f4f6; border-radius: 4px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.fascia-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; min-width: 4px; }
.fascia-bar-count { font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  .fascia-bar-row { grid-template-columns: 130px 1fr 65px; gap: 0.4rem; }
  .fascia-bar-label { font-size: 0.8rem; }
}

.fascia-badge {
  display: inline-block; min-width: 24px; padding: 2px 6px;
  background: #1e3a8a; color: #fff; font-weight: 700; font-size: 0.74rem;
  border-radius: 4px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.fascia-badge-sm { font-size: 0.68rem; padding: 1px 5px; min-width: 20px; }

/* --- Comuni grid (home + regione) --- */
.comuni-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.8rem;
  margin: 0.6rem 0;
}
.comune-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.2rem 0.8rem; border-radius: 12px; color: #fff !important;
  text-decoration: none !important; text-align: center; min-height: 130px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transition: transform .2s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.comune-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.comune-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.2); }
.comune-card-emoji { font-size: 1.8rem; margin-bottom: 0.4rem; position: relative; z-index: 1; }
.comune-card-name {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 0.2rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3); position: relative; z-index: 1;
}
.comune-card-pop {
  font-size: 0.78rem; opacity: 0.92; font-weight: 500;
  position: relative; z-index: 1;
}

/* --- Province pills --- */
.province-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; }
.province-pill {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe; border-radius: 20px;
  padding: 0.4rem 0.9rem; display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.88rem;
}
.province-pill strong { color: #1e3a8a; }
.province-sigla {
  background: #1e3a8a; color: #fff; padding: 1px 6px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 700;
}

/* --- Search results --- */
.search-suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
.suggestion-chip {
  display: inline-block; padding: 0.4rem 0.9rem;
  background: linear-gradient(135deg, #dbeafe, #cffafe);
  color: #1e3a8a !important; text-decoration: none !important;
  border-radius: 20px; font-weight: 600; font-size: 0.88rem;
  border: 1px solid #bfdbfe;
  transition: transform .15s, box-shadow .15s;
}
.suggestion-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
}

.search-results { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.6rem; }
.search-result-card {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 1rem; background: #fff;
  border: 1px solid #e5e7eb; border-left: 3px solid #2563eb; border-radius: 8px;
  text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s;
}
.search-result-card:hover {
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.12);
}
.search-result-icon { font-size: 1.3rem; }
.search-result-info { flex: 1; min-width: 0; }
.search-result-name {
  font-weight: 600; color: #1e3a8a; font-size: 0.95rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-result-comune { font-size: 0.8rem; color: #6b7280; margin-top: 1px; }
.search-result-arrow { color: #2563eb; font-size: 1.3rem; font-weight: 700; }

/* --- Misc --- */
.muted { color: #9ca3af; font-weight: normal; }
.small { font-size: 0.83rem; }
.text-center { text-align: center; }

/* --- AdSense --- */
.ad-slot { margin: 0.5rem auto; min-height: 60px; display: block; }
.side-card.ad-slot { background: transparent; border: 0; box-shadow: none; padding: 0; min-height: 0; }

/* --- Footer --- */
.site-footer {
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  color: #d1d5db; padding: 2rem 0 1rem; margin-top: 2rem;
}
.site-footer h4 { color: #fff; margin: 0 0 0.6rem; font-size: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 0.18rem 0; }
.site-footer a { color: #93c5fd; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #bfdbfe; }
.site-footer .footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem;
  padding-bottom: 1.2rem; border-bottom: 1px solid #374151; margin-bottom: 0.8rem;
}
.site-footer .copy { text-align: center; margin: 0; }
.site-footer .copy small { color: #9ca3af; }
@media (max-width: 700px) { .site-footer .footer-grid { grid-template-columns: 1fr; } }
