/* ==========================================================================
   AI CHAT LLM INTERFACE - SviluppoWeb3D
   Design System: Blocksy Elegance + ChatGPT Ultra-Clean LLM UI
   ========================================================================== */

:root {
  --chat-bg: #070a12;
  --chat-sidebar-bg: #0b0f19;
  --chat-sidebar-hover: #131a29;
  --chat-panel-bg: rgba(15, 23, 42, 0.82);
  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-border-focus: #3b82f6;
  --chat-input-bg: #111827;
  --chat-user-msg-bg: #1e293b;
  --chat-ai-msg-bg: rgba(17, 24, 39, 0.65);
  --chat-primary: #2563eb;
  --chat-primary-hover: #1d4ed8;
  --chat-accent: #10b981;
  --chat-cyan: #00f2fe;
  --chat-text: #f8fafc;
  --chat-text-muted: #94a3b8;
  --chat-radius-pill: 26px;
  --chat-radius-card: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--chat-bg);
  color: var(--chat-text);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: var(--chat-bg);
  color: var(--chat-text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.chat-modal-active {
  overflow: hidden;
}

body.chat-modal-active .floating-whatsapp-btn {
  display: none !important;
}

/* 3D CANVAS IN BACKGROUND */
#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.5s ease;
}

#canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   HERO SPHERE SECTION (CENTERED INTERACTIVE TRIGGER)
   ========================================================================== */
.hero-home-view {
  position: relative;
  z-index: 20;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero-sphere-section {
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(90px + env(safe-area-inset-top, 0px)) 24px calc(40px + env(safe-area-inset-bottom, 0px)) 24px;
  text-align: center;
}

.hero-sphere-container {
  max-width: 860px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.hero-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #38bdf8;
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.15);
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  background: #00f2fe;
  border-radius: 50%;
  box-shadow: 0 0 10px #00f2fe;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.7); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 6px rgba(0, 242, 254, 0); }
  100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); }
}

.hero-sphere-title {
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, #00f2fe 0%, #3b82f6 50%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sphere-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.12rem);
  color: #94a3b8;
  max-width: 640px;
  line-height: 1.6;
  margin-bottom: 32px;
}

/* ==========================================================================
   2D ELEGANT MINIMALIST AI TRIGGER
   Design System: Linear / Vercel Ultra-Clean 2D Cyber Elegance
   ========================================================================== */
.ai-sphere-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 16px 0 32px 0;
}

.sphere-float-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-sphere-orb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  padding: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.ai-sphere-orb:hover,
.ai-sphere-orb:focus-visible {
  transform: scale(1.08);
}

.ai-sphere-orb:active {
  transform: scale(0.96);
}

/* Hairline Animated Conic Gradient Ring (Signature Linear/Apple style) */
.orb-hairline-glow {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  padding: 1.5px;
  background: conic-gradient(from 0deg, rgba(0, 242, 254, 0.15) 0%, #00f2fe 30%, rgba(59, 130, 246, 0.3) 60%, #8b5cf6 85%, rgba(0, 242, 254, 0.15) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: rotateHairline 6s linear infinite;
  opacity: 0.75;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.ai-sphere-orb:hover .orb-hairline-glow {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.65));
}

@keyframes rotateHairline {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 2D Obsidian / Frosted Inner Disc */
.orb-disc {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.65),
    0 0 25px rgba(0, 242, 254, 0.08);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.ai-sphere-orb:hover .orb-disc {
  background: #0d1424;
  border-color: rgba(0, 242, 254, 0.35);
  box-shadow: 
    0 14px 40px rgba(0, 0, 0, 0.75),
    0 0 35px rgba(0, 242, 254, 0.22);
}

/* Clean 2D Spark Icon */
.orb-icon {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-sphere-orb:hover .orb-icon {
  transform: scale(1.12);
}

.orb-icon svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.45));
}

/* INVITATION BADGE UNDERNEATH */
.sphere-invitation {
  margin-top: 16px;
}

.invitation-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
  transition: all 0.25s ease;
}

.pulse-indicator-dot {
  width: 6px;
  height: 6px;
  background: #00f2fe;
  border-radius: 50%;
  box-shadow: 0 0 8px #00f2fe;
}

.ai-sphere-orb:hover + .sphere-invitation .invitation-badge,
.sphere-float-wrapper:hover + .sphere-invitation .invitation-badge {
  border-color: rgba(0, 242, 254, 0.45);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.2);
}

/* QUICK TOPICS LIST */
.hero-quick-topics {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.quick-topics-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-pills-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 680px;
}

.hero-quick-pill {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.hero-quick-pill:hover {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(0, 242, 254, 0.45);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 242, 254, 0.15);
}

/* ==========================================================================
   CHAT MODAL OVERLAY & CONTAINER
   ========================================================================== */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.chat-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.chat-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 13, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
}

.chat-modal-window {
  position: relative;
  width: 100%;
  max-width: 860px;
  height: 84vh;
  max-height: 800px;
  background: rgba(11, 15, 25, 0.94);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 20px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85), 0 0 50px rgba(0, 242, 254, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.94) translateY(18px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.chat-modal-overlay.open .chat-modal-window {
  transform: scale(1) translateY(0);
}

/* MODAL TOPBAR */
.chat-modal-topbar {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--chat-border);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 50;
}

.chat-topbar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar-pulse {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00f2fe 0%, #2563eb 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.chat-avatar-pulse .live-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #0b0f19;
  border-radius: 50%;
}

.chat-topbar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.chat-topbar-desc {
  font-size: 0.75rem;
  color: #94a3b8;
}

.chat-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-topbar-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--chat-border);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-topbar-action:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: #3b82f6;
  color: #fff;
}

.btn-topbar-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--chat-border);
  color: #cbd5e1;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-topbar-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
  transform: rotate(90deg);
}

@media (max-width: 768px) {
  .hero-sphere-section {
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(85px + env(safe-area-inset-top, 0px)) 16px calc(35px + env(safe-area-inset-bottom, 0px)) 16px;
  }

  .ai-sphere-orb {
    width: 74px;
    height: 74px;
  }

  .orb-icon svg {
    width: 28px;
    height: 28px;
  }

  /* FULL-SCREEN NATIVE MODAL EXPERIENCE ON MOBILE */
  .chat-modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .chat-modal-window {
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    transform: translateY(100%);
  }

  .chat-modal-overlay.open .chat-modal-window {
    transform: translateY(0);
  }

  /* TOPBAR MOBILE COMPACT */
  .chat-modal-topbar {
    height: 56px;
    padding: 0 14px;
    background: #0b0f19;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .chat-avatar-pulse {
    width: 32px;
    height: 32px;
  }

  .chat-topbar-title {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
  }

  .chat-topbar-desc {
    font-size: 0.68rem;
  }

  .btn-topbar-action {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .topbar-action-label {
    display: none;
  }

  .btn-topbar-close {
    width: 34px;
    height: 34px;
  }

  /* STREAM & MESSAGES MOBILE */
  .chat-scroll-stream {
    padding: 14px 12px 85px 12px;
  }

  .welcome-hero-state {
    padding: 20px 8px 10px 8px;
  }

  .welcome-ai-orb {
    width: 46px;
    height: 46px;
    margin-bottom: 12px;
  }

  .welcome-title {
    font-size: 1.35rem;
    margin-bottom: 8px;
  }

  .welcome-subtitle {
    font-size: 0.84rem;
    line-height: 1.45;
    margin-bottom: 18px;
  }

  .prompt-suggestions-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .prompt-card {
    padding: 10px 12px;
  }

  .message-row {
    gap: 8px;
  }

  .msg-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
  }

  .msg-content-bubble {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    border-radius: 14px;
  }

  /* BOTTOM DOCK & INPUT BAR ULTRA-COMFORTABLE ON MOBILE */
  .chat-bottom-dock {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px;
    background: rgba(11, 15, 25, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 60;
  }

  .chat-input-pill {
    width: 100%;
    padding: 6px 6px 6px 14px;
    border-radius: 24px;
    background: #111827;
    border: 1px solid #334155;
    gap: 8px;
    align-items: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  }

  .chat-textarea {
    font-size: 16px !important; /* CRITICAL: Prevents iOS auto-zoom */
    line-height: 1.35;
    padding: 6px 0;
    min-height: 24px;
    max-height: 90px;
    color: #fff;
  }

  .chat-textarea::placeholder {
    font-size: 0.86rem;
    color: #64748b;
  }

  .btn-chat-send {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
  }

  .btn-chat-send svg {
    width: 16px;
    height: 16px;
  }

  .chat-disclaimer {
    display: none; /* Frees up mobile screen space */
  }
}

/* MAIN APP WRAPPER: SIDEBAR + CHAT VIEW (LEGACY SUPPORT) */
.ai-app-layout {
  position: relative;
  z-index: 10;
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR (COLLAPSIBLE LIKE CHATGPT)
   ========================================================================== */
.ai-sidebar {
  width: 270px;
  background: var(--chat-sidebar-bg);
  border-right: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
  z-index: 100;
  flex-shrink: 0;
}

.ai-sidebar.collapsed {
  transform: translateX(-100%);
  width: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-header {
  padding: 16px 14px 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--chat-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}

.brand-icon-box {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-icon-box svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
}

.btn-sidebar-close {
  background: transparent;
  border: none;
  color: var(--chat-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* NEW CHAT BUTTON */
.btn-new-chat {
  margin: 14px 12px;
  background: #1e293b;
  border: 1px solid var(--chat-border);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-chat:hover {
  background: #2563eb;
  border-color: #3b82f6;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-new-chat svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

/* SIDEBAR NAVIGATION ITEMS (SOLO LE PAGINE RICHIESTE DALL'UTENTE) */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 8px 6px 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s;
}

.sidebar-nav-item:hover {
  background: var(--chat-sidebar-hover);
  color: #fff;
}

.sidebar-nav-item.active {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.sidebar-nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-wa-btn {
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.3);
  color: #25d366;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-wa-btn:hover {
  background: #25d366;
  color: #000;
}

.sidebar-legal-link {
  color: #64748b;
  font-size: 0.75rem;
  text-decoration: none;
  text-align: center;
  padding-top: 4px;
}

.sidebar-legal-link:hover {
  color: #94a3b8;
}

/* ==========================================================================
   MAIN CHAT CONTAINER (CENTER VIEW)
   ========================================================================== */
.ai-chat-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background: rgba(7, 10, 18, 0.5);
  backdrop-filter: blur(8px);
}

/* TOP HEADER / APP BAR */
.chat-app-header {
  height: 58px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--chat-border);
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.header-left-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--chat-text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.model-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--chat-accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--chat-accent);
}

.header-nav-shortcuts {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-pill-link {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--chat-border);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.nav-pill-link:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: #3b82f6;
  color: #fff;
}

/* ==========================================================================
   SCROLLABLE MESSAGES STREAM & GREETING
   ========================================================================== */
.chat-scroll-stream {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 140px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

.chat-center-wrapper {
  max-width: 820px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* WELCOME EMPTY STATE (BEFORE FIRST MESSAGE) */
.welcome-hero-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px 20px 20px;
  margin: auto 0;
}

.welcome-ai-orb {
  width: 64px;
  height: 64px;
  background: radial-gradient(circle, #3b82f6 0%, #1d4ed8 70%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 32px rgba(37, 99, 235, 0.45);
  margin-bottom: 20px;
  position: relative;
}

.welcome-ai-orb::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(0, 242, 254, 0.4);
  animation: pulseOrb 2.5s infinite;
}

@keyframes pulseOrb {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.welcome-ai-orb svg {
  width: 32px;
  height: 32px;
  fill: #fff;
}

.welcome-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.welcome-subtitle {
  font-size: 0.95rem;
  color: var(--chat-text-muted);
  max-width: 580px;
  line-height: 1.55;
  margin-bottom: 32px;
}

/* STARTER PROMPT CARDS (CHATGPT STYLE) */
.prompt-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 760px;
}

.prompt-card {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-card);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prompt-card:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.prompt-card-icon {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.prompt-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.prompt-card-desc {
  font-size: 0.78rem;
  color: var(--chat-text-muted);
  line-height: 1.4;
}

/* SUGGESTED QUESTION CHIPS (IN-CHAT FALLBACK) */
.chat-suggestions-wrapper {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-suggestions-title {
  font-size: 0.8rem;
  color: var(--chat-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-suggestion-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  border-radius: 9999px;
  padding: 7px 15px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  line-height: 1.4;
  outline: none;
  text-align: left;
}

.chat-suggestion-chip:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* ==========================================================================
   CONVERSATIONAL MESSAGE BUBBLES
   ========================================================================== */
.chat-messages-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.message-row {
  display: flex;
  gap: 14px;
  width: 100%;
  animation: fadeInMsg 0.25s ease forwards;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.user {
  justify-content: flex-end;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: bold;
}

.message-row.assistant .msg-avatar {
  background: linear-gradient(135deg, #2563eb 0%, #00f2fe 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

.message-row.user .msg-avatar {
  background: #334155;
  color: #f1f5f9;
}

.msg-content-bubble {
  max-width: 82%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.message-row.user .msg-content-bubble {
  background: var(--chat-user-msg-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  border-top-right-radius: 4px;
}

.message-row.assistant .msg-content-bubble {
  background: var(--chat-ai-msg-bg);
  border: 1px solid var(--chat-border);
  color: #f1f5f9;
  border-top-left-radius: 4px;
  backdrop-filter: blur(8px);
}

/* MARKDOWN & CODE STYLING INSIDE BUBBLES */
.msg-content-bubble p {
  margin-bottom: 10px;
}

.msg-content-bubble p:last-child {
  margin-bottom: 0;
}

.msg-content-bubble ul, .msg-content-bubble ol {
  margin: 8px 0 10px 20px;
}

.msg-content-bubble li {
  margin-bottom: 4px;
}

.msg-content-bubble pre {
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  overflow-x: auto;
  margin: 10px 0;
  color: #7dd3fc;
}

.msg-content-bubble code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* INTERACTIVE ACTION BUTTONS IN AI MESSAGES */
.msg-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.btn-msg-cta {
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-msg-cta:hover {
  background: #2563eb;
  border-color: #3b82f6;
  color: #fff;
}

/* TYPING INDICATOR */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #60a5fa;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   FIXED FLOATING BOTTOM INPUT BAR (CHATGPT STYLE)
   ========================================================================== */
.chat-bottom-dock {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px 20px 20px;
  background: linear-gradient(180deg, rgba(7, 10, 18, 0) 0%, rgba(7, 10, 18, 0.95) 30%, #070a12 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 60;
}

.chat-input-pill {
  max-width: 820px;
  width: 100%;
  background: var(--chat-input-bg);
  border: 1px solid #334155;
  border-radius: var(--chat-radius-pill);
  padding: 8px 12px 8px 18px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-pill:focus-within {
  border-color: var(--chat-border-focus);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25), 0 12px 36px rgba(0, 0, 0, 0.5);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  overflow-y: hidden;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  max-height: 140px;
  min-height: 24px;
  padding: 6px 0;
}

.chat-textarea::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.chat-textarea::placeholder {
  color: #64748b;
}

.btn-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #334155;
  border: none;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.btn-chat-send.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.btn-chat-send svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
}

.chat-disclaimer {
  font-size: 0.73rem;
  color: #64748b;
  margin-top: 8px;
  text-align: center;
}

.chat-disclaimer a {
  color: #94a3b8;
  text-decoration: underline;
}

/* RESPONSIVE BREAKPOINTS (SIDEBAR LEGACY) */
@media (max-width: 768px) {
  .ai-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.7);
  }

  .ai-sidebar.mobile-open {
    transform: translateX(0);
  }

  .header-nav-shortcuts {
    display: none;
  }
}

/* ==========================================================================
   COOKIE BANNER INTEGRATION IN AI CHAT
   Posizionato in alto a destra: non blocca la barra di digitazione della chat
   ========================================================================== */
.cookie-banner {
  position: fixed !important;
  bottom: auto !important;
  top: 72px !important;
  right: 20px !important;
  left: auto !important;
  max-width: 420px !important;
  padding: 1.1rem 1.3rem !important;
  z-index: 9999 !important;
  background: rgba(15, 23, 42, 0.94) !important;
  border: 1px solid rgba(0, 242, 254, 0.35) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(14px) !important;
  border-radius: var(--chat-radius-card) !important;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease !important;
}

@media (max-width: 768px) {
  .cookie-banner {
    top: 60px !important;
    right: 12px !important;
    left: 12px !important;
    max-width: none !important;
    padding: 0.9rem 1rem !important;
  }
}


