:root {
  --primary: #7c3aed;
  --primary-soft: rgba(124, 58, 237, 0.1);
  --bg: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --surface: #f9fafb;
  --font-family: 'Inter', system-ui, sans-serif;
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

body.light-theme {
  --bg: #ffffff;
  --text-main: #111827;
  --surface: #f9fafb;
}

body:not(.light-theme) {
  --bg: #030712;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border: #1f2937;
  --surface: #111827;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  transition: background 0.3s ease;
}

/* TOP NAV */
.top-nav {
  position: fixed;
  top: 0; width: 100%;
  height: 80px;
  z-index: 1000;
  display: flex;
  align-items: center;
  backdrop-filter: blur(12px);
}
.nav-container {
  max-width: 1200px; width: 100%;
  margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-weight: 800; font-size: 1.4rem; letter-spacing: -1.5px; }
.brand .dot { color: var(--primary); }

.nav-right { display: flex; align-items: center; gap: 16px; }
.btn-nav-ghost {
  background: transparent; border: 1.5px solid var(--primary);
  color: var(--primary); padding: 8px 20px; border-radius: 99px;
  font-weight: 600; cursor: pointer; transition: 0.2s;
  font-size: 0.85rem;
}
.btn-nav-ghost:hover { background: var(--primary); color: white; }

.separator { width: 1px; height: 20px; background: var(--border); }

/* HERO SECTION */
.hero-section {
  height: 100vh;
  position: relative; /* Necessario per lo scroll-hint */
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 0 20px;
}
.hero-pretitle { color: var(--primary); font-size: 1.2rem; margin-bottom: -12px; font-weight: 400; }
.hero-title { font-size: clamp(4rem, 15vw, 8rem); font-weight: 800; letter-spacing: -5px; color: var(--primary); line-height: 1; }
.hero-subtitle { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 45px; font-weight: 400; max-width: 600px; }

.hero-actions { display: flex; gap: 24px; justify-content: center; width: 100%; }
.btn-hero-primary, .btn-hero-secondary {
  width: 200px; padding: 18px 0; border-radius: 99px;
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-hero-primary {
  background: var(--primary); color: white; border: none;
  box-shadow: 0 12px 24px -6px rgba(124, 58, 237, 0.4);
}
.btn-hero-primary:hover { transform: translateY(-4px); box-shadow: 0 20px 30px -8px rgba(124, 58, 237, 0.5); }

.btn-hero-secondary {
  background: white; color: var(--primary); border: 2.5px solid var(--primary);
}
.btn-hero-secondary:hover { background: var(--primary-soft); transform: translateY(-4px); }

/* SCROLL INDICATOR - SPOSTATO PIÙ IN BASSO */
.scroll-hint { 
  position: absolute; 
  bottom: 15px; /* Spostato molto vicino al fondo */
  text-align: center; 
  color: var(--text-muted); 
  font-size: 0.85rem; 
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.scroll-hint .arrow { 
  font-size: 1.2rem; 
  animation: bounce 2s infinite; 
  color: var(--primary);
}

/* CHAT SECTION */
.chat-section { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 100px 20px; background: var(--surface); }
/* Modifica questo in chatbot.css */
.chat-shell {
  width: 100%; max-width: 900px; height: 75vh;
  background: var(--bg); /* <-- Usa la variabile, non 'white' */
  border-radius: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-header { padding: 24px 32px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.status-dot { width: 9px; height: 9px; background: #22c55e; border-radius: 50%; display: inline-block; margin-right: 10px; box-shadow: 0 0 12px #22c55e; }
.badge-aws { font-size: 0.75rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 5px 14px; border-radius: 99px; }

.messages-area { flex: 1; padding: 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.bubble { max-width: 80%; padding: 16px 24px; border-radius: 24px; font-size: 1rem; line-height: 1.5; }

.bubble-user { 
  align-self: flex-end; 
  background: var(--primary); 
  color: white; 
  border-bottom-right-radius: 4px; 
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2); 
}
.chat-input-container {
  padding: 24px 32px 32px;
  background: var(--bg); /* <-- Cambia da 'white' a variabile */
  border-top: 1px solid var(--border);
}

.input-wrapper {
  /* In dark mode #f8fafc è troppo chiaro, meglio var(--surface) */
  background: var(--surface); 
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 6px 6px 26px;
  display: flex;
  align-items: center;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.input-wrapper:focus-within { border-color: var(--primary); background: white; box-shadow: 0 0 0 4px var(--primary-soft); }
.input-wrapper input { flex: 1; border: none; background: transparent; outline: none; font-size: 1rem; color: var(--text-main); font-weight: 400; }
.btn-send {
  width: 48px; height: 48px; background: var(--primary); color: white;
  border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.btn-send:hover { transform: scale(1.05); }

/* FOOTER */
.info-footer { padding: 100px 24px 48px; background: var(--bg); border-top: 1px solid var(--border); }
.footer-container { max-width: 1100px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 64px; margin-bottom: 64px; }
.footer-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--primary); margin-bottom: 24px; font-weight: 700; }
.footer-col p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.8; }
.status-badge { display: inline-flex; align-items: center; background: #dcfce7; color: #166534; padding: 7px 18px; border-radius: 99px; font-size: 0.85rem; font-weight: 600; }
.pulse-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; margin-right: 12px; animation: pulse 2s infinite; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 32px; text-align: center; color: #9ca3af; font-size: 0.85rem; }

@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-10px);} 60% {transform: translateY(-5px);} }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

.reveal { opacity: 0; transform: translateY(40px); transition: 1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

/* THEME TOGGLE */
.theme-toggle { width: 44px; height: 24px; background: var(--border); border-radius: 20px; border: none; cursor: pointer; position: relative; }
.toggle-icon { width: 18px; height: 18px; background: white; border-radius: 50%; position: absolute; left: 3px; top: 3px; transition: 0.3s; }
body:not(.light-theme) .toggle-icon { left: 23px; background: var(--primary); }

/* --- OTTIMIZZAZIONI MOBILE --- */
@media (max-width: 768px) {
  /* Hero Section: riduciamo il titolo "OCRAM" */
  .hero-title {
    font-size: clamp(3rem, 12vw, 5rem); /* Più piccolo rispetto all'originale */
    letter-spacing: -2px;
  }

  .hero-subtitle {
    font-size: 1rem;
    padding: 0 20px;
    margin-bottom: 30px;
  }

  /* Azioni Hero: pulsanti più flessibili */
  .hero-actions {
    flex-direction: column; /* Impilati verticalmente per risparmiare larghezza */
    align-items: center;
    gap: 12px;
  }

  .btn-hero-primary, .btn-hero-secondary {
    width: 80%; /* Non più fissi a 200px */
    padding: 14px 0;
  }

  /* --- CHAT SECTION --- */
  .chat-shell {
    height: 85vh; /* Più spazio alla chat su mobile */
    border-radius: 20px; /* Angoli meno pronunciati */
  }

  .messages-area {
    padding: 16px; /* Ridotto da 32px */
    gap: 12px;    /* Messaggi più vicini tra loro */
  }

  /* Bolle messaggi più piccole e sottili */
  .bubble {
    max-width: 90%;
    padding: 10px 16px; /* Ridotto il padding interno */
    font-size: 0.9rem;   /* Testo più piccolo come richiesto */
    border-radius: 18px;
  }

  .chat-input-container {
    padding: 16px; /* Meno spazio vuoto intorno all'input */
  }

  .input-wrapper {
    padding: 4px 4px 4px 16px;
  }
}