/* =============================
   VARIABILI CSS
   ============================= */
:root {
  --color-primary: #018062;
  --color-primary-dark: #026d52;
  --color-primary-light: #e8f5f1;
  --color-bg: #f5f7f6;
  --color-surface: #ffffff;
  --color-text: #1a2e25;
  --color-text-muted: #5a7266;
  --color-border: #d4e8e0;
  --color-nav-text: #ffffff;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(1, 128, 98, 0.08);
  --shadow-md: 0 4px 24px rgba(1, 128, 98, 0.12);
  --max-width: 980px;
  --transition: 0.2s ease;
}

/* =============================
   RESET BASE
   ============================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =============================
   HEADER / NAV
   ============================= */
#header {
  background: var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#headerInt {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 12px;
  flex-wrap: nowrap;
}

/* Logo nell'header */
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-nav-text);
  flex-shrink: 0;
}

.header-logo img {
  height: 40px;
  width: auto;
  display: block;
}

.header-logo-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-nav-text);
  white-space: nowrap;
}

/* Desktop nav */
.desktop-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 2px;
  flex-shrink: 0;
}

.desktop-menu li {
  white-space: nowrap;
}

.desktop-menu li a {
  display: block;
  padding: 6px 10px;
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  line-height: 1.2;
}

.desktop-menu li a:hover {
  background: rgba(255,255,255,0.15);
}

.desktop-menu li a.active {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =============================
   MOBILE MENU
   ============================= */
.menu-mobile-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-width: 48px;
  min-height: 48px;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  align-items: center;
  z-index: 1201;
  flex-shrink: 0;
}

.menu-mobile-btn span {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--color-nav-text);
  border-radius: 2px;
  transition: all 0.3s;
}

#mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1200;
}

#mobile-menu-overlay.open {
  display: block;
}

#mobile-menu {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100vh;
  background: var(--color-primary);
  z-index: 1202;
  transition: right 0.3s cubic-bezier(0.77,0,0.18,1);
  padding-top: 64px;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
}

#mobile-menu.open {
  right: 0;
}

#mobile-menu ul {
  list-style: none;
  padding: 8px 0;
}

#mobile-menu ul li a {
  display: block;
  padding: 16px 24px;
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transition: background var(--transition);
}

#mobile-menu ul li a:hover {
  background: var(--color-primary-dark);
}

.mobile-menu-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--color-nav-text);
  font-size: 28px;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
}

.mobile-menu-close:hover {
  background: rgba(255,255,255,0.15);
}

/* =============================
   LAYOUT PRINCIPALE
   ============================= */
#content {
  flex: 1;
}

#contentInt {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

/* Card contenuto principale */
#text {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

/* =============================
   TIPOGRAFIA
   ============================= */
#text h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 25px;
  line-height: 1.25;
}

#text h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 28px;
  margin-bottom: 8px;
  line-height: 1.35;
}

#text p {
  color: var(--color-text);
  margin-bottom: 12px;
  line-height: 1.7;
}

/* link inline nel testo — escludo bottoni, card e badge */
#text a:not(.cta-generica):not(.preventivi-card):not(.badge-ordine) {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color var(--transition);
}

#text a:not(.cta-generica):not(.preventivi-card):not(.badge-ordine):hover {
  color: var(--color-primary-dark);
}

em {
  font-style: italic;
}

/* =============================
   BADGE ORDINE (sidebar rimossa, va nel footer o inline)
   ============================= */
.badge-ordine {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  text-decoration: none !important;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.badge-ordine:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(1,128,98,0.15);
  transform: translateY(-1px);
}

.badge-ordine img {
  height: 68px;
  width: auto;
}

/* =============================
   LISTE SPECIALI
   ============================= */
ul.speciale {
  list-style: none;
  margin: 16px 0;
}

ul.speciale li {
  padding: 10px 0 10px 36px;
  position: relative;
  border-bottom: 1px solid var(--color-border);
  line-height: 1.55;
}

ul.speciale li:last-child {
  border-bottom: none;
}

ul.speciale li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* check verde — voci generiche */
li.generico::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23018062'%3E%3Ccircle cx='10' cy='10' r='10' fill='%23e8f5f1'/%3E%3Cpath d='M6 10l3 3 5-5' stroke='%23018062' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

/* orologio — orario */
li.orario::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.5' stroke='%23018062' stroke-width='1.5'/%3E%3Cpath d='M10 6v4l2.5 2' stroke='%23018062' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* X / chiusura */
li.chiusura::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.5' stroke='%23018062' stroke-width='1.5'/%3E%3Cpath d='M7 7l6 6M13 7l-6 6' stroke='%23018062' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* telefono */
li.cellulare::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Crect x='6.5' y='2' width='7' height='16' rx='2' stroke='%23018062' stroke-width='1.5'/%3E%3Ccircle cx='10' cy='15' r='1' fill='%23018062'/%3E%3C/svg%3E");
}

/* pin mappa */
li.dove::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M10 2a6 6 0 0 1 6 6c0 4-6 10-6 10S4 12 4 8a6 6 0 0 1 6-6z' stroke='%23018062' stroke-width='1.5'/%3E%3Ccircle cx='10' cy='8' r='2' fill='%23018062'/%3E%3C/svg%3E");
}

/* busta mail */
li.mail::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Crect x='2' y='5' width='16' height='11' rx='1.5' stroke='%23018062' stroke-width='1.5'/%3E%3Cpath d='M2 6l8 6 8-6' stroke='%23018062' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  top: 12px;
}

/* globo/sito */
li.sito::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8' stroke='%23018062' stroke-width='1.5'/%3E%3Cellipse cx='10' cy='10' rx='3.5' ry='8' stroke='%23018062' stroke-width='1.5'/%3E%3Cpath d='M2 10h16' stroke='%23018062' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  top: 12px;
}

ul.speciale li a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  font-weight: 500;
  transition: color var(--transition);
  /* reset eventuali eredità da #text a */
  background: none;
  border: none;
  padding: 0;
}

ul.speciale li a:hover {
  color: var(--color-primary-dark);
  background: none;
  transform: none;
  box-shadow: none;
}

/* =============================
   CTA BUTTONS
   ============================= */
.cta-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

a.cta-generica {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background: var(--color-primary);
  color: #ffffff !important;
  text-decoration: none !important;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(1,128,98,0.30);
  border: none;
}

a.cta-generica:hover {
  background: var(--color-primary-dark);
  color: #ffffff !important;
  text-decoration: none !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(1,128,98,0.40);
}

a.cta-generica:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(1,128,98,0.20);
}

/* Nota evidenza */
.nota-evidenza {
  display: block;
  margin: 16px 0;
  padding: 10px 14px;
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--color-primary-dark);
  font-weight: 500;
}

/* Nota sconto – soglia preventivo */
.nota-sconto {
  display: none;
  margin: 20px 0;
  padding: 14px 18px;
  background: #fff8e6;
  border-left: 4px solid #e6a800;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #5a4600;
}
.nota-sconto strong {
  color: #b38600;
}
.nota-sconto a {
  color: var(--color-primary);
  text-decoration: underline;
}
.nota-sconto-contatti {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.nota-sconto-contatti span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nota-sconto-contatti span::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}
.nota-sconto-contatti .ico-telefono::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M3.5 2.5c0-.5.4-1 1-1h3l1.5 4-2 1.5a10 10 0 0 0 5 5l1.5-2 4 1.5v3c0 .6-.5 1-1 1C8 16 3.5 8 3.5 2.5z' stroke='%23018062' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.nota-sconto-contatti .ico-mail::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Crect x='2' y='5' width='16' height='11' rx='1.5' stroke='%23018062' stroke-width='1.5'/%3E%3Cpath d='M2 6l8 6 8-6' stroke='%23018062' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* =============================
   PREVENTIVI - TABELLE/FORM
   ============================= */
.preventivo-section {
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
}

.preventivo-section h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.preventivo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.preventivo-row:last-child {
  border-bottom: none;
}

.preventivo-row label {
  flex: 1;
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 500;
}

.preventivo-row input {
  width: 160px;
  padding: 10px 14px;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  text-align: right;
}

.preventivo-row input:focus {
  outline: none;
  border-color: var(--color-primary-dark);
  box-shadow: 0 0 0 3px rgba(1,128,98,0.15);
}

.preventivo-row input:read-only {
  background: var(--color-bg);
  border: 1.5px dashed var(--color-border);
  color: var(--color-text-muted);
  cursor: default;
  box-shadow: none;
}

/* Sezione somme - più evidenziata */
.preventivo-section.somme {
  background: var(--color-primary);
  border-color: var(--color-primary-dark);
}

.preventivo-section.somme h3 {
  color: #ffffff;
}

.preventivo-section.somme .preventivo-row {
  border-bottom-color: rgba(255,255,255,0.15);
}

.preventivo-section.somme .preventivo-row label {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}

.preventivo-section.somme .preventivo-row input {
  background: rgba(255,255,255,0.95);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  border-color: transparent;
}

/* Bottone calcola */
.cta-calcola {
  display: inline-flex;
  align-items: center;
  padding: 13px 32px;
  background: var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(1,128,98,0.30);
  user-select: none;
  border: none;
  font-family: var(--font);
  letter-spacing: 0.03em;
  margin: 0 auto 16px auto;
  text-decoration: none;
}

.cta-calcola:hover {
  background: var(--color-primary-dark);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(1,128,98,0.40);
}

.cta-calcola:active {
  transform: translateY(0);
}

/* Legacy table support (fallback) */
.table-preventivi {
  width: 100%;
  margin-bottom: 20px;
  border-collapse: collapse;
}

.table-preventivi td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.table-preventivi input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--color-surface);
}

.table-preventivi input:read-only {
  background: var(--color-primary-light);
  color: var(--color-text-muted);
}

.table-somme td {
  font-weight: 600;
}

.table-somme input {
  font-weight: 700;
  background: var(--color-primary-light) !important;
  color: var(--color-primary-dark) !important;
}

tr.coeff {
  display: none;
}

/* =============================
   MAPPA
   ============================= */
.map-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 56%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
}

.map-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =============================
   PROFESSIONISTI
   ============================= */
.professionista-card {
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin: 20px 0;
  border: 1px solid var(--color-border);
}

#text .professionista-card h2 {
  margin-top: 0;
  color: var(--color-primary-dark);
}

/* =============================
   PREVENTIVI LISTA LINK
   ============================= */
.preventivi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.preventivi-card {
  display: block;
  padding: 20px 24px;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  color: var(--color-text) !important;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.preventivi-card:hover {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(1,128,98,0.25);
  text-decoration: none !important;
}

.preventivi-card .card-desc {
  display: block;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 6px;
  transition: color var(--transition);
}

.preventivi-card:hover .card-desc {
  color: rgba(255,255,255,0.85);
}

/* =============================
   FOOTER
   ============================= */
#footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,0.85);
  margin-top: auto;
}

#footerInt {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-right {
  text-align: right;
}

#footer .copy,
#footer .credits {
  font-size: 0.8rem;
  color: #d0e8e2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#footer a {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--transition);
}

#footer a:hover {
  text-decoration-color: rgba(255,255,255,0.85);
}

/* =============================
   UTILITY
   ============================= */
.centered {
  justify-content: center;
}

.clear {
  clear: both;
}

.only-mobile {
  display: none;
}

/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 819px) {
  /* Header mobile */
  #headerInt {
    padding: 0 16px;
    height: 56px;
  }

  .desktop-menu {
    display: none !important;
  }

  .menu-mobile-btn {
    display: flex;
  }

  .only-mobile {
    display: block;
  }

  /* Contenuto */
  #contentInt {
    padding: 16px;
  }

  #text {
    padding: 24px 20px;
  }

  #text h1 {
    font-size: 1.4rem;
  }

  /* CTA */
  .cta-container {
    flex-direction: column;
  }

  a.cta-generica,
  .cta-calcola {
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  /* Preventivi */
  .preventivo-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .preventivo-row input {
    width: 100%;
    text-align: left;
  }

  .preventivi-grid {
    grid-template-columns: 1fr;
  }

  /* Footer */
  #footerInt {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .footer-right {
    text-align: center;
  }
}

@media (min-width: 820px) {
  .menu-mobile-btn,
  #mobile-menu,
  #mobile-menu-overlay {
    display: none !important;
  }

  .desktop-menu {
    display: flex !important;
  }
}
