/* Widget chatbot — styles */

.chatbot-widget {
  position: fixed;
  right: 1rem;
  bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 100001;
  font-family: Inter, system-ui, sans-serif;
}

.chatbot-widget__toggle {
  width: 3.5rem;
  height: 3.5rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c5cff, #5b8def);
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chatbot-widget__toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

.chatbot-widget__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(22rem, calc(100vw - 2rem));
  height: min(32rem, calc(100vh - 8rem));
  display: none;
  flex-direction: column;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(18, 18, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}

.chatbot-widget.is-open .chatbot-widget__panel {
  display: flex;
}

.chatbot-widget__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chatbot-widget__header strong {
  display: block;
  color: #fff;
  font-size: 1rem;
}

.chatbot-widget__header p {
  margin: 0.25rem 0 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  line-height: 1.35;
}

.chatbot-widget__close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
}

.chatbot-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chatbot-msg {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 100%;
  width: 100%;
}

.chatbot-msg--user {
  align-self: flex-end;
  max-width: 92%;
}

.chatbot-msg--assistant {
  align-self: flex-start;
}

.chatbot-msg__bubble {
  padding: 0.65rem 0.8rem;
  border-radius: 0.9rem;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chatbot-msg--user .chatbot-msg__bubble {
  background: #5b8def;
  color: #fff;
  border-bottom-right-radius: 0.2rem;
}

.chatbot-msg--assistant .chatbot-msg__bubble {
  background: rgba(255, 255, 255, 0.08);
  color: #f2f2f7;
  border-bottom-left-radius: 0.2rem;
}

.chatbot-msg--typing .chatbot-msg__bubble {
  opacity: 0.7;
  font-style: italic;
}

.chatbot-results-hint {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}

.chatbot-msg__cards {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.chatbot-meme-card {
  display: flex;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.chatbot-meme-card:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chatbot-meme-card__media {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
  flex-shrink: 0;
  border-radius: 0.55rem;
  overflow: hidden;
  background: #111;
}

.chatbot-meme-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot-meme-card__play {
  position: absolute;
  right: 0.25rem;
  bottom: 0.25rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  pointer-events: none;
}

.chatbot-meme-card__play--audio {
  font-size: 0.5rem;
}

.chatbot-meme-card--nsfw .chatbot-meme-card__media img {
  filter: blur(12px);
}

.chatbot-meme-card__nsfw {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
}

.chatbot-meme-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.chatbot-meme-card__body strong {
  font-size: 0.84rem;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chatbot-meme-card__desc {
  margin: 0;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chatbot-meme-card__cat {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
}

.chatbot-load-more {
  align-self: flex-start;
  margin-top: 0.15rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(91, 141, 239, 0.45);
  border-radius: 999px;
  background: rgba(91, 141, 239, 0.12);
  color: #9ec5ff;
  font-size: 0.78rem;
  cursor: pointer;
}

.chatbot-load-more:hover {
  background: rgba(91, 141, 239, 0.22);
}

.chatbot-widget__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chatbot-widget__form input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
  outline: none;
}

.chatbot-widget__form input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.chatbot-widget__form button {
  width: 2.6rem;
  height: 2.6rem;
  border: none;
  border-radius: 999px;
  background: #5b8def;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.chatbot-widget__form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (min-width: 768px) {
  .chatbot-widget {
    bottom: 1.25rem;
  }

  .chatbot-widget__panel {
    width: 24rem;
    height: 34rem;
  }

  .chatbot-meme-card__media {
    width: 4rem;
    height: 4rem;
  }
}

@media (max-width: 767px) {
  .chatbot-widget.is-open .chatbot-widget__panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
    z-index: 10060;
  }

  .chatbot-widget.is-open .chatbot-widget__toggle {
    display: none;
  }

  .chatbot-meme-card__media {
    width: 5.5rem;
    height: 5.5rem;
  }

  .chatbot-meme-card__body strong {
    font-size: 0.9rem;
  }

  .chatbot-meme-card__desc {
    font-size: 0.8rem;
  }
}
