:root {
  --bluupi-dark: #0E3E61;
  --bluupi-primary: #127194;
  --bluupi-light: #3CA6D6;
  --bluupi-cyan: #5CD6F4;
  --bluupi-gray: #E6EEF2;
  --bluupi-text: #4B5A68;
  --bluupi-white: #FFFFFF;
}

/* Reset de base */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Corps de page --- */
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: radial-gradient(circle at top, var(--bluupi-blue) 0, var(--bluupi-navy) 40%, #020b1f 100%);
  color: var(--bluupi-white);
}

/* Carte principale */
.app {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  border-radius: 32px;
  background: #0b324f;
  box-shadow: 0 18px 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
}

/* En-tête */
.app-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.app-title {
  font-weight: 600;
  font-size: 18px;
}
.chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(92,214,244,0.12);
  color: var(--bluupi-cyan);
}

/* ZONE BLUUPI */
.bluupi-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 20px 10px;
  text-align: center;
}

/* Avatar Bluupi – respiration douce en permanence */
.bluupi-avatar {
  width: 130px;
  height: auto;
  margin: 4px auto 8px;
  display: block;
  transform-origin: center bottom;
  animation: bluupi-pulse 2.2s ease-in-out infinite;
}

/* Quand Bluupi parle : on coupe la respiration */
body.listening .bluupi-avatar {
  animation: none;
  filter: none;
  transform: none;
}

/* Bulle sous Bluupi */
.bluupi-bubble {
  display: inline-block;
  background: var(--bluupi-primary);
  padding: 10px 14px;
  border-radius: 18px;
  text-align: left;
  font-size: 14px;
  max-width: 100%;
}
.weather-widget {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(230,238,242,0.1);
  font-size: 12px;
  color: var(--bluupi-gray);
}

/* Zone de chat */
.chat {
  flex: 1;
  padding: 8px 16px;
  overflow-y: auto;
  font-size: 14px;
  scroll-behavior: smooth;
}

/* Scrollbar */
.chat::-webkit-scrollbar {
  width: 8px;
}
.chat::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}
.chat::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.msg {
  margin-bottom: 8px;
  display: flex;
}
.msg.me {
  justify-content: flex-end;
}

/* Bulles de message */
.bubble {
  padding: 8px 12px;
  border-radius: 16px;
  max-width: 80%;
  line-height: 1.3;
  white-space: pre-line;
}
.bubble.bluupi {
  background: var(--bluupi-primary);
  color: var(--bluupi-white);
  border-bottom-left-radius: 4px;
}
.bubble.me {
  background: var(--bluupi-gray);
  color: var(--bluupi-dark);
  border-bottom-right-radius: 4px;
}

/* Barre d’entrée */
.app-input {
  padding: 10px 12px 14px;
  background: #081f33;
  border-top: 1px solid rgba(230,238,242,0.12);
}

/* Remonter un peu la barre sur mobile / navigateur */
@media (max-width: 768px) {
  .app-input {
    margin-bottom: 24px;
  }
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Boutons */
.mic-btn,
.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 18px;
}

/* Micro normal */
.mic-btn {
  background: rgba(92,214,244,0.15);
  color: var(--bluupi-cyan);
}

/* Micro ANIMÉ quand il écoute */
.mic-btn.listening {
  animation: micPulse 1.2s infinite;
  background-color: rgba(92, 214, 244, 0.3);
  box-shadow: 0 0 0 4px rgba(92, 214, 244, 0.2);
}

/* Animation pulsation micro */
@keyframes micPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(92, 214, 244, 0.6);
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 15px rgba(92, 214, 244, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(92, 214, 244, 0);
  }
}

/* Bouton d’envoi */
.send-btn {
  background: var(--bluupi-cyan);
  color: var(--bluupi-dark);
  font-weight: 600;
}

/* Champ texte */
.text-input {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bluupi-gray);
  color: var(--bluupi-dark);
  outline: none;
}
.text-input::placeholder {
  color: var(--bluupi-text);
}

/* Animation douce de Bluupi (respiration permanente) */
@keyframes bluupi-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(92, 214, 244, 0.0));
  }
  50% {
    transform: scale(1.02);
    filter: drop-shadow(0 0 14px rgba(92, 214, 244, 0.6));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(92, 214, 244, 0.0));
  }
}

/* Carte Van Gogh intégrée */
.vg-card {
  background: #0e3e61;
  border-radius: 24px;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
  padding: 1.5rem;
}
.vg-image {
  width: 100%;
  border-radius: 16px;
}
.vg-title {
  margin: 1rem 0 0.5rem;
  font-size: 1.4rem;
}
.vg-info {
  display: flex;
  justify-content: center;
  gap: 1rem;
  font-size: 0.9rem;
  opacity: 0.85;
}
.vg-text {
  font-size: 0.95rem;
  margin: 1rem 0;
  line-height: 1.4;
}
.vg-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}
.vg-btn,
.vg-btn-secondary {
  display: inline-block;
  background: #3ca6d6;
  color: white;
  font-weight: 600;
  text-decoration: none;
  padding: 0.8rem 1.6rem;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.vg-btn-secondary {
  background: transparent;
  border: 1px solid #3ca6d6;
}
.vg-btn:hover {
  background: #5cd6f4;
  color: #002f4e;
}
.vg-btn-secondary:hover {
  background: rgba(60,166,214,0.15);
}
.vg-open-button {
  margin-top: 0.5rem;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.4);
  color: rgba(255,255,255,0.8);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Layout type WhatsApp : app plein écran, footer fixe, chat scrollable */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}
#vangogh-view {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  max-height: calc(100vh - 220px);
  padding: 1rem 0;
}

/* === Onglets Assistant / Búsqueda manual === */
.assistant-shell {
  width: 100%;
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.assistant-header.slim {
  height: 10px;
  padding: 0;
  margin: 0;
}
.assistant-header h2 {
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.9;
  color: var(--bluupi-dark);
}
.assistant-tabs {
  display: flex;
  gap: 8px;
}
.assistant-tab {
  flex: 1;
  border: none;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(92,214,244,0.16);
  color: var(--bluupi-text);
}
.assistant-tab.active {
  background: var(--bluupi-white);
  color: var(--bluupi-dark);
}
.assistant-body {
  padding: 4px 0 10px;
}
.assistant-panel {
  display: none;
}
.assistant-panel.active {
  display: block;
}

/* Mode manuel */
.manual-filters {
  background: #f2f6fc;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 14px;
  color: #0E3E61;
}
.manual-filters h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.manual-filters label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 8px;
}
.manual-filters select {
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid #d0dde8;
  font-size: 0.85rem;
}
.btn-primary.full-width {
  width: 100%;
  margin-top: 6px;
}

/* Sections manuelles */
.manual-section {
  margin-top: 16px;
}
.manual-section h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

/* Grille Univers Bluupi */
.univers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.univers-card {
  border: none;
  border-radius: 12px;
  padding: 10px;
  text-align: left;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  cursor: pointer;
}
.univers-emoji {
  font-size: 1.2rem;
}
.univers-title {
  display: block;
  font-weight: 600;
  margin-top: 4px;
  color: #0E3E61;
}
.univers-text {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 2px;
  color: #4B5A68;
}

/* Actividades destacadas */
.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.featured-card {
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  color: #0E3E61;
}
.featured-thumb {
  width: 100%;
  height: 80px;
  border-radius: 10px;
  background: #d9e4f5;
  margin-bottom: 8px;
}
.featured-card h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}
.featured-card p {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

/* BOUTONS DE MODE SOUS BLUUPI (style app mobile) */
.assistant-modes.under-avatar {
  margin-top: 10px;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}
.mode-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  background: transparent;
  color: #f5f7ff;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.mode-btn.active {
  background: #ffffff;
  color: #0E3E61;
  font-weight: 600;
}
.mode-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Layout responsive Bluupi (mobile → tablette → desktop) */
@media (min-width: 768px) {
  body {
    justify-content: center;
    align-items: center;
  }
  .app {
    max-width: 600px;
    height: 90vh;
  }
}
@media (min-width: 1200px) {
  .app {
    max-width: min(50vw, 720px);
  }
}

/* Wrapper pour pouvoir positionner le disque par-dessus Bluupi */
.bluupi-avatar-wrapper {
  position: relative;
  display: inline-block;
}

/* ⚠️ Disque coloré sur le ventre de Bluupi – VALEURS NON MODIFIÉES */
.bluupi-disc {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  left: 50%;
  top: 63.5%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    #ffcc00,
    #ff6600,
    #ff0066,
    #9933ff,
    #007bff,
    #00c896,
    #ffcc00
  );
  opacity: 0;
  pointer-events: none;
}

/* Animation disque quand Bluupi parle (inchangée) */
body.listening .bluupi-disc {
  opacity: 1;
  animation:
    bluupiDiscFlash 0.25s ease-out 1,
    bluupiDiscSpin 0.9s linear infinite 0.25s;
}

@keyframes bluupiDiscFlash {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    box-shadow: 0 0 0 rgba(255,255,255,0);
    opacity: 0.4;
  }
  70% {
    transform: translate(-50%, -50%) scale(1.25);
    box-shadow: 0 0 16px rgba(255,255,255,0.9);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes bluupiDiscSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
