:root {
  /* Brand Colors UNIT 74 */
  --brand1: #fbbf24;     /* Ambra / Oro */
  --brand2: #f59e0b;     /* Ambra scuro */
  --brand3: #94a3b8;     /* Slate / Tech per l'AI */
  --brand-grad: linear-gradient(100deg, var(--brand2), var(--brand1) 45%, #d97706); 
  
  /* Text Colors */
  --text: #f8fafc;
  --text-light: #f1f5f9;
  --text-muted: #64748b;
  --text-inverse: #020617; /* Sfondo scuro per contrasto su oro */
  
  /* Background Colors (Dark Mode Slate 900) */
  --bg-panel: #0f172a;
  --bg-input: #1e293b;
  --bg-secondary: #020617;
  --bg-secondary-light: rgba(15, 23, 42, 0.85);
  
  /* Border Colors */
  --border-color: #334155;
  --border-color-light: #475569;
  
  /* Layout */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 20px rgba(245, 158, 11, 0.2);
  
  /* Animations */
  --title-shine-duration: 6s;
  --transition-fast: 0.12s ease;
  --transition-normal: 0.2s ease;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  
  /* Typography */
  --font-family: 'Lato', system-ui, sans-serif;
  --line-height-base: 1.6;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: auto; min-height: 100svh; }

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--text-light);
  /* Sfondo tecnico scuro */
  background: #020617 radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--spacing-md);
  overflow: auto;
  line-height: var(--line-height-base);
}

.chat-container {
  width: min(100%, 1000px);
  height: calc(100svh - 32px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 10;
}

h1.title {
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 1.25rem;
  margin: 0;
}

.utility-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--bg-secondary-light);
  border-bottom: 1px solid var(--border-color);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-fast), filter var(--transition-normal);
}

.action-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.action-btn.brand {
  background: var(--brand-grad);
  border: 0;
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.message { display: flex; gap: 1rem; max-width: 85%; align-items: flex-end; animation: fadeIn .4s ease; }
@keyframes fadeIn { from{opacity:0; transform:translateY(10px)} to{opacity:1; transform:translateY(0)} }

.message.user { align-self: flex-end; flex-direction: row-reverse; }

.message .bubble {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  line-height: 1.6;
  position: relative;
  overflow: hidden;
}

/* Bolla Utente (Ambra) */
.message.user .bubble {
  background: var(--brand1);
  color: var(--text-inverse);
  border-bottom-right-radius: 4px;
}

/* Bolla AI (Slate scuro) */
.message.bot .bubble {
  background: var(--bg-input);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.chat-footer {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  background: var(--bg-input);
  border-radius: 12px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  transition: border-color .2s;
}
.input-wrapper:focus-within { border-color: var(--brand1); }

#user-input {
  flex-grow: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-light);
  font: inherit;
  font-size: 1rem;
  padding: 0.5rem;
  resize: none;
  max-height: 150px;
}

#send-btn {
  border: none;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--brand-grad);
  color: var(--text-inverse);
  flex-shrink: 0;
  transition: transform .12s ease;
}
#send-btn:hover { filter: brightness(1.1); }
#send-btn:active { transform: scale(.95); }
#send-btn svg { width: 24px; height: 24px; }

/* === STILI PER IL LOCK OVERLAY (PRO FUNNEL) === */
.message-overlay-container {
  position: relative;
  width: 100%;
}
.blurred-content {
  filter: blur(6px);
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}
.lock-cta {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid var(--brand1);
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  width: 90%;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  z-index: 10;
}
.lock-cta h3 { color: var(--brand1); margin: 0 0 0.5rem 0; font-size: 1.1rem; }
.lock-cta p { color: var(--text-light); font-size: 0.85rem; margin: 0 0 1rem 0; line-height: 1.4; }
.lock-cta a {
  display: inline-block;
  background: var(--brand-grad);
  color: var(--text-inverse);
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  transition: transform 0.2s;
}
.lock-cta a:hover { transform: translateY(-2px); }

/* Chips per i suggerimenti */
.quick-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.quick-chips .chip {
  appearance: none; border: 1px solid var(--border-color); padding: .45rem .8rem; border-radius: 999px;
  font: 600 0.85rem/1.1 var(--font-family); background: var(--bg-secondary); color: var(--text-muted); 
  cursor: pointer; transition: all .15s ease;
}
.quick-chips .chip:hover { border-color: var(--brand1); color: var(--brand1); background: rgba(251, 191, 36, 0.05); }

/* Metadati Bot */
.message-source {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 8px;
  display: inline-flex; align-items: center; padding: 4px 8px;
  background: var(--bg-secondary); border-radius: 6px; border: 1px solid var(--border-color);
}

/* Typing indicator */
.typing-dots i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: currentColor; animation: bounce 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0) } 30% { transform: translateY(-4px) } }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand1); }
