/* ============================================================
   LALABOT — Full-Screen ChatGPT-Style Overlay with Sidebar
   ============================================================ */

#lalabot-root * { box-sizing: border-box; font-family: 'Inter', 'Segoe UI', sans-serif; }

/* ===== FLOATING ROBOT ===== */
#lalabot-float {
  position: fixed; bottom: 30px; right: 30px;
  width: 110px; height: 110px;
  z-index: 9999; cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#lalabot-float::after {
  content: ''; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  width: 70%; height: 14px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0) 75%);
  border-radius: 50%; filter: blur(4px); z-index: -1; pointer-events: none;
  animation: lalaShadow 3s ease-in-out infinite;
}
@keyframes lalaShadow {
  0%,100% { width: 70%; height: 14px; opacity: 0.7; transform: translateX(-50%) scaleX(1) scaleY(1); filter: blur(4px); }
  50%      { width: 55%; height: 10px; opacity: 0.5; transform: translateX(-50%) scaleX(0.85) scaleY(0.7); filter: blur(6px); }
}
#lalabot-float svg { width: 100%; height: 100%; filter: drop-shadow(0 8px 25px rgba(90,180,255,0.6)); transition: filter 0.3s; }
#lalabot-float:hover svg { filter: drop-shadow(0 12px 40px rgba(90,180,255,1)); }

.lalabot-ping {
  position: absolute; top: 8px; right: 8px; width: 16px; height: 16px;
  background: #ff4d6d; border-radius: 50%; border: 2px solid #fff;
  animation: lalaPing 1.5s ease-in-out infinite; z-index: 10;
}
@keyframes lalaPing {
  0%,100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(255,77,109,0.7); }
  50%      { transform: scale(1.2); opacity: 0.9; box-shadow: 0 0 0 14px rgba(255,77,109,0); }
}

#lalabot-root.open #lalabot-float { opacity: 0; pointer-events: none; transform: scale(0.5); }

/* ===== PANEL ===== */
#lalabot-panel {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.3) rotate(-10deg);
  width: 780px; max-width: 96vw;
  height: 640px; max-height: 88vh;
  background: linear-gradient(135deg, #1a0510 0%, #2d0818 100%);
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 24px;
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.4), 0 30px 80px rgba(0,0,0,0.7);
  display: flex; flex-direction: row;
  overflow: hidden; opacity: 0; pointer-events: none;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9998;
}
#lalabot-root.open #lalabot-panel {
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  opacity: 1; pointer-events: auto;
}
#lalabot-panel:not(:has(.lb-sidebar)) { width: 540px; }

/* ===== SIDEBAR ===== */
.lb-sidebar {
  width: 220px;
  background: rgba(0, 0, 0, 0.35);
  border-right: 2px solid rgba(255, 215, 0, 0.3);
  display: flex; flex-direction: column;
  padding: 12px 8px;
  flex-shrink: 0;
  transition: width 0.3s ease, padding 0.3s ease;
  overflow: hidden;
}
.lb-sidebar.lb-collapsed { width: 0; padding: 0; border-right: none; }

.lb-sidebar-top {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
  margin-bottom: 8px;
}
.lb-brand {
  font-family: 'Orbitron', sans-serif; font-size: 12px; font-weight: 900;
  color: #FFD700; letter-spacing: 1px; flex: 1;
}

.lb-icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(0,0,0,0.4); border: 1.5px solid rgba(255, 215, 0, 0.5);
  color: #FFD700; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; padding: 0; flex-shrink: 0;
}
.lb-icon-btn:hover { background: #FFD700; color: #3F000F; transform: scale(1.08); }

.lb-toggle-float {
  width: 34px !important; height: 34px !important;
  border-radius: 8px !important;
  background: rgba(255, 215, 0, 0.1) !important;
  border: 1.5px solid rgba(255, 215, 0, 0.5) !important;
  color: #FFD700 !important;
  cursor: pointer; font-size: 16px !important;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s; margin-right: 10px; flex-shrink: 0;
}
.lb-toggle-float:hover { background: #FFD700 !important; color: #3F000F !important; transform: scale(1.08); }

/* Hide mobile close button on desktop */
.lb-mobile-close { display: none !important; }

.lb-sidebar-label {
  font-size: 10px; color: #C9A96E; padding: 4px 8px;
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700;
}
.lb-recents { list-style: none; padding: 0 2px; margin: 0; overflow-y: auto; flex: 1; }
.lb-recents::-webkit-scrollbar { width: 5px; }
.lb-recents::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.3); border-radius: 4px; }

.lb-recent-item {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 8px; border-radius: 8px;
  font-size: 12px; color: #d4c4b0; cursor: pointer;
  transition: all 0.15s; margin-bottom: 2px;
  border: 1px solid transparent;
}
.lb-recent-item:hover { background: rgba(255, 215, 0, 0.08); color: #FFD700; }
.lb-recent-item.active { background: rgba(255, 215, 0, 0.15); color: #FFD700; border-color: rgba(255, 215, 0, 0.4); }

.lb-dots {
  opacity: 0; background: transparent; border: none; color: #C9A96E;
  cursor: pointer; font-size: 14px; padding: 0 3px; border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
  line-height: 1;
}
.lb-recent-item:hover .lb-dots { opacity: 1; }
.lb-dots:hover { background: rgba(255, 215, 0, 0.2); color: #FFD700; }

.lb-menu {
  position: fixed; z-index: 10000;
  background: linear-gradient(135deg, #2d0818, #1a0510);
  border: 1.5px solid rgba(255, 215, 0, 0.5);
  border-radius: 10px; padding: 4px; min-width: 130px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7);
  animation: lb-menu-in 0.15s ease-out;
}
@keyframes lb-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.lb-menu button {
  display: block; width: 100%; text-align: left;
  padding: 7px 12px; background: transparent; border: none;
  color: #e0e0e0; font-size: 12px; cursor: pointer; border-radius: 6px;
  transition: background 0.15s;
}
.lb-menu button:hover { background: rgba(255, 215, 0, 0.15); color: #FFD700; }

.lb-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.lalabot-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(63,0,15,0.95), rgba(139,26,43,0.9));
  border-bottom: 2px solid rgba(255,215,0,0.4);
}
.lalabot-header-left { display: flex; align-items: center; gap: 10px; }
.lalabot-name { font-family: 'Orbitron', sans-serif; font-size: 15px; font-weight: 900; color: #FFD700; letter-spacing: 1.5px; }
.lalabot-status { font-size: 11px; color: #4ade80; margin-top: 2px; font-weight: 600; }
.lalabot-header-actions { display: flex; gap: 8px; }
.lalabot-header-actions button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid rgba(255,215,0,0.5);
  background: rgba(0,0,0,0.3); color: #FFD700;
  font-size: 15px; cursor: pointer; transition: all 0.2s;
}
.lalabot-header-actions button:hover { background: #ff4d6d; color: #fff; border-color: #ff4d6d; transform: scale(1.1); }

/* WELCOME */
.lalabot-welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 30px 20px; text-align: center; gap: 10px;
}
.lalabot-welcome-robot {
  width: 110px; height: 110px; margin-bottom: 8px;
  animation: lalaFloat 3s ease-in-out infinite;
}
.lalabot-welcome-robot svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 0 30px rgba(90, 180, 255, 0.8)) drop-shadow(0 0 60px rgba(90, 180, 255, 0.4));
}
.lalabot-welcome-greet {
  font-family: 'Playfair Display', serif;
  font-size: 34px; color: #FFD700; font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}
.lalabot-welcome-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px; color: #fff; font-weight: 900;
  letter-spacing: 2px;
}
.lalabot-welcome-sub {
  font-size: 15px; color: #d4c4b0;
  font-style: italic; margin-top: 8px;
}

.lalabot-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: rgba(255,215,0,0.4) transparent;
}
.lalabot-messages::-webkit-scrollbar { width: 6px; }
.lalabot-messages::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.4); border-radius: 10px; }

.lalabot-msg {
  max-width: 82%; padding: 12px 16px; border-radius: 16px;
  font-size: 14px; line-height: 1.55;
  word-wrap: break-word;
  animation: lalaMsg 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes lalaMsg {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lalabot-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #FFD700, #FF8C00);
  color: #3F000F; font-weight: 600;
  border-bottom-right-radius: 4px;
}
.lalabot-msg.bot {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(63,0,15,0.9), rgba(20,5,15,0.9));
  color: #fff; border: 1.5px solid rgba(255,215,0,0.3);
  border-bottom-left-radius: 4px;
}
.lalabot-msg.bot strong { color: #FFD700; }
.lalabot-msg.bot em { color: #ffb3c8; font-style: italic; }

.lalabot-typing {
  align-self: flex-start; display: flex; gap: 5px;
  padding: 14px 18px; background: rgba(63,0,15,0.9);
  border: 1.5px solid rgba(255,215,0,0.3); border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.lalabot-typing span { width: 8px; height: 8px; background: #FFD700; border-radius: 50%; animation: lalaTyping 1.4s infinite; }
.lalabot-typing span:nth-child(2) { animation-delay: 0.2s; }
.lalabot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lalaTyping { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }

.lalabot-input-wrap {
  padding: 14px 18px;
  background: rgba(20,5,15,0.95);
  border-top: 2px solid rgba(255,215,0,0.3);
  display: flex; gap: 10px;
}
.lalabot-input-wrap input {
  flex: 1; padding: 12px 18px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,215,0,0.3);
  border-radius: 30px; color: #fff; font-size: 14px; outline: none;
  transition: all 0.3s; font-family: inherit;
}
.lalabot-input-wrap input:focus { border-color: #FFD700; box-shadow: 0 0 20px rgba(255,215,0,0.4); }
.lalabot-input-wrap input::placeholder { color: rgba(255,255,255,0.4); }
.lalabot-input-wrap button {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, #FFD700, #FF8C00);
  border: none; color: #3F000F; font-size: 18px; font-weight: 900;
  cursor: pointer; transition: all 0.3s; flex-shrink: 0;
}
.lalabot-input-wrap button:hover { transform: scale(1.1); box-shadow: 0 0 25px rgba(255,215,0,0.7); }

@keyframes lalaFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes lalaBlink { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(0.05); } }
@keyframes lalaAntenna { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.lalabot-body { animation: lalaFloat 3s ease-in-out infinite; }
.lalabot-antenna { animation: lalaAntenna 2s ease-in-out infinite; transform-origin: 50px 20px; }
.lalabot-eye { animation: lalaBlink 4s ease-in-out infinite; transform-origin: center; }
.lalabot-eye.left { animation-delay: 0.05s; }

/* ============================================================
   MOBILE — sidebar is a full-screen slide-in drawer
   ============================================================ */
@media (max-width: 640px) {
  #lalabot-float { width: 90px; height: 90px; bottom: 20px; right: 20px; }

  #lalabot-panel {
    width: 96vw !important;
    height: 88vh;
    flex-direction: row;
  }

  /* Sidebar slides over the WHOLE panel */
  .lb-sidebar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 100%;
    z-index: 30;
    background: #1a0510;
    border-right: none;
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 16px 14px;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.8);
    overflow-y: auto;
  }

  .lb-sidebar.lb-mobile-open {
    transform: translateX(0);
  }

  .lb-sidebar.lb-collapsed {
    transform: translateX(-100%);
    width: 100%;
    padding: 16px 14px;
  }

  /* Bigger touch targets on mobile */
  .lb-sidebar .lb-sidebar-top {
    padding: 6px 4px 14px;
    margin-bottom: 10px;
  }

  .lb-sidebar .lb-brand {
    font-size: 15px;
  }

  .lb-sidebar .lb-sidebar-label {
    font-size: 11px;
    padding: 6px 8px;
  }

  .lb-sidebar .lb-recent-item {
    padding: 12px 12px;
    font-size: 14px;
    border-radius: 10px;
    margin-bottom: 4px;
  }

  .lb-sidebar .lb-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  /* Show the mobile close button */
  .lb-sidebar .lb-mobile-close {
    display: inline-flex !important;
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.5);
    color: #ff6b6b;
  }
  .lb-sidebar .lb-mobile-close:hover {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
  }

  /* Main chat full width */
  .lb-main {
    width: 100%;
    flex: 1;
  }
}