/* ==========================================================================
   Elettrotech S.r.l. - Impianti Elettrici, Domotica KNX, F-GAS, FER & Roger Prime
   Custom Stylesheet (Light Engineering Aesthetic: Pure White & Slate Antracite)
   Autore: Senior Frontend Developer
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Root Variables & Typography
   -------------------------------------------------------------------------- */
:root {
  --color-primary: #ea580c;        /* Arancio industriale aziendale */
  --color-primary-light: #f97316;  /* Arancio d'accento per hover ed evidenze */
  --color-primary-dark: #c2410c;   /* Arancio scuro per bordi ed enfasi */
  --color-slate-950: #09090b;      /* Nero grafite tecnico profondo (zero riflessi blu) */
  --color-slate-900: #18181b;      /* Grigio scuro antracite primario (neutro) */
  --color-slate-800: #27272a;      /* Grigio antracite secondario */
  --color-slate-700: #3f3f46;      /* Grigio tecnico medio per icone e bordi scuri */
  --color-slate-600: #52525b;      /* Grigio neutro per testi descrittivi ad alto contrasto */
  --color-slate-500: #71717a;      /* Grigio neutro per note e metadati */
  --color-slate-400: #a1a1aa;      /* Grigio chiaro per placeholder e icone secondarie */
  --color-slate-300: #d4d4d8;      /* Bordo neutro attivo */
  --color-slate-200: #e4e4e7;      /* Bordo standard pulito per card */
  --color-slate-100: #f4f4f5;      /* Grigio tecnico per superfici secondarie */
  --color-slate-50: #f9fafb;       /* Grigio chiarissimo per sfondi alternati */
  --color-white: #ffffff;          /* Bianco puro */
  --header-height: 80px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  overflow-x: hidden;
  position: relative;
  width: 100%;
  max-width: 100%;
  background-color: #ffffff;
  color: var(--color-slate-900);
}

/* Le animazioni AOS (fade-left / fade-right) partono fuori schermo: senza questo
   allargano il viewport su mobile e spingono fuori dallo schermo menu e header fissi. */
main,
footer {
  overflow-x: clip;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   2. Custom Scrollbar (Pulita, Chiara & Dettaglio Arancio)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 9px;
}
::-webkit-scrollbar-track {
  background: var(--color-slate-100);
}
::-webkit-scrollbar-thumb {
  background: var(--color-slate-300);
  border-radius: 6px;
  border: 2px solid var(--color-slate-100);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* --------------------------------------------------------------------------
   3. Navigation Bar (Bianco Cristallino con Bordo Tecnico)
   -------------------------------------------------------------------------- */
.glass-nav {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-slate-200);
  transition: all 0.3s ease;
}

.glass-nav.scrolled {
  background: #ffffff;
  box-shadow: 0 4px 18px -4px rgba(15, 23, 42, 0.08);
  border-bottom-color: var(--color-slate-300);
}

/* --------------------------------------------------------------------------
   4. Engineering Catalogue Cards (Bordi netti, ombre morbide ed eleganti)
   -------------------------------------------------------------------------- */
.glass-card,
.light-card {
  background: #ffffff;
  border: 1px solid var(--color-slate-200);
  border-radius: 1rem;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover,
.light-card:hover {
  background: #ffffff;
  border-color: rgba(234, 88, 12, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.08), 0 4px 8px -4px rgba(15, 23, 42, 0.04);
}

/* --------------------------------------------------------------------------
   5. Typography Accents (Arancio Industriale Pulito)
   -------------------------------------------------------------------------- */
.text-gradient-orange {
  color: var(--color-primary);
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --------------------------------------------------------------------------
   6. Button Shimmer (Micro-Interazione Elegante)
   -------------------------------------------------------------------------- */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}

.btn-shimmer::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 20%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 80%
  );
  transform: rotate(30deg) translateX(-100%);
  transition: transform 0.75s ease;
}

.btn-shimmer:hover::after {
  transform: rotate(30deg) translateX(100%);
}

/* --------------------------------------------------------------------------
   7. Accordion (FAQ Section - Stile Scheda Tecnica)
   -------------------------------------------------------------------------- */
.faq-item {
  background: #ffffff;
  border: 1px solid var(--color-slate-200);
  border-radius: 0.875rem;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.faq-item.active {
  border-color: rgba(234, 88, 12, 0.4);
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.06);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
}

.faq-item.active .faq-answer {
  max-height: 280px;
  opacity: 1;
}

.faq-item.active .faq-chevron {
  transform: rotate(180deg);
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   8. Floating Action Buttons (WhatsApp / Quick Call / Back to Top)
   -------------------------------------------------------------------------- */
.floating-actions {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@media (max-width: 640px) {
  .floating-actions {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    right: calc(14px + env(safe-area-inset-right, 0px));
    gap: 8px;
  }
}

.btn-floating {
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.18);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@media (max-width: 640px) {
  .btn-floating {
    width: 44px;
    height: 44px;
  }
}

.btn-floating:hover {
  transform: scale(1.08) translateY(-2px);
}

.btn-whatsapp {
  background-color: #25d366;
  color: #ffffff;
}

.btn-whatsapp:hover {
  box-shadow: 0 10px 22px -4px rgba(37, 211, 102, 0.45);
}

.btn-call {
  background-color: var(--color-primary);
  color: #ffffff;
}

.btn-call:hover {
  background-color: var(--color-primary-dark);
  box-shadow: 0 10px 22px -4px rgba(234, 88, 12, 0.45);
}

.btn-back-to-top {
  background-color: #ffffff;
  color: var(--color-slate-700);
  border: 1px solid var(--color-slate-300);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.btn-back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.btn-back-to-top:hover {
  background-color: var(--color-slate-900);
  color: #ffffff;
  border-color: var(--color-slate-900);
}

/* --------------------------------------------------------------------------
   9. Navigation Active State (ScrollSpy & Header Links)
   -------------------------------------------------------------------------- */
.nav-link {
  position: relative;
  color: var(--color-slate-600);
  transition: color 0.25s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.25s ease;
  border-radius: 2px;
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link.active {
  color: var(--color-primary) !important;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   10. Mobile Menu Transitions & Styling (Solido, Bianco, 100% Schermo)
   -------------------------------------------------------------------------- */
#mobile-menu {
  position: fixed !important;
  top: 80px !important;
  left: 0 !important;
  right: 0 !important;
  width: auto !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  background-color: #ffffff !important;
  background: #ffffff !important;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.05);
  z-index: 50;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

#mobile-menu *,
#mobile-menu *::before,
#mobile-menu *::after {
  box-sizing: border-box !important;
  max-width: 100% !important;
}

#mobile-menu.menu-closed {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

#mobile-menu.menu-open {
  transform: translateY(0);
  opacity: 1 !important;
  pointer-events: auto;
  visibility: visible;
}

/* Icona Facebook: Blu Ufficiale #1877F2 garantito */
.svg-facebook,
.svg-facebook path {
  fill: #1877F2 !important;
  color: #1877F2 !important;
}

/* Quando il menu mobile è aperto: nascondi elegantemente i tasti floating per massima pulizia */
body.mobile-menu-open .floating-actions {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.9);
}

/* --------------------------------------------------------------------------
   11. Notification Toast
   -------------------------------------------------------------------------- */
#toast-notification {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  transform: translateY(120%);
  opacity: 0;
}

#toast-notification.toast-visible {
  transform: translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   12. Hero Showcase Dots & Photo Flash Transition (Lampeggio / Scorrimento)
   -------------------------------------------------------------------------- */
.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background-color: #cbd5e1;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: none;
  padding: 0;
  outline: none;
  display: inline-block;
}

.hero-dot:hover {
  background-color: #94a3b8;
  transform: scale(1.2);
}

.hero-dot.active {
  background-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.28);
  transform: scale(1.2);
}

@keyframes photoFlashSwitch {
  0% {
    filter: brightness(2) contrast(1.15);
    opacity: 0.75;
  }
  30% {
    filter: brightness(1.3) contrast(1.05);
    opacity: 0.95;
  }
  100% {
    filter: brightness(1) contrast(1);
    opacity: 1;
  }
}

.photo-flash-active {
  animation: photoFlashSwitch 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
