/* ── Chatbot page ──────────────────────────────────────────────────────────── */

.chatbot-main {
  display: flex;
  flex-direction: column;
  height: 70vh;
  overflow: hidden;
  padding: 0;
}

.chatbot-screen {
  width: 100%;
  height: 100%;
  border: 1px solid #22223a;
  border-radius: var(--border-radius-2);
  overflow: hidden;
}

/* Loading */
.chatbot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40vh;
  color: #888;
  font-size: 1rem;
}

/* ── Profile picker ────────────────────────────────────────────────────────── */

.chatbot-profile-picker {
  padding: 4rem 1rem 2rem;
  text-align: center;
}

.chatbot-profile-picker h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: #fff;
  margin-bottom: 0.5rem;
}

.chatbot-subtitle {
  color: #999;
  margin-bottom: 2.5rem;
}

.chatbot-profile-options {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.chatbot-profile-card {
  background: #1a1a2e;
  border: 2px solid #2a2a4a;
  border-radius: 16px;
  padding: 2rem 2.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: #fff;
  min-width: 180px;
  transition:
    border-color 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}

.chatbot-profile-card:hover:not(:disabled) {
  border-color: #7c6cff;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(124, 108, 255, 0.2);
}

.chatbot-profile-card:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.chatbot-profile-card strong {
  font-size: 1.2rem;
  margin-top: 0.3rem;
}
.chatbot-profile-card span {
  color: #aaa;
  font-size: 0.88rem;
}
.chatbot-profile-card em {
  color: #7c6cff;
  font-style: normal;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}

/* ── Avatar ───────────────────────────────────────────────────────────────── */

.chatbot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.chatbot-avatar-girlfriend {
  background: linear-gradient(135deg, #e91e8c, #ff6b9d);
}
.chatbot-avatar-boyfriend {
  background: linear-gradient(135deg, #1e6be9, #6baeff);
}
.chatbot-avatar-default {
  background: linear-gradient(135deg, #7c6cff, #b09fff);
}

/* ── Chat layout ──────────────────────────────────────────────────────────── */

.chatbot-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
} /* Sidebar */
.chatbot-sidebar {
  width: 230px;
  min-width: 230px;
  background: #0f0f1e;
  border-right: 1px solid #22223a;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  @media screen and (max-width: 767px) {
    position: fixed;
    top: 0;
    left: 0;
    width: 230px;
    min-width: 230px;
    height: 100vh;

    z-index: 1000;

    transform: translateX(-100%);
    transition: transform 0.3s ease;

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

    &.active {
      transform: translateX(0);
    }
  }
}

.chatbot-sidebar-head {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #22223a;
  color: #e0e0e0;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.chatbot-new-btn {
  background: transparent;
  border: 1px solid #7c6cff;
  color: #7c6cff;
  border-radius: 8px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  font-size: 0.78rem;
  transition:
    background 0.15s,
    color 0.15s;

  &:hover {
    background: #7c6cff;
    color: #fff;
  }
}

#chatbot-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0;
}

.chatbot-conv-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  text-decoration: none;
  color: #aaa;
  transition:
    background 0.15s,
    color 0.15s;
  cursor: pointer;

  &:hover {
    background: #1a1a2e;
    color: #ddd;
  }

  &.active {
    background: #1a1a2e;
    color: #fff;
  }

  .chatbot-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }
}

.chatbot-conv-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;

  strong {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  small {
    font-size: 0.72rem;
    color: #666;
  }
}

/* Mobile toggle button */
.sidebar-btn {
  display: none;

  @media screen and (max-width: 767px) {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 5px 20px 20px auto;
    z-index: 8;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: #7c6cff;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);

    transition: 0.2s;

    &:hover {
      transform: scale(1.05);
    }
  }
}

/* Chat panel */
.chatbot-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0b0b18;
}

#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scroll-behavior: smooth;
}

/* Bubbles */
.chatbot-bubble {
  max-width: 68%;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 0.95rem;
}

.chatbot-bubble-user {
  background: #7c6cff;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chatbot-bubble-assistant {
  background: #1a1a2e;
  color: #ddd;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chatbot-typing {
  color: var(--primary);
  font-style: italic;
  animation: text-color-change 1s infinite;
  transition: .2s;
}

@keyframes text-color-change {
    0% { color:  var(--primary);}
    50% {color: #4b4b4b;}
    100% {color:  var(--primary);}
}


/* Input area */
.chatbot-input-area {
  display: flex;
  gap: 0.65rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid #22223a;
  background: #0f0f1e;
  flex-shrink: 0;
  @media screen and (max-width: 767px) {
    flex-direction: column;
  }
}

.chatbot-input-area input {
  flex: 1;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 24px;
  padding: 0.65rem 1.1rem;
  color: #fff;
  font-size: 0.93rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.chatbot-input-area input:focus {
  border-color: #7c6cff;
}
.chatbot-input-area input::placeholder {
  color: #444;
}
.chatbot-input-area input:disabled {
  opacity: 0.5;
}

.chatbot-input-area .btn {
  border-radius: 24px;
  padding: 0.65rem 1.4rem;
  white-space: nowrap;
  flex-shrink: 0;
  @media screen and (max-width: 767px) {
    width: 100%;
  }
}

/* Scrollbar styling */
#chatbot-messages::-webkit-scrollbar,
#chatbot-conv-list::-webkit-scrollbar {
  width: 4px;
}
#chatbot-messages::-webkit-scrollbar-thumb,
#chatbot-conv-list::-webkit-scrollbar-thumb {
  background: #2a2a4a;
  border-radius: 4px;
}

/* ── Profile modal ────────────────────────────────────────────────────────── */

.chatbot-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.chatbot-modal {
  background: #13132a;
  border: 1px solid #2a2a4a;
  border-radius: 20px;
  padding: 2.5rem 2rem 2rem;
  max-width: 560px;
  width: 100%;
  position: relative;
  text-align: center;
}

.chatbot-modal h2 {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  color: #fff;
  margin-bottom: 0.4rem;
}

.chatbot-modal-close {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: #666;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}

.chatbot-modal-close:hover {
  color: #ccc;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* .chatbot-sidebar {
    display: none;
  } */
  .chatbot-bubble {
    max-width: 85%;
  }
  .chatbot-input-area {
    padding: 0.65rem 0.75rem;
  }
  .chatbot-input-area .btn {
    padding: 0.65rem 0.9rem;
  }
}
