/* =========================================================
   FITARCO SARDEGNA - DESIGN SYSTEM MODERNO v2.0
   Stile professionale e accessibile per tutte le pagine
   Palette: Blu dominante, Bianco, Giallo, Rosso (accenti)
   ========================================================= */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  color: #1e293b;
  background-color: #ffffff;
  overflow-x: hidden;
}

/* ===/* Assicura che tutti i testi nel footer abbiano contrasto sufficiente */
.footer-modern p,
.footer-modern div:not(.footer-brand),
.footer-modern h4 {
  color: #e2e8f0 !important;
}

.footer-address-text {
  color: #e2e8f0 !important;
  font-weight: 400 !important;
}

/* Specificità molto alta per l'indirizzo problematico */
.footer-modern .footer-contact-item p,
.footer-modern .footer-contact-item div,
.footer-modern .footer-address-text {
  color: #ffffff !important;
  background: none !important;
  text-shadow: none !important;
}

/* Titoli del footer con contrasto massimo */
.footer-modern .col-lg-3 h4,
.footer-modern .col-md-6 h4,
.footer-modern h4 {
  color: #ffffff !important;
  font-weight: 600 !important;
  text-shadow: none !important;
  background: none !important;
}

/* === CSS VARIABILI === */
:root {
  /* Colori Principali - Scala Blu */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  --primary-950: #172554;

  /* Colori Accento */
  --accent-yellow: #fbbf24;
  --accent-yellow-dark: #f59e0b;
  --accent-red: #ef4444;
  --accent-red-dark: #dc2626;

  /* Neutral Scale */
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #64748b; /* Migliorato per contrasto */
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;

  /* Semantici */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b; /* Colore più scuro per miglior contrasto */
  --text-inverse: #ffffff;

  /* Sfondi */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-accent: #eff6ff;
  --bg-dark: var(--primary-900);

  /* Bordi */
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;
  --border-accent: var(--primary-200);

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.25rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;
  --space-4xl: 2.5rem;
  --space-5xl: 3rem;
  --space-6xl: 4rem;

  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
  --gradient-accent: linear-gradient(135deg, var(--accent-yellow) 0%, var(--accent-yellow-dark) 100%);
  --gradient-hero: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-700) 50%, var(--primary-500) 100%);
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: 1.2;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: var(--font-extrabold);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.875rem);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

p {
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

/* === LAYOUT UTILITIES === */
.container-modern {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section-padding {
  padding: var(--space-6xl) 0;
}

/* === GRID SYSTEM === */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-2xl);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-2xl);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-xl);
}

/* === HEADER MODERNO === */
.header-modern {
  background: var(--gradient-hero);
  color: var(--text-inverse);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) 0;
  min-height: 80px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-inverse);
  text-decoration: none;
}

.header-brand:hover {
  color: var(--accent-yellow);
  text-decoration: none;
}

.header-logo {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
}

.header-logo:hover {
  transform: scale(1.05);
}

/* Navigazione Desktop */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-desktop a {
  color: var(--text-inverse);
  font-weight: var(--font-medium);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  position: relative;
}

.nav-desktop a:hover,
.nav-desktop a.active {
  color: var(--accent-yellow);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.nav-desktop a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent-yellow);
  border-radius: var(--radius-full);
}

/* Menu Mobile */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-inverse);
  font-size: var(--text-2xl);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-mobile {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: var(--gradient-hero);
  z-index: 60;
  padding: var(--space-3xl) var(--space-lg);
  transform: translateX(-100%);
  transition: transform var(--transition-base);
}

.nav-mobile.open {
  display: block;
  transform: translateX(0);
}

.nav-mobile-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  background: none;
  border: none;
  color: var(--text-inverse);
  font-size: var(--text-2xl);
  cursor: pointer;
}

.nav-mobile-list {
  list-style: none;
  padding: var(--space-3xl) 0;
}

.nav-mobile-list li {
  margin-bottom: var(--space-lg);
}

.nav-mobile-list a {
  color: var(--text-inverse);
  font-size: var(--text-xl);
  font-weight: var(--font-medium);
  display: block;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
}

.nav-mobile-list a:hover,
.nav-mobile-list a.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-yellow);
  text-decoration: none;
}

/* === HERO SECTION === */
.hero-modern {
  background: var(--gradient-hero);
  color: var(--text-inverse);
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  display: flex;
  align-items: center;
}

.hero-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  opacity: 0.4;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

/* Miglioramento contrasto bottoni nella sezione hero */
.hero-modern .btn-primary {
  background: linear-gradient(135deg, var(--accent-yellow) 0%, var(--accent-yellow-dark) 100%);
  color: var(--neutral-900);
  font-weight: var(--font-semibold);
  border: 2px solid var(--accent-yellow-dark);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
}

.hero-modern .btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-yellow-dark) 0%, #d97706 100%);
  color: var(--neutral-900);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(251, 191, 36, 0.4);
  border-color: #d97706;
}

.hero-modern .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-inverse);
  border: 2px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.hero-modern .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-inverse);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: var(--font-extrabold);
  margin-bottom: var(--space-xl);
  background: linear-gradient(135deg, var(--text-inverse) 0%, var(--accent-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3xl);
  color: rgba(255, 255, 255, 0.9);
}

/* === BUTTONS === */
.btn-modern {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-2xl);
  border-radius: var(--radius-lg);
  font-weight: var(--font-semibold);
  text-decoration: none;
  transition: var(--transition-base);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  color: var(--text-inverse);
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--primary-600);
  border: 2px solid var(--primary-600);
}

.btn-secondary:hover {
  background: var(--primary-50);
  color: var(--primary-700);
  text-decoration: none;
}

.btn-accent {
  background: var(--gradient-accent);
  color: var(--neutral-900);
}

.btn-accent:hover {
  transform: translateY(-2px);
  color: var(--neutral-900);
  text-decoration: none;
}

.btn-sm {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-xl) var(--space-3xl);
  font-size: var(--text-lg);
}

/* === CARDS === */
.card-modern {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  height: 100%;
  display: flex;
  flex-direction: column;
}

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

.card-modern h3 {
  color: var(--primary-700);
  margin-bottom: var(--space-md);
}

.card-modern p {
  flex-grow: 1;
  margin-bottom: var(--space-lg);
}

.card-accent {
  position: relative;
}

.card-accent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
}

/* === BADGES === */
.badge-modern {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--primary-100);
  color: var(--primary-700);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-full);
}

.badge-accent {
  background: var(--accent-yellow);
  color: var(--neutral-900);
}

.badge-red {
  background: var(--accent-red);
  color: var(--text-inverse);
}

/* === SECTIONS === */
.section-modern {
  padding: var(--space-6xl) 0;
}

.section-accent {
  background: var(--bg-accent);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-5xl);
}

.section-subtitle {
  color: var(--primary-600);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-md);
}

.section-title {
  margin-bottom: var(--space-lg);
}

.section-description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* === FOOTER === */
.footer-modern {
  background: var(--bg-dark);
  color: var(--text-inverse);
  padding: var(--space-6xl) 0 var(--space-3xl);
}

.footer-modern * {
  color: inherit;
}

.footer-modern h4 {
  color: #ffffff !important;
}

.footer-modern p,
.footer-modern div:not(.footer-brand),
.footer-modern span,
.footer-modern a {
  color: #e2e8f0 !important;
}

.footer-content {
  margin-bottom: var(--space-3xl);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.footer-logo {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-links a {
  color: #e2e8f0; /* Colore più chiaro per miglior contrasto */
  font-size: var(--text-sm);
  transition: var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-yellow);
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.2); /* Bordo più visibile */
  padding-top: var(--space-xl);
  text-align: center;
  color: #e2e8f0; /* Colore più chiaro per miglior contrasto */
  font-size: var(--text-sm);
}

/* Footer additional styles for better contrast */
.footer-text {
  color: #e2e8f0;
  opacity: 0.9;
}

.footer-social-link {
  color: #e2e8f0;
  transition: var(--transition-fast);
}

.footer-social-link:hover {
  color: var(--accent-yellow);
  transform: translateY(-2px);
}

.footer-contact-item {
  color: #e2e8f0;
  margin-bottom: var(--space-sm);
}

.footer-contact-item p {
  color: #e2e8f0 !important;
  margin-bottom: var(--space-sm);
}

.footer-contact-item div {
  color: #e2e8f0;
}

.footer-contact-link {
  color: #e2e8f0;
  transition: var(--transition-fast);
}

.footer-contact-link:hover {
  color: var(--accent-yellow);
  text-decoration: none;
}

/* Assicura che tutti i testi nel footer abbiano contrasto sufficiente */
.footer-modern p,
.footer-modern div,
.footer-modern span {
  color: #e2e8f0;
}

.footer-modern h4 {
  color: #ffffff !important;
  font-weight: 600;
}

.footer-address-text {
  color: #e2e8f0 !important;
  line-height: 1.5;
  font-size: var(--text-sm);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .nav-desktop {
    display: none;
  }

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

  .container-modern,
  .container-wide {
    padding: 0 var(--space-md);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--space-lg) !important;
  }

  .hero-modern {
    min-height: 60vh;
    text-align: center;
  }

  .section-modern {
    padding: var(--space-4xl) 0;
  }
}

@media (max-width: 480px) {
  .header-content {
    padding: var(--space-md) 0;
  }

  .header-brand {
    font-size: var(--text-lg);
  }

  .header-logo {
    width: 40px;
    height: 40px;
  }

  .hero-modern {
    min-height: 50vh;
  }

  .btn-modern {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--text-sm);
  }

  .card-modern {
    padding: var(--space-lg);
  }
}

/* === UTILITIES === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mb-3xl { margin-bottom: var(--space-3xl); }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }

/* === ANIMAZIONI === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeInUp {
  animation: fadeInUp 0.6s ease both;
}

/* === FOCUS STATES === */
*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Contrasto garantito su sfondi con gradiente */
.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6,
.card-header i,
.card-header span,
[style*="gradient"] h1,
[style*="gradient"] h2,
[style*="gradient"] h3,
[style*="gradient"] h4,
[style*="gradient"] h5,
[style*="gradient"] h6,
[style*="gradient"] i,
[style*="gradient"] span {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Miglioramenti per form responsive */
@media (max-width: 768px) {
  .grid-2[style*="gap"] {
    gap: var(--space-md) !important;
  }

  input, textarea, select {
    font-size: 16px !important; /* Previene lo zoom su iOS */
  }

  .card-modern {
    margin-bottom: var(--space-lg) !important;
  }
}
