/* ============================================================
   LEMON TV — Floating WhatsApp + AI Chat Assistant
   ============================================================ */

.ltv-float-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  pointer-events: none;
}

.ltv-float-stack > * {
  pointer-events: auto;
}

/* Move back-to-top above floats */
.back-to-top {
  right: 1.25rem !important;
  bottom: 9.5rem !important;
  z-index: 9400;
}

.wa-float {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  border: none;
  text-decoration: none;
}

.wa-float:hover {
  transform: scale(1.08);
  color: #fff;
  box-shadow: 0 14px 36px rgba(37, 211, 102, 0.55);
}

.wa-float::after {
  content: "Chat on WhatsApp";
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #101010;
  color: #fff;
  font-size: 0.75rem;
  font-family: var(--font-ui, Inter, sans-serif);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.wa-float:hover::after {
  opacity: 1;
}

.ai-float {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F9CE03, #65B401);
  color: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  box-shadow: 0 10px 30px rgba(249, 206, 3, 0.35);
  border: none;
  cursor: pointer;
  transition: transform 0.3s ease;
  position: relative;
}

.ai-float:hover {
  transform: scale(1.08);
}

.ai-float .pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(249, 206, 3, 0.45);
  animation: aiPulse 2s ease-out infinite;
}

@keyframes aiPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.35); opacity: 0; }
}

.ai-chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 9.5rem;
  width: min(380px, calc(100vw - 1.5rem));
  height: min(560px, calc(100vh - 7rem));
  max-height: 70vh;
  background: #0e0e0e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
  z-index: 9600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.ai-chat-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.ai-chat-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(120deg, rgba(249, 206, 3, 0.15), rgba(101, 180, 1, 0.12));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F9CE03, #65B401);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #050505;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.ai-chat-header h3 {
  font-size: 0.95rem;
  margin: 0;
  color: #fff;
}

.ai-chat-header p {
  font-size: 0.72rem;
  color: #a1a1a1;
  margin: 0.15rem 0 0;
}

.ai-chat-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ai-chat-close:hover {
  border-color: #F9CE03;
  color: #F9CE03;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: #F9CE03 #151515;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #F9CE03, #65B401);
  border-radius: 999px;
}

.ai-msg {
  max-width: 88%;
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #e8e8e8;
}

.ai-msg.bot {
  align-self: flex-start;
  background: #171717;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.ai-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(249, 206, 3, 0.2), rgba(101, 180, 1, 0.15));
  border: 1px solid rgba(249, 206, 3, 0.25);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-msg a {
  color: #F9CE03;
  text-decoration: underline;
}

.ai-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.65rem;
}

.ai-chip {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #151515;
  color: #ddd;
  font-size: 0.72rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s;
}

.ai-chip:hover {
  border-color: #F9CE03;
  color: #F9CE03;
}

.ai-chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: #0a0a0a;
}

.ai-chat-input input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #151515;
  color: #fff;
  font-size: 0.875rem;
}

.ai-chat-input input:focus {
  outline: none;
  border-color: rgba(249, 206, 3, 0.5);
}

.ai-chat-input button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #F9CE03, #65B401);
  color: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.ai-typing {
  align-self: flex-start;
  font-size: 0.8rem;
  color: #888;
  padding: 0 0.25rem;
}

/* Footer overflow fixes */
.footer-statement h2 {
  max-width: 100%;
  overflow-wrap: anywhere;
  padding-inline: 0.5rem;
}

.footer-bottom {
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-legal {
  flex-wrap: wrap;
}

.footer-legal a {
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
  .ltv-float-stack {
    right: 0.85rem;
    bottom: 0.85rem;
  }

  .wa-float,
  .ai-float {
    width: 52px;
    height: 52px;
  }

  .wa-float::after {
    display: none;
  }

  .ai-chat-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: 8.5rem;
    height: min(520px, calc(100vh - 9rem));
    border-radius: 16px;
  }

  .back-to-top {
    right: 0.85rem !important;
    bottom: 8.75rem !important;
    width: 46px;
    height: 46px;
  }

  .cookie-notice {
    right: 0.75rem;
    left: 0.75rem;
    max-width: none;
    bottom: 7.5rem;
    z-index: 9200;
  }
}

/* Keep cookie below chat widgets */
.cookie-notice {
  z-index: 9200;
  max-width: min(400px, calc(100vw - 5.5rem));
}

@media (max-width: 430px) {
  .footer-main {
    grid-template-columns: 1fr !important;
  }

  .ai-chat-panel {
    bottom: 8rem;
  }
}

body.touch-device .wa-float,
body.touch-device .ai-float,
body.touch-device .ai-chip,
body.touch-device .ai-chat-input button,
body.touch-device .ai-chat-close {
  cursor: pointer;
}
