/* =========================================
   1. VARIABILI TEMA SCURO (DARK MODE)
   ========================================= */
:root {
  --primary-blue: #38bdf8; /* Azzurro luminoso per il dark mode */
  --accent-orange: #ff6600;
  --bg-color: #0f172a; /* Sfondo principale (Blu notte scurissimo) */
  --card-bg: #1e293b; /* Sfondo delle schede */
  --text-main: #f8fafc; /* Testo bianco scuro/ghiaccio */
  --text-muted: #94a3b8; /* Testo grigio per dettagli */
  --border-color: #334155;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
}

/* =========================================
   2. HEADER E NAVBAR (Effetto Vetro Scuro)
   ========================================= */
header {
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}

.navbar { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; }
.logo-container { display: flex; align-items: center; text-decoration: none; }
.logo-img { height: 48px; border-radius: 6px; object-fit: contain; }

.nav-links { display: flex; gap: 25px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text-main); font-weight: 600; font-size: 0.95rem; transition: color 0.3s; }
.nav-links a:hover { color: var(--accent-orange); }

/* Menu a tendina Dark */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
  display: none; position: absolute; background-color: var(--card-bg);
  min-width: 180px; box-shadow: 0px 10px 30px rgba(0,0,0,0.5);
  border-radius: 12px; overflow: hidden; z-index: 1; top: 100%; left: 0;
  border: 1px solid var(--border-color);
}
.dropdown-content a { color: var(--text-main); padding: 12px 18px; text-decoration: none; display: block; font-weight: 500; font-size: 0.95rem; transition: 0.2s; }
.dropdown-content a:hover { background-color: #334155; color: var(--accent-orange); }
.dropdown:hover .dropdown-content { display: block; animation: fadeIn 0.3s ease-in-out; }

.btn-login {
  background-color: transparent; border: 2px solid var(--primary-blue);
  color: var(--primary-blue) !important; padding: 8px 20px; border-radius: 50px; transition: all 0.3s;
}
.btn-login:hover { background-color: var(--primary-blue); color: #fff !important; box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3); }

/* =========================================
   3. CAROSELLO HOME PAGE (Ulteriormente Stretto: 320px)
   ========================================= */
.hero-carousel { position: relative; width: 100%; height: 320px; overflow: hidden; background: #000; border-bottom: 1px solid var(--border-color); }
.carousel-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.8s ease-in-out; }
.carousel-slide.active { opacity: 1; z-index: 1; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; opacity: 0.45; }
.carousel-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: white; width: 85%; max-width: 900px; z-index: 2; }
.carousel-content h2 { font-size: 2.8rem; margin-bottom: 8px; text-transform: uppercase; color: var(--accent-orange); font-weight: 900; text-shadow: 0 4px 10px rgba(0,0,0,0.8); }
.carousel-content p { font-size: 1.15rem; line-height: 1.4; font-weight: 500; text-shadow: 0 2px 6px rgba(0,0,0,0.8); margin: 0; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.4); color: white; border: 1px solid rgba(255,255,255,0.2); padding: 10px 15px; cursor: pointer; z-index: 3; font-size: 1.5rem; transition: 0.3s; border-radius: 8px; backdrop-filter: blur(5px); }
.carousel-btn:hover { background: var(--accent-orange); border-color: var(--accent-orange); }
.prev-btn { left: 20px; }
.next-btn { right: 20px; }

/* =========================================
   4. SEZIONI TESTO E BANNER
   ========================================= */
.sezione-testo { max-width: 900px; margin: 0 auto 30px auto; padding: 40px 20px 0 20px; text-align: center; }
.sezione-testo h2 { color: var(--primary-blue); font-size: 2.2rem; margin-bottom: 15px; }
.sezione-testo p { font-size: 1.1rem; color: var(--text-muted); line-height: 1.6; }

/* =========================================
   5. GRIGLIA VEICOLI E SCHEDE (Dark Mode)
   ========================================= */
.sezione-veicoli { max-width: 1200px; margin: 0 auto 60px auto; padding: 0 20px; min-height: 500px; }
.car-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 35px; }

.car-card {
  border: 1px solid var(--border-color); border-radius: 16px; background: var(--card-bg);
  text-align: center; position: relative; padding: 30px 20px 25px 20px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); display: flex; flex-direction: column; align-items: center;
}
.car-card:hover { transform: translateY(-8px); box-shadow: 0 15px 35px rgba(0,0,0,0.5); border-color: var(--primary-blue); }

.badge-dynamic { position: absolute; top: -16px; right: 20px; padding: 6px 14px; color: white; font-size: 0.85rem; font-weight: 800; border-radius: 30px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); z-index: 10; }
.car-img { width: 100%; height: 180px; object-fit: contain; margin-bottom: 20px; transition: 0.5s; filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3)); }
.car-card:hover .car-img { transform: scale(1.08); }

.car-info h4 { font-size: 1.5rem; color: var(--text-main); margin: 0 0 8px 0; font-weight: 800; }
.car-info p { margin: 5px 0; font-size: 1.05rem; color: var(--text-muted); }
.terms-line { display: flex; justify-content: center; gap: 15px; font-size: 0.9rem; margin-top: 10px; margin-bottom: 25px; color: var(--text-muted); font-weight: 500; }

.btn-offerta {
  display: inline-block; background: transparent; border: 2px solid var(--primary-blue); color: var(--primary-blue);
  padding: 10px 30px; text-decoration: none; font-weight: bold; border-radius: 50px; transition: 0.3s;
}
.btn-offerta:hover { background: var(--primary-blue); color: #fff; box-shadow: 0 4px 15px rgba(56,189,248,0.3); transform: translateY(-2px); }

/* =========================================
   6. BOTTONI TARGET
   ========================================= */
.toggle-container { display: flex; justify-content: center; margin-bottom: 40px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 50px; padding: 5px; width: fit-content; margin-left: auto; margin-right: auto; }
.toggle-btn { padding: 12px 35px; border: none; background: transparent; color: var(--text-muted); font-weight: bold; cursor: pointer; font-size: 1.05rem; border-radius: 50px; transition: 0.3s; }
.toggle-btn.active { background-color: var(--primary-blue); color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

/* =========================================
   7. WIDGET FLUTTUANTI (LinkedIn incluso) E CHATBOT
   ========================================= */
.floating-widgets { position: fixed; bottom: 30px; right: 30px; display: flex; flex-direction: column; gap: 15px; z-index: 1000; }
.widget-btn { width: 55px; height: 55px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(0,0,0,0.5); cursor: pointer; transition: 0.3s; text-decoration: none; font-size: 1.8rem; }
.widget-btn:hover { transform: scale(1.1); }
.whatsapp-btn { background-color: #25D366; }
.linkedin-btn { background-color: #0077b5; }
.hiry-btn { background-color: var(--primary-blue); color: white; border: 2px solid var(--accent-orange); }

.chat-window { position: fixed; bottom: 100px; right: 30px; width: 340px; background: var(--card-bg); border-radius: 16px; box-shadow: 0 15px 40px rgba(0,0,0,0.5); display: none; flex-direction: column; z-index: 1000; overflow: hidden; border: 1px solid var(--border-color); }
.chat-header { background: #0b1120; color: var(--text-main); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; border-bottom: 2px solid var(--accent-orange); }
.chat-body { padding: 20px; height: 300px; overflow-y: auto; background: var(--bg-color); font-size: 0.95rem; }
.chat-footer { padding: 15px; background: var(--card-bg); border-top: 1px solid var(--border-color); }
.chat-footer input { width: 100%; padding: 12px; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); border-radius: 30px; outline: none; }
.chat-footer input:focus { border-color: var(--primary-blue); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =========================================
   8. OTTIMIZZAZIONE MOBILE
   ========================================= */
@media (max-width: 768px) {
  .navbar { flex-direction: column; gap: 15px; padding: 15px 10px; }
  .nav-links { flex-wrap: wrap; justify-content: center; gap: 12px; }
  .hero-carousel { height: 250px; }
  .carousel-content h2 { font-size: 1.8rem; margin-bottom: 5px;}
  .carousel-content p { font-size: 0.95rem; }
  .sezione-testo { padding: 20px 15px 0 15px; }
  .sezione-testo h2 { font-size: 1.6rem; }
  .car-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
  .floating-widgets { bottom: 20px; right: 20px; }
  .widget-btn { width: 50px; height: 50px; font-size: 1.4rem; }
  .chat-window { right: 20px; bottom: 85px; width: calc(100% - 40px); }
}

/* =========================================
   9. RIMOZIONE FRECCETTE CAMPI NUMERICI
   ========================================= */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type="number"] {
  -moz-appearance: textfield; /* Per Firefox */
}

/* =========================================
   10. BARRA DI RICERCA VEICOLI
   ========================================= */
.ricerca-container { 
  max-width: 600px; 
  margin: 0 auto 30px auto; 
  display: flex; 
  padding: 0 20px; 
}
.ricerca-container input { 
  width: 100%; 
  padding: 16px 25px; 
  border-radius: 50px; 
  border: 1px solid var(--border-color); 
  background: var(--card-bg); 
  color: var(--text-main); 
  font-size: 1.1rem; 
  outline: none; 
  transition: 0.3s; 
  box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
}
.ricerca-container input:focus { 
  border-color: var(--primary-blue); 
  box-shadow: 0 4px 20px rgba(56,189,248,0.2); 
}
.ricerca-container input::placeholder {
  color: var(--text-muted);
}