/* =========================================================
   BLUUPI — STYLE (CLEAN)
   Rôle :
   - UI & composants uniquement
   - AUCUNE gestion responsive globale ici
   - Compatible commun.css (mobile / tablette / PC=tablette)
========================================================= */

/* =========================================================
   VARIABLES LOCALES UI
========================================================= */
:root{
  --bluupi-dark: #0E3E61;
  --bluupi-primary: #127194;
  --bluupi-light: #3CA6D6;
  --bluupi-cyan: #5CD6F4;
  --bluupi-gray: #E6EEF2;
  --bluupi-text: #4B5A68;
  --bluupi-white: #FFFFFF;

  --app-bg: #0b324f;
  --footer-bg: #081f33;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* =========================================================
   RESET LÉGER
========================================================= */
*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

body{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  color: var(--bluupi-white);
  -webkit-text-size-adjust: 100%;
}

/* =========================================================
   CONTENEUR APP (NEUTRE)
   👉 tailles pilotées par commun.css
========================================================= */
.app{
  width:100%;
  height:100%;
  background: var(--app-bg);
  overflow:hidden;

  display:flex;
  flex-direction:column;
}

/* =========================================================
   ZONE BLUUPI (avatar + modes)
========================================================= */
.bluupi-zone{
  flex-shrink:0;
  padding: 10px 16px 8px;
  text-align:center;
}

.bluupi-avatar{
  width:120px;
  height:auto;
  margin:2px auto 6px;
  display:block;
}

/* Modes */
.assistant-modes.under-avatar{
  margin-top:8px;
  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 .15s ease, color .15s ease, transform .1s ease;
}

.mode-btn.active{
  background:#fff;
  color: var(--bluupi-dark);
  font-weight:600;
}

.mode-btn:hover:not(.active){
  background: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

/* Bulle 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%;
  margin-top:8px;
}

/* Météo */
.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);
}

/* =========================================================
   MAIN & CHAT
========================================================= */
.app-main{
  flex:1;
  min-height:0;      /* essentiel iOS */
  display:flex;
  overflow:hidden;
}

.chat{
  flex:1;
  min-height:0;
  overflow-y:auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-anchor: none;

  padding: 12px 12px calc(92px + var(--safe-bottom));
  font-size:14px;
}

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

/* =========================================================
   MESSAGES
========================================================= */
.msg{
  margin-bottom:10px;
  display:flex;
}

.msg.me{ justify-content:flex-end; }

.bubble{
  padding:10px 14px;
  border-radius:18px;
  max-width:85%;
  line-height:1.35;
  white-space: pre-line;
  word-wrap: break-word;
}

.bubble.bluupi{
  background: var(--bluupi-primary);
  color: var(--bluupi-white);
  border-bottom-left-radius:6px;
}

.bubble.me{
  background: var(--bluupi-gray);
  color: var(--bluupi-dark);
  border-bottom-right-radius:6px;
}

/* =========================================================
   INPUT FIXE (dans l’app)
========================================================= */
.app-input{
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;

  background: var(--footer-bg);
  border-top: 1px solid rgba(230,238,242,0.12);

  padding: 10px 12px calc(12px + var(--safe-bottom));
  z-index: 50;
  flex-shrink: 0;
}

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

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

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

.send-btn{
  background: var(--bluupi-cyan);
  color: var(--bluupi-dark);
  font-weight:700;
}

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

.text-input::placeholder{
  color: var(--bluupi-text);
}

/* =========================================================
   ANIMATION IDLE
========================================================= */
@keyframes bluupi-pulse{
  0%   { transform: translateY(0) scale(1); }
  50%  { transform: translateY(-3px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

body.idle .bluupi-avatar{
  animation: bluupi-pulse 2.2s ease-in-out infinite;
}

/* =========================================================
   MOBILE — ajustements UI uniquement
========================================================= */
@media (max-width: 768px){

  .bluupi-zone{
    padding-top: calc(10px + var(--safe-top));
  }

  .bluupi-avatar{
    width:105px;
  }

  .mode-btn{
    padding:6px 10px;
    font-size:.75rem;
  }
}
/* =========================================================
   COMPOSER ( + / trombone DANS la barre d'écriture )
========================================================= */

.composer{
  position: relative;
  flex: 1;                 /* prend la place entre mic et send */
  display: flex;
  align-items: center;
}

/* override uniquement dans composer */
.composer .text-input{
  width: 100%;
  padding-left: 48px;      /* place pour le + */
}

/* bouton + dans la barre */
.attach-btn{
  position: absolute;
  left: 6px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(14,62,97,0.18);
  background: rgba(255,255,255,0.65);
  color: var(--bluupi-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.attach-btn:hover{
  background: rgba(255,255,255,0.85);
}

/* Menu caché par défaut */
.attach-menu{
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);   /* juste au-dessus de la barre */
  background: rgba(8,31,51,0.96);
  border: 1px solid rgba(230,238,242,0.14);
  border-radius: 14px;
  padding: 8px;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  z-index: 9999;

  display: none;              /* ✅ caché par défaut */
}

/* ✅ visible uniquement quand on ajoute .open */
.attach-menu.open{
  display: flex;
}






/* --- FIX VISIBILITÉ + BLUUPI BLUE --- */
.composer{
  position: relative !important;
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
}

.composer .text-input{
  width: 100% !important;
  padding-left: 52px !important;  /* place pour le + */
}

.attach-btn{
  position: absolute !important;
  left: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;

  width: 34px !important;
  height: 34px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(92,214,244,.40) !important;

  background: rgba(92,214,244,.22) !important; /* bleu bluupi */
  color: #fff !important;
  font-size: 20px !important;
  line-height: 1 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  z-index: 5 !important;          /* ✅ clé: au-dessus de l’input */
}

.attach-btn:hover{
  background: rgba(92,214,244,.32) !important;
}
