/* ===== HAUORA SANS ===== */
@font-face {
  font-family: "Hauora Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/hauora-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "Hauora Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/hauora-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "Hauora Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/hauora-sans-600.woff2") format("woff2");
}

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

:root {
  --red:    #FF3D2E;
  --pink:   #C0396A;
  --purple: #7B3BAF;
  --blue:   #4040FF;
  --gray-bg:    #F0F0F0;
  --gray-light: #E8E8E8;
  --gray-border:#D0D0D0;
  --gray-text:  #888;
  --text:       #1a1a1a;
  --font: "Hauora Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOP NAV (Info · Contatti) ===== */
.top-nav {
  position: fixed;
  top: 18px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 1px;
  z-index: 100;
}

/* ===== LANG SWITCHER ===== */
.lang-switcher {
  position: fixed;
  top: 18px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 1px;
  z-index: 100;
}
.lang-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 19px;
  letter-spacing: 0.04em;
  color: var(--gray-text);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 4px;
  transition: color 0.15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { color: var(--text); font-weight: 600; }
.lang-sep { font-size: 17px; color: var(--gray-border); }

/* ===== TOP INFO LINK ===== */
.top-info {
  position: fixed;
  top: 18px;
  right: 24px;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
  z-index: 100;
  cursor: pointer;
}
.top-info:hover { opacity: 0.6; }

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 20px;
  gap: 32px;
}

/* ===== LOGO ===== */
.logo-wrap { display: flex; justify-content: center; }
.logo {
  height: 90px;
  width: auto;
  object-fit: contain;
}

/* ===== NAV BUTTONS ===== */
.nav-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--gray-bg);
  border: none;
  border-radius: 10px;
  font-size: 17px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font);
}
.nav-btn:hover { background: var(--gray-light); }
.nav-btn svg { flex-shrink: 0; color: #555; }

/* ===== CHAT CONTAINER ===== */
.chat-container {
  width: 100%;
  max-width: 860px;
  background: var(--gray-bg);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Chat messages (initially hidden when empty) */
.chat-messages {
  padding: 16px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 340px;
  overflow-y: auto;
}
.chat-messages:empty { padding: 0; }

/* Message bubbles */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.bot  { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1.6;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--red), var(--blue));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.bot .msg-bubble {
  background: #fff;
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ===== INPUT AREA ===== */
.chat-input-area {
  display: flex;
  flex-direction: column;
}

#chatInput {
  width: 100%;
  padding: 18px 20px 8px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 22px;
  font-family: var(--font);
  color: var(--text);
  resize: none;
  line-height: 1.6;
}
#chatInput::placeholder { color: var(--gray-text); }

/* ===== TOOLBAR ===== */
.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--gray-border);
  background: var(--gray-light);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--gray-border);
  margin: 0 2px;
}

.toolbar-nav-btn {
  padding: 7px 14px;
  background: transparent;
  border: none;
  font-size: 15px;
  color: #555;
  cursor: pointer;
  font-family: var(--font);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.toolbar-nav-btn:hover { color: var(--text); background: rgba(0,0,0,0.05); }

.send-btn {
  padding: 7px 20px;
  background: transparent;
  border: none;
  font-size: 19px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  border-radius: 6px;
  transition: background 0.15s;
}
.send-btn:hover { background: rgba(0,0,0,0.07); }

/* ===== MARKDOWN nel bubble bot ===== */
.msg.bot .msg-bubble p        { margin: 0 0 8px; }
.msg.bot .msg-bubble p:last-child { margin-bottom: 0; }
.msg.bot .msg-bubble ul,
.msg.bot .msg-bubble ol       { padding-left: 20px; margin: 6px 0 10px; }
.msg.bot .msg-bubble li       { margin-bottom: 4px; }
.msg.bot .msg-bubble strong   { font-weight: 600; }
.msg.bot .msg-bubble em       { font-style: italic; }
.msg.bot .msg-bubble code     { background: #f0f0f0; border-radius: 4px; padding: 1px 5px; font-size: 0.9em; font-family: monospace; }
.msg.bot .msg-bubble h1,
.msg.bot .msg-bubble h2,
.msg.bot .msg-bubble h3       { font-weight: 600; margin: 10px 0 4px; }

.reset-btn {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.reset-btn:hover { color: var(--red); background: rgba(0,0,0,0.05); }

/* Typing indicator */
.typing-indicator .msg-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}
.typing-indicator .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #aaa;
  animation: bounce 1.2s infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 15px;
  color: var(--gray-text);
}

/* ===== MODALI ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 20px;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 36px 40px;
  max-width: 540px;
  width: 100%;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal h2 {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 16px;
  background: linear-gradient(90deg, var(--red), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--text);
}
.modal p { font-size: 17px; line-height: 1.7; color: #444; margin-bottom: 12px; }
.modal ul { padding-left: 20px; font-size: 17px; color: #444; line-height: 1.8; }
.modal a { color: var(--purple); text-decoration: none; }
.modal a:hover { text-decoration: underline; }

blockquote {
  border-left: 3px solid var(--gray-border);
  padding: 10px 16px;
  margin: 16px 0;
  font-size: 17px;
  color: #555;
  line-height: 1.6;
}
blockquote cite {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  color: #999;
  font-style: normal;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 22px;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--gray-bg); }

/* Contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.contact-form input,
.contact-form textarea {
  padding: 10px 14px;
  border: 1px solid var(--gray-border);
  border-radius: 8px;
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
  resize: none;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--purple); }

.submit-btn {
  padding: 11px;
  background: linear-gradient(90deg, var(--red), var(--blue));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.15s;
}
.submit-btn:hover { opacity: 0.88; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .nav-buttons { gap: 8px; }
  .nav-btn { font-size: 15px; padding: 8px 14px; }
  .logo { height: 64px; }
  .modal { padding: 24px 20px; }
  .toolbar-btn, .voice-btn { padding: 6px 10px; }
  .lang-btn { font-size: 14px; padding: 2px 4px; }
  .lang-sep { font-size: 13px; }
}

