/* NextR S.r.l. — Precision Engineering, Multi-Resolution Adaptive Layout & IoT 4.0 Stylesheet */

:root {
  --nextr-navy: #071A2B;
  --nextr-navy-mid: #0A2540;
  --nextr-blue: #0E5A8A;
  --nextr-green: #5E9E43;
  --nextr-green-dark: #4B8433;
  --nextr-cyan: #38BDF8;
  --nextr-emerald: #10B981;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 112px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: clamp(0.9375rem, 0.91rem + 0.15vw, 1rem);
  line-height: 1.6;
  color: #0F172A;
  background-color: #FFFFFF;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

/* Fluid typography scale with controlled upper cap */
.nextr-h1 {
  font-size: clamp(1.85rem, 1.35rem + 2vw, 3rem);
  line-height: 1.14;
}

.nextr-h2 {
  font-size: clamp(1.5rem, 1.15rem + 1.35vw, 2.25rem);
  line-height: 1.2;
}

.nextr-h3 {
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.375rem);
  line-height: 1.28;
}

/* Fluid centered containers (laptop / desktop / widescreen balanced proportions) */
.nextr-container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 2.5vw, 2rem);
}

.nextr-form-container {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 2.5vw, 2rem);
}

.font-mono-tech {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

/* Prevent iOS Safari auto-zoom on form controls & optimize touch ergonomics */
#quoteForm input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#quoteForm select,
#quoteForm textarea {
  font-size: max(16px, 1rem);
}

.upload-dropzone {
  min-height: 56px;
}

@media (max-width: 767.98px) {
  #quoteForm input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #quoteForm select,
  #quoteForm button,
  #quoteForm .upload-dropzone,
  #quoteForm details > summary {
    min-height: 48px;
  }

  #quoteForm .privacy-touch-label {
    min-height: 48px;
  }
}

/* Live thumbnail previews for uploaded photos */
.photo-thumb-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.photo-thumb-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.625rem;
  background-color: #F8FAFC;
  border: 1px solid #CBD5E1;
}

.photo-thumb-img {
  width: 56px;
  height: 56px;
  border-radius: 0.5rem;
  object-fit: cover;
  flex-shrink: 0;
  background-color: #E2E8F0;
  border: 1px solid #CBD5E1;
}

.photo-thumb-fallback {
  width: 56px;
  height: 56px;
  border-radius: 0.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #E0F2FE;
  color: #0E5A8A;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

/* Engineering grid background */
.bg-tech-grid {
  background-image:
    linear-gradient(to right, rgba(56, 189, 248, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-tech-grid-light {
  background-image:
    linear-gradient(to right, rgba(14, 90, 138, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(14, 90, 138, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
}

/* SVG flow & telemetry animations */
@keyframes flowDash {
  to {
    stroke-dashoffset: -48;
  }
}

@keyframes flowDashSlow {
  to {
    stroke-dashoffset: -72;
  }
}

@keyframes pulseRing {
  0%, 100% {
    opacity: 0.9;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(1.18);
  }
}

.svg-flow-line {
  stroke-dasharray: 8 8;
  animation: flowDash 1.8s linear infinite;
}

.svg-flow-line-slow {
  stroke-dasharray: 10 14;
  animation: flowDashSlow 3.4s linear infinite;
}

.svg-pulse-node {
  transform-box: fill-box;
  transform-origin: center;
  animation: pulseRing 2.6s ease-in-out infinite;
}

/* Interactive curve point button */
.curve-point-btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.curve-point-btn.is-active {
  background-color: #0E5A8A;
  color: #FFFFFF;
  border-color: #0E5A8A;
  box-shadow: 0 8px 20px -6px rgba(14, 90, 138, 0.45);
}

/* Revamping tabs */
.revamp-tab-btn {
  transition: all 0.2s ease;
}

.revamp-tab-btn[aria-selected="true"] {
  background-color: #071A2B;
  color: #FFFFFF;
  border-color: #071A2B;
  box-shadow: 0 10px 25px -8px rgba(7, 26, 43, 0.35);
}

.revamp-tab-btn[aria-selected="true"] .tab-badge {
  background-color: #5E9E43;
  color: #FFFFFF;
}

/* Form channel switcher tabs (Preventivi vs Assistenza / SLA) */
[data-channel-tab] {
  cursor: pointer;
}

[data-channel-tab][aria-selected="true"] {
  background-color: #071A2B !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 12px -2px rgba(7, 26, 43, 0.28);
}

[data-channel-tab][aria-selected="false"] {
  background-color: transparent !important;
  color: #334155 !important;
  box-shadow: none;
}

[data-channel-tab][aria-selected="false"]:hover {
  background-color: rgba(255, 255, 255, 0.85) !important;
}

[data-service-card].is-selected {
  border-color: #0E5A8A !important;
  box-shadow: 0 0 0 2px rgba(14, 90, 138, 0.2) !important;
}

/* Deep-dive technical expandable tabs & visual route cards */
[data-deepdive-tab] {
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-deepdive-tab][aria-selected="true"] {
  background-color: #071A2B !important;
  color: #FFFFFF !important;
  border-color: #071A2B !important;
  box-shadow: 0 6px 16px -4px rgba(7, 26, 43, 0.28);
}

[data-deepdive-tab][aria-selected="false"] {
  background-color: #FFFFFF !important;
  color: #334155 !important;
}

[data-deepdive-tab][aria-selected="false"]:hover {
  border-color: #0E5A8A !important;
  color: #071A2B !important;
}

[data-deepdive-toggle][aria-expanded="true"] .deepdive-chevron {
  transform: rotate(180deg);
}

.visual-route-card {
  cursor: pointer;
  background-color: #F8FAFC !important;
  border-color: #CBD5E1 !important;
  opacity: 0.86;
  box-shadow: none !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.visual-route-card:hover {
  transform: translateY(-2px);
  opacity: 1;
  border-color: #94A3B8 !important;
}

.visual-route-card [data-route-badge] {
  background-color: #CBD5E1 !important;
  color: #334155 !important;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.visual-route-card[data-visual-route="preventivi"].is-active {
  background-color: #ECFDF5 !important;
  border-color: #56A339 !important;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(86, 163, 57, 0.22), 0 8px 20px -6px rgba(86, 163, 57, 0.22) !important;
}

.visual-route-card[data-visual-route="preventivi"].is-active [data-route-badge] {
  background-color: #56A339 !important;
  color: #FFFFFF !important;
}

.visual-route-card[data-visual-route="assistenza"].is-active {
  background-color: #F0F9FF !important;
  border-color: #0E5A8A !important;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(14, 90, 138, 0.22), 0 8px 20px -6px rgba(14, 90, 138, 0.22) !important;
}

.visual-route-card[data-visual-route="assistenza"].is-active [data-route-badge] {
  background-color: #071929 !important;
  color: #FFFFFF !important;
}

/* Honeypot field isolation */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* Highlight pulse when pre-selecting scope from CTA */
@keyframes highlightCard {
  0% {
    box-shadow: 0 0 0 0 rgba(94, 158, 67, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(94, 158, 67, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(94, 158, 67, 0);
  }
}

.solution-card-highlight {
  animation: highlightCard 1.1s ease-out 2;
  border-color: #5E9E43 !important;
}

/* Form error feedback */
.input-error {
  border-color: #DC2626 !important;
  background-color: #FEF2F2 !important;
}

/* Typography & Container Hierarchy */

/* Header dropdown & active navigation */
header.sticky {
  z-index: 9000;
  overflow: visible;
}

header.sticky nav {
  overflow: visible;
}

.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 9999;
  padding-top: 8px;
  min-width: 18rem;
  display: none;
}

.nav-dropdown:hover:not(.is-closing) > .nav-dropdown-menu,
.nav-dropdown.is-open > .nav-dropdown-menu,
.nav-dropdown[data-open="true"] > .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-panel {
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-dropdown-item {
  display: block;
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: #1E293B;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-dropdown-item:hover {
  background-color: #F8FAFC;
  color: #0E5A8A;
}

.nav-link-active {
  color: #0E5A8A !important;
  font-weight: 700;
}

/* Progressive contact form Level 1 / Level 2 */
.level2-toggle-btn[aria-expanded="true"] .level2-chevron {
  transform: rotate(180deg);
}

.channel-pill-preventivi {
  background-color: #ECFDF5;
  border-color: #5E9E43;
  color: #166534;
}

.channel-pill-assistenza {
  background-color: #F0F9FF;
  border-color: #0E5A8A;
  color: #0A4870;
}

/* Bidirectional Form Mode Tabs (Valutazione <-> Confronto Tecnico) */
[data-form-mode] {
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-form-mode="valutazione"][aria-selected="true"] {
  background-color: #5E9E43 !important;
  border-color: #5E9E43 !important;
  color: #FFFFFF !important;
  box-shadow: 0 8px 20px -6px rgba(94, 158, 67, 0.45);
}

[data-form-mode="confronto"][aria-selected="true"] {
  background-color: #0E5A8A !important;
  border-color: #0E5A8A !important;
  color: #FFFFFF !important;
  box-shadow: 0 8px 20px -6px rgba(14, 90, 138, 0.45);
}

[data-form-mode][aria-selected="true"] .mode-tab-sub {
  color: rgba(255, 255, 255, 0.88) !important;
}

[data-form-mode][aria-selected="false"] {
  background-color: #FFFFFF !important;
  border-color: #CBD5E1 !important;
  color: #1E293B !important;
}

[data-form-mode][aria-selected="false"]:hover {
  border-color: #64748B !important;
  background-color: #F8FAFC !important;
}

/* Transparent Hero logo: full original colors without lightening filters or light halos */
.hero-logo-transparent {
  filter: none;
  opacity: 1;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .svg-flow-line,
  .svg-flow-line-slow,
  .svg-pulse-node,
  .solution-card-highlight {
    animation: none !important;
  }
}
