/* =========================================================
   Finestre del sito e menu "Normative" (+ regole .policy-body
   riusate da privacy.html e cookie.html)
   ========================================================= */

/* --- Finestre (oggi: modulo "Richiedi preventivo") ---
   Il banner dei cookie non c'e piu: il sito non usa cookie (cookie.html). */
.policy-modal {
  position: fixed; inset: 0; z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--easing), visibility 0s linear 0.4s;
}
.policy-modal.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.4s var(--easing), visibility 0s linear 0s;
}
.policy-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.policy-modal-content {
  position: relative; z-index: 1;
  width: 92%; max-width: 760px;
  max-height: 85vh;
  background: rgba(240, 242, 246, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 48px 44px 40px;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.45s var(--ease-out-expo);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}
.policy-modal-content::-webkit-scrollbar { width: 5px; }
.policy-modal-content::-webkit-scrollbar-track { background: transparent; margin: 12px 0; }
.policy-modal-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
.policy-modal-content::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }
.policy-modal.is-open .policy-modal-content {
  transform: translateY(0) scale(1);
}
.policy-modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text-1);
  transition: background 0.2s, color 0.2s;
  z-index: 10;
}
.policy-modal-close:hover { background: var(--accent-red); color: #fff; }
.policy-body h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: var(--text-0);
}
.policy-body .policy-updated {
  font-size: 12px;
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  margin-bottom: 28px;
}
.policy-body h3 {
  font-size: 1.15rem;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--text-0);
}
.policy-body p, .policy-body ul {
  font-size: 14px;
  color: var(--text-1);
  line-height: 1.7;
  margin-bottom: 14px;
}
.policy-body ul {
  padding-left: 20px;
}
.policy-body ul li {
  margin-bottom: 6px;
}
.policy-body a {
  color: var(--accent-green);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 600px) {
  .policy-modal-content {
    width: 96%; padding: 32px 22px 28px;
    max-height: 90vh;
    border-radius: var(--radius-md);
  }
  .policy-body h2 { font-size: 1.4rem; }
}

/* --- Nav Policies Dropdown --- */
.nav-dropdown-wrap {
  position: relative;
}
.nav-dropdown-wrap > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-dropdown-arrow {
  width: 10px; height: 10px;
  transition: transform 0.3s var(--easing);
}
.nav-dropdown-wrap:hover .nav-dropdown-arrow,
.nav-dropdown-wrap.is-open .nav-dropdown-arrow {
  transform: rotate(180deg);
}
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 180px;
  background: rgba(240, 242, 246, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.4);
  padding: 8px;
  padding-top: 18px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--easing), visibility 0s 0.25s;
  z-index: 200;
}
/* Da tastiera: la tendina si apre quando il fuoco entra nel menu (solo desktop;
   su mobile si apre e chiude col tocco, classe .is-open) */
@media (min-width: 901px) {
  .nav-dropdown-wrap:focus-within .nav-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.25s, transform 0.25s var(--easing), visibility 0s 0s;
  }
  .nav-dropdown-wrap:focus-within .nav-dropdown-arrow { transform: rotate(180deg); }
}
/* Invisible bridge to prevent hover gap */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -12px; left: 0; right: 0;
  height: 14px;
}
.nav-dropdown-wrap:hover .nav-dropdown,
.nav-dropdown-wrap.is-open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.25s, transform 0.25s var(--easing), visibility 0s 0s;
}
.nav-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--text-1) !important;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.nav-dropdown a:hover {
  background: rgba(227, 6, 21, 0.08);
  color: var(--accent-red) !important;
}
.nav-dropdown a svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  flex-shrink: 0;
}

/* Mobile dropdown */
@media (max-width: 900px) {
  .nav-dropdown-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .nav-dropdown-wrap > a {
    justify-content: center;
    width: 100%;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    padding: 11px 24px !important;
    text-align: center;
    letter-spacing: -0.01em;
  }
  .nav-dropdown {
    position: static;
    transform: none !important;
    width: 100%;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    padding: 0;
    margin-top: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--easing), opacity 0.3s, padding 0.3s, margin 0.3s;
    box-shadow: none;
    background: rgba(0,0,0,0.03);
    border: none;
    border-radius: var(--radius-sm);
  }
  .nav-dropdown::before { display: none; }
  .nav-dropdown-wrap.is-open .nav-dropdown {
    max-height: 120px;
    opacity: 1;
    visibility: visible;
    padding: 6px 8px;
    margin-top: 4px;
  }
  .nav-dropdown a {
    justify-content: center;
  }
}
