/* =========================================================
   BLUUPI — ASSISTANT MOBILE / TABLET
   Fichier : /app/assets/styles/pages/assistant.css

   Rôle :
   - expérience assistant mobile
   - expérience assistant tablette
   - bottom-nav mobile
   - menu/footer desktop cachés sur mobile
========================================================= */

/* =========================================================
   1. VARIABLES
========================================================= */

:root{
  --bluupi-dark:#0E3E61;
  --bluupi-primary:#127194;
  --bluupi-cyan:#5CD6F4;
  --bluupi-gray:#E6EEF2;
  --bluupi-text:#4B5A68;
  --bluupi-white:#FFFFFF;

  --app-bg:#0b324f;
  --footer-bg:#071f33;

  --safe-top:env(safe-area-inset-top, 0px);
}

/* =========================================================
   2. RESET
========================================================= */

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

html,
body{
  width:100%;
  min-height:100%;
  overflow-x:hidden;
  background:var(--app-bg);
}

body{
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif;
  color:var(--bluupi-white);
  -webkit-text-size-adjust:100%;
}

button,
input{
  font:inherit;
}

button{
  cursor:pointer;
}

a{
  color:inherit;
  text-decoration:none;
}

/* =========================================================
   3. CACHER DESKTOP SUR MOBILE / TABLETTE
========================================================= */

.desktop-header,
.desktop-footer,
.desktop-menu,
.desktop-nav,
.main-header,
.site-header,
header{
  display:none !important;
}

/* =========================================================
   4. APP ASSISTANT
========================================================= */

.app{
  width:100vw;
  max-width:100vw;
  min-height:100dvh;
  background:var(--app-bg);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  position:relative;
  padding-bottom:140px;
}

/* =========================================================
   5. MASCOTTE
========================================================= */

.bluupi-zone{
  flex:0 0 auto;
  padding:calc(18px + var(--safe-top)) 16px 0;
  text-align:center;
  position:relative;
  z-index:5;
}

.bluupi-avatar{
  width:170px;
  height:auto;
  display:block;
  margin:0 auto -70px;
  animation:bluupi-pulse 2.2s ease-in-out infinite;
  position:relative;
  z-index:10;
}

@keyframes bluupi-pulse{
  0%{
    transform:translateX(-26px) translateY(0) scale(1);
  }

  50%{
    transform:translateX(-26px) translateY(-3px) scale(1.02);
  }

  100%{
    transform:translateX(-26px) translateY(0) scale(1);
  }
}

/* Éléments anciens ou secondaires masqués */

.assistant-topbar,
.assistant-modes,
.mode-btn,
.account-btn,
.bluupi-bubble,
.weather-widget,
.quick-start{
  display:none !important;
}

/* =========================================================
   6. ZONE CHAT
========================================================= */

.app-main{
  flex:1;
  min-height:0;
  display:flex;
  overflow:hidden;
}

.chat{
  flex:1;
  width:100%;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  padding:58px 14px 150px;
  font-size:16px;
}

.msg{
  display:flex;
  margin-bottom:12px;
}

.msg.me{
  justify-content:flex-end;
}

.bubble{
  max-width:86%;
  padding:12px 15px;
  border-radius:22px;
  line-height:1.38;
  white-space:pre-line;
  word-wrap:break-word;
  overflow-wrap:anywhere;
}

.bubble.bluupi{
  background:var(--bluupi-primary);
  color:#fff;
  border-bottom-left-radius:7px;
  box-shadow:0 14px 34px rgba(0,0,0,.14);
}

.bubble.me{
  background:var(--bluupi-gray);
  color:var(--bluupi-dark);
  border-bottom-right-radius:7px;
}

/* Premier message : bulle normale */

.chat .msg:first-child .bubble.bluupi{
  max-width:86%;
  margin-left:0;
  margin-right:0;
  padding:12px 15px;
  border-radius:22px;
  border-bottom-left-radius:7px;
  font-size:inherit;
  line-height:1.38;
  font-weight:400;
}

/* =========================================================
   7. ANIMATION APRÈS DÉBUT CHAT
========================================================= */

body.chat-started .bluupi-zone{
  animation:bluupiLeave .45s ease forwards;
  pointer-events:none;
}

@keyframes bluupiLeave{
  0%{
    opacity:1;
    transform:translateY(0) scale(1);
  }

  100%{
    opacity:0;
    transform:translateY(-28px) scale(.92);
    height:0;
    padding:0;
    margin:0;
  }
}

body.chat-started .chat{
  padding-top:24px;
}

/* =========================================================
   8. INPUT MOBILE
========================================================= */

.app-input{
  position:fixed;
  left:0;
  bottom:82px;
  width:100vw;
  z-index:90;
  background:var(--footer-bg);
  border-top:1px solid rgba(230,238,242,.12);
  padding:10px 12px;
}

.input-row{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
}

.mic-btn{
  width:54px;
  height:54px;
  flex:0 0 54px;
  border:0;
  border-radius:50%;
  background:rgba(92,214,244,.15);
  color:#fff;
  font-size:24px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.composer{
  position:relative;
  flex:1;
  min-width:0;
  display:flex;
  align-items:center;
}

.text-input{
  width:100%;
  height:56px;
  border:0;
  outline:0;
  border-radius:999px;
  background:var(--bluupi-gray);
  color:var(--bluupi-dark);
  font-size:17px;
  padding:0 16px 0 54px;
}

.text-input::placeholder{
  color:var(--bluupi-text);
}

.attach-btn{
  position:absolute;
  left:8px;
  top:50%;
  transform:translateY(-50%);
  width:40px;
  height:40px;
  border-radius:50%;
  border:1px solid rgba(92,214,244,.45);
  background:rgba(92,214,244,.22);
  color:#fff;
  font-size:25px;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:2;
}

.attach-menu{
  display:none;
  position:absolute;
  left:0;
  bottom:calc(100% + 10px);
  min-width:170px;
  background:rgba(8,31,51,.96);
  border:1px solid rgba(230,238,242,.14);
  border-radius:16px;
  padding:8px;
  box-shadow:0 14px 40px rgba(0,0,0,.35);
  backdrop-filter:blur(10px);
  z-index:999;
}

.attach-menu.open{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.attach-item{
  border:0;
  background:rgba(255,255,255,.08);
  color:#fff;
  padding:10px 12px;
  border-radius:12px;
  text-align:left;
}

.send-btn{
  width:56px;
  height:56px;
  flex:0 0 56px;
  border:0;
  border-radius:50%;
  background:var(--bluupi-cyan);
  color:var(--bluupi-dark);
  font-size:0;
  display:flex;
  align-items:center;
  justify-content:center;
}

.send-btn::before{
  content:"↑";
  font-size:34px;
  font-weight:900;
  line-height:1;
}

/* =========================================================
   9. BOTTOM NAV MOBILE
========================================================= */

.bottom-nav{
  position:fixed;
  left:0;
  bottom:0;
  width:100vw;
  height:82px;
  background:var(--app-bg);
  border-top:1px solid rgba(230,238,242,.12);
  display:grid;
  grid-template-columns:repeat(5,1fr);
  z-index:95;
}

.bottom-nav a{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  color:rgba(255,255,255,.6);
  font-size:12px;
  font-weight:600;
}

.bottom-nav i{
  width:25px;
  height:25px;
  stroke-width:2;
  opacity:.85;
}

.bottom-nav a.active{
  color:var(--bluupi-cyan);
}

.bottom-nav a.active i{
  transform:scale(1.08);
  opacity:1;
}

/* =========================================================
   10. TABLETTE
========================================================= */

@media(min-width:768px) and (max-width:1199px){

  .app{
    width:100vw;
    max-width:100vw;
    margin:0;
    padding-bottom:150px;
  }

  .bluupi-zone{
    padding-top:calc(22px + var(--safe-top));
  }

  .bluupi-avatar{
    width:235px;
    margin-bottom:-85px;
  }

  .chat{
    padding:74px 48px 175px;
    font-size:18px;
  }

  .bubble{
    max-width:72%;
    font-size:18px;
  }

  .chat .msg:first-child .bubble.bluupi{
    max-width:72%;
    font-size:18px;
    padding:12px 15px;
  }

  .app-input{
    bottom:88px;
    padding:12px 28px;
  }

  .bottom-nav{
    height:88px;
  }

  @keyframes bluupi-pulse{
    0%{
      transform:translateX(-42px) translateY(0) scale(1);
    }

    50%{
      transform:translateX(-42px) translateY(-3px) scale(1.02);
    }

    100%{
      transform:translateX(-42px) translateY(0) scale(1);
    }
  }
}

/* =========================================================
   11. TABLETTE HORIZONTALE
========================================================= */

@media(min-width:768px) and (max-width:1199px) and (orientation:landscape){

  .bluupi-zone{
    padding-top:8px;
  }

  .bluupi-avatar{
    width:145px;
    margin-bottom:-92px;
  }

  .chat{
    padding:42px 40px 160px;
  }

  .chat .msg:first-child .bubble.bluupi{
    max-width:620px;
    margin-left:auto;
    margin-right:auto;
    font-size:18px;
    padding:26px 28px 22px;
  }

  .app-input{
    bottom:78px;
    padding:9px 24px;
  }

  .bottom-nav{
    height:78px;
  }

  .text-input{
    height:50px;
  }

  .mic-btn,
  .send-btn{
    width:50px;
    height:50px;
    flex-basis:50px;
  }
}

/* =========================================================
   12. TRANSITION FOND
========================================================= */

body.assistant-enter .app{
  animation:bluupiEnterWorld 1.6s ease forwards;
}

@keyframes bluupiEnterWorld{
  0%{
    background:#F3F8FB;
  }

  45%{
    background:#DFF3FA;
  }

  100%{
    background:var(--app-bg);
  }
}

body.assistant-enter .bluupi-zone,
body.assistant-enter .app-main{
  opacity:1;
  transform:none;
  animation:none;
}

body.assistant-enter .app-input,
body.assistant-enter .bottom-nav{
  opacity:1;
  animation:none;
}