:root {
  --primary-color: #1c71d8;
  --primary-light: #4aa8f0;
  --primary-lighter: #a6dfff;
  --primary-dark: #004b9a;
  --primary-darker: #002d62;

  --secondary-blue: #00bcd4;
  --accent-blue: #1d91c0;
  --light-blue: #e3f2fd;

  --accent-color: #ff6b35;
  --accent-secondary: #f03a47;

  --text-dark: #2c3e50;
  --text-light: #6c757d;
  --bg-light: #f8f9fa;
  --bg-lighter: #ffffff;
  --white: #ffffff;

  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);

  --border-radius: 15px;
  --border-radius-sm: 8px;
  --border-radius-lg: 25px;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  overflow-x: hidden;
}

/* Custom Bootstrap Overrides */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 12px 30px;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-lighter));
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-color), #e55a2b);
  border: none;
  color: var(--white);
  border-radius: var(--border-radius-sm);
  padding: 12px 30px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #e55a2b, #d14d20);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline-primary {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
  border-radius: var(--border-radius-sm);
  padding: 10px 28px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-outline-primary:hover {
  background: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
}

.text-primary {
  color: var(--primary-color) !important;
}

.text-accent {
  color: var(--accent-color) !important;
}

.bg-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--secondary-blue) 100%) !important;
}

.bg-light-blue {
  background: var(--light-blue) !important;
}

/* Navigation */
.custom-navbar {
  background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary-color) 50%, var(--primary-dark) 100%) !important;
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  padding: 1rem 0;
}

.custom-navbar .navbar-brand {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white) !important;
  transition: all 0.3s ease;
}

.custom-navbar .navbar-brand:hover {
  color: var(--accent-color) !important;
  transform: scale(1.05);
}

.custom-navbar .nav-link {
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.8rem 1.2rem !important;
  border-radius: var(--border-radius-sm);
  margin: 0 0.2rem;
}

.custom-navbar .nav-link:hover,
.custom-navbar .nav-link.active {
  color: var(--accent-color) !important;
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-menu {
  border: none;
  box-shadow: var(--shadow-xl);
  border-radius: var(--border-radius);
  background: var(--white);
  padding: 1rem 0;
  margin-top: 0.5rem;
  min-width: 250px;
}

.dropdown-item {
  padding: 0.8rem 1.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border-radius: 0;
  position: relative;
}

.dropdown-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--primary-color);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.dropdown-item:hover::before,
.dropdown-item.active::before {
  transform: scaleY(1);
}

.dropdown-item:hover,
.dropdown-item.active {
  background: linear-gradient(90deg, var(--light-blue), transparent);
  color: var(--primary-color);
  padding-left: 2rem;
}

.dropdown-item i {
  margin-right: 0.8rem;
  width: 20px;
  color: var(--primary-color);
}

/* Hero Section */
.hero-section {
  min-height: 100vh;
  background: linear-gradient(135deg,
      var(--primary-darker) 0%,
      var(--primary-color) 30%,
      var(--primary-light) 70%,
      var(--secondary-blue) 100%);
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("/placeholder.svg?height=1080&width=1920") center / cover;
  opacity: 0.1;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 61, 130, 0.9) 0%, rgba(0, 42, 92, 0.8) 50%, rgba(0, 86, 179, 0.7) 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
}

.hero-image {
  position: relative;
  z-index: 3;
}

.floating-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
  text-align: center;
  color: var(--white);
  animation: none;
  box-shadow: var(--shadow-xl);
}

.floating-card-2 {
  background: rgba(255, 107, 53, 0.15);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  color: var(--white);
  position: absolute;
  top: 20%;
  right: 2%;
  animation: none;
  text-align: center;
}

.floating-card-3 {
  background: rgba(23, 162, 184, 0.15);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(23, 162, 184, 0.3);
  border-radius: var(--border-radius);
  padding: 1.2rem;
  color: var(--white);
  position: absolute;
  bottom: 30%;
  left: 5%;
  animation: none;
  text-align: center;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  25% {
    transform: translateY(-10px) rotate(1deg);
  }

  50% {
    transform: translateY(-20px) rotate(0deg);
  }

  75% {
    transform: translateY(-10px) rotate(-1deg);
  }
}

/* Stats Section */
.stats-section {
  background: linear-gradient(135deg, var(--light-blue) 0%, var(--white) 100%);
  padding: 4rem 0;
  position: relative;
}

.stat-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 61, 130, 0.1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.stat-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-xl);
}

.stat-number {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 1.1rem;
  color: var(--text-light);
  font-weight: 500;
}

/* Services Section Enhanced */
.services-section {
  padding: 5rem 0;
  background: linear-gradient(135deg, var(--white) 0%, var(--bg-light) 100%);
}

.service-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.4s ease;
  border: 1px solid #e9ecef;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.service-detail-card {
  text-align: center;
}

.service-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  transform: translateY(100%);
  transition: transform 0.4s ease;
  z-index: 1;
}

.service-card:hover::before {
  transform: translateY(0);
}

.service-card:hover {
  transform: translateY(-15px);
  box-shadow: var(--shadow-xl);
  color: var(--white);
}

.service-card:hover .service-icon,
.service-card:hover h4,
.service-card:hover p,
.service-card:hover .btn {
  position: relative;
  z-index: 2;
  color: var(--white);
}

.service-card:hover .btn {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.service-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  color: var(--white);
  font-size: 2.5rem;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.service-card:hover .service-icon {
  background: var(--accent-color);
  transform: scale(1.1);
}

/* Gallery Section */
.gallery-section {
  padding: 5rem 0;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: var(--white);
}

.gallery-item {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  margin-bottom: 2rem;
}

.gallery-item:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-xl);
}

.gallery-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: all 0.3s ease;
}

.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 61, 130, 0.8), rgba(255, 107, 53, 0.8));
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay h5 {
  color: var(--white);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.gallery-overlay p {
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  padding: 0 1rem;
}

/* Testimonials Section */
.testimonials-section {
  padding: 5rem 0;
  background: var(--bg-light);
}

.testimonial-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
  margin-bottom: 2rem;
}

.testimonial-card::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 20px;
  font-size: 4rem;
  color: var(--primary-color);
  font-family: serif;
}

.testimonial-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.testimonial-text {
  font-style: italic;
  margin-bottom: 1.5rem;
  color: var(--text-dark);
  line-height: 1.8;
}

.testimonial-author {
  display: flex;
  align-items: center;
}

.author-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.5rem;
  margin-right: 1rem;
}

.author-info h6 {
  margin: 0;
  color: var(--primary-color);
  font-weight: 600;
}

.author-info small {
  color: var(--text-light);
}

/* Process Section */
.process-section {
  padding: 5rem 0;
  background: linear-gradient(135deg, var(--white) 0%, var(--light-blue) 100%);
}

.process-step {
  text-align: center;
  position: relative;
  margin-bottom: 3rem;
}

.process-number {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--white);
  font-size: 2rem;
  font-weight: 700;
  position: relative;
  z-index: 2;
}

.process-step::after {
  content: "";
  position: absolute;
  top: 40px;
  left: 50%;
  width: 2px;
  height: 100px;
  background: linear-gradient(180deg, var(--primary-color), transparent);
  transform: translateX(-50%);
  z-index: 1;
}

.process-step:last-child::after {
  display: none;
}

.process-title {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Feature Items Enhanced */
.feature-item {
  text-align: center;
  padding: 2rem 1rem;
  transition: all 0.3s ease;
  border-radius: var(--border-radius);
}

.feature-item:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.1);
}

.feature-item i {
  display: block;
  margin-bottom: 1rem;
}

/* Contact Enhancements */
.contact-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.contact-info-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.contact-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.5rem;
  color: var(--white);
  flex-shrink: 0;
  font-size: 1.5rem;
}

/* Page Header Enhanced */
.page-header {
  background: linear-gradient(135deg,
      var(--primary-darker) 0%,
      var(--primary-color) 30%,
      var(--primary-light) 70%,
      var(--secondary-blue) 100%);
  padding: 150px 0 100px;
  position: relative;
  overflow: hidden;
  margin-top: 0;
}

.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("/placeholder.svg?height=600&width=1920") center / cover;
  opacity: 0.1;
}

/* Form Enhancements */
.form-control,
.form-select {
  border-radius: var(--border-radius-sm);
  border: 2px solid #e9ecef;
  padding: 1rem 1.2rem;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 61, 130, 0.25);
  transform: translateY(-2px);
}

/* Animations */
.animate-fade-in {
  animation: fadeIn 1s ease-out;
}

.animate-fade-in-delay {
  animation: fadeIn 1s ease-out 0.3s both;
}

.animate-fade-in-delay-2 {
  animation: fadeIn 1s ease-out 0.6s both;
}

.animate-slide-in {
  animation: slideIn 1s ease-out 0.4s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-section {
    text-align: center;
    padding: 2rem 0;
  }

  .floating-card-2,
  .floating-card-3 {
    display: none;
  }

  .stat-number {
    font-size: 2.5rem;
  }

  .service-icon {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }

  .process-step::after {
    height: 50px;
  }

  .gallery-item img {
    height: 200px;
  }
}

@media (max-width: 576px) {
  .custom-navbar {
    padding: 0.5rem 0;
  }

  .floating-card {
    padding: 1.5rem;
    margin-top: 2rem;
  }

  .page-header {
    padding: 120px 0 80px;
  }

  .stat-card,
  .service-card,
  .testimonial-card {
    padding: 1.5rem;
  }
}

/* Utility Classes */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.bg-gradient-secondary {
  background: linear-gradient(135deg, var(--secondary-blue) 0%, var(--accent-blue) 100%);
}

.text-shadow {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.border-radius-lg {
  border-radius: var(--border-radius);
}

.shadow-custom {
  box-shadow: var(--shadow);
}

.shadow-custom-lg {
  box-shadow: var(--shadow-lg);
}

.shadow-custom-xl {
  box-shadow: var(--shadow-xl);
}

.navbar-brand .logo {
  height: 80px;
  width: auto;
}

body {
  padding-top: var(--navbar-h);
}

:root {
  --navbar-h: 96px;
}

/* desktop */
@media (max-width: 991.98px) {
  :root {
    --navbar-h: 64px;
  }
}

@media (max-width: 991.98px) {
  .custom-navbar .navbar-collapse {
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary-color) 50%, var(--primary-dark) 100%);
    padding: .75rem 1rem;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
  }
}

@media (max-width: 576px) {
  .navbar-brand .logo {
    height: 56px;
  }
}

/* ======= Mobile/Tablet: usa Offcanvas, non il mega-menu ======= */
@media (max-width: 991.98px) {

  /* nascondi il dropdown originale sui device piccoli */
  .dropdown-mega>.dropdown-menu.mega-menu {
    display: none !important;
  }
}

/* Offcanvas “Servizi” (creato via JS) */
#offcanvasServizi.offcanvas {
  /* piena larghezza su mobile */
  --bs-offcanvas-width: 100vw;
}

#offcanvasServizi .offcanvas-header {
  background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary-color) 50%, var(--primary-dark) 100%);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
}

#offcanvasServizi .offcanvas-title {
  font-weight: 700;
}

#offcanvasServizi .offcanvas-body {
  padding: 1rem 1rem 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* titoli/sezioni dentro l’offcanvas (riuso le tue classi) */
#offcanvasServizi .mega-title {
  display: block;
  font-size: 1.05rem;
  margin: .75rem 0 .25rem;
  padding-top: .5rem;
  border-top: 1px solid #eee;
}

#offcanvasServizi .mega-list {
  display: block !important;
  /* tutte le voci visibili */
  padding-left: .25rem;
}

#offcanvasServizi .mega-list .dropdown-item {
  padding: .9rem .25rem;
  border-radius: 8px;
  border-bottom: 1px solid #f1f1f1;
}

#offcanvasServizi .mega-list .dropdown-item:last-child {
  border-bottom: 0;
}

/* niente barra verticale animata su mobile */
#offcanvasServizi .dropdown-item::before {
  display: none;
}

/* === Filtri a capo (no scroll orizzontale) === */
.filters-chips {
  display: flex;
  /* da grid → flex */
  flex-wrap: wrap;
  /* consenti a capo su più righe */
  gap: .5rem .5rem;
  /* spaziatura tra pillole */
  overflow: visible;
  /* niente scroll orizzontale */
  padding-bottom: 0;
  /* rimuovi padding usato per lo scroll */
  scroll-snap-type: none;
  /* disattiva snap */
}

.filters-chips .btn {
  scroll-snap-align: unset;
  /* non serve più */
  white-space: nowrap;
  /* evita che il testo vada a capo dentro la pillola */
  padding: .5rem .85rem;
  border-radius: 999px;
}

/* Layout un po' più “arioso” su telefoni stretti */
@media (max-width: 576px) {
  .filters-bar {
    padding: .75rem .75rem .75rem;
  }

  .filters-chips {
    gap: .5rem .5rem;
  }

  /* opzionale: fai occupare tutta la riga al bottone "Azzera" */
  .filters-chips #clearFilters {
    margin-left: auto;
    /* spinge "Azzera" a destra dell’ultima riga */
  }
}

/* ==========================================================
   DESKTOP ONLY – FIX MEGA MENU HOVER
   NON TOCCA IL RESTO DEL SITO
   ========================================================== */
@media (min-width: 992px) {

  /* il parent deve contenere il dropdown */
  .dropdown-mega {
    position: static;
  }

  /* mega menu full width, senza gap */
  .dropdown-mega > .dropdown-menu.mega-menu {
    width: 100%;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 0;          /* <-- ELIMINA IL GAP */
    padding-top: 1.5rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
  }

  /* hover stabile: resta aperto finché sei sopra link O menu */
  .dropdown-mega:hover > .dropdown-menu,
  .dropdown-mega > .dropdown-menu:hover {
    display: block;
  }

  /* area invisibile di sicurezza (anti-sparizione) */
  .dropdown-mega > .dropdown-menu::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
  }

}
