/* ============================================================
   CLINICPEER — SLICK GLASSMORPHIC CHATBOT WIDGET
   ============================================================ */

/* ── Chatbot Toggle Button ──────────────────────────────────── */
.medibot-toggle {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 8px 32px rgba(0, 119, 182, 0.4);
  cursor: pointer;
  z-index: 1100;
  transition: all var(--trans-base);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.medibot-toggle:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 40px rgba(0, 119, 182, 0.5);
}

/* Pulsing Outer Ring */
.medibot-toggle::before {
  content: '';
  position: absolute;
  top: -6px; left: -6px; right: -6px; bottom: -6px;
  border-radius: var(--radius-full);
  border: 2px dashed var(--primary-light);
  opacity: 0.5;
  animation: medibot-pulse 8s linear infinite;
  pointer-events: none;
}

@keyframes medibot-pulse {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Chat Container ─────────────────────────────────────────── */
.medibot-container {
  position: fixed;
  bottom: calc(var(--space-lg) + 75px);
  right: var(--space-lg);
  width: 400px;
  max-width: calc(100vw - var(--space-xl));
  height: 550px;
  max-height: calc(100vh - var(--space-xl) - 100px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1100;
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.medibot-container.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────────────── */
.medibot-header {
  background: var(--grad-primary);
  color: var(--white);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.medibot-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.medibot-avatar {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.medibot-title h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  font-family: var(--font-main);
  letter-spacing: -0.2px;
}

.medibot-status {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 4px;
}

.medibot-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #39FF14; /* neon green active dot */
  border-radius: 50%;
  box-shadow: 0 0 8px #39FF14;
}

.medibot-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color var(--trans-fast);
  padding: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.medibot-close:hover {
  color: var(--white);
}

/* ── Chat Messages Log ──────────────────────────────────────── */
.medibot-body {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat */
.medibot-body::-webkit-scrollbar {
  width: 6px;
}
.medibot-body::-webkit-scrollbar-track {
  background: transparent;
}
.medibot-body::-webkit-scrollbar-thumb {
  background: rgba(0, 119, 182, 0.15);
  border-radius: var(--radius-full);
}
.medibot-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 119, 182, 0.3);
}

/* Message Styles */
.medibot-msg {
  max-width: 80%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.45;
  animation: msg-appear 300ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
  word-wrap: break-word;
}

@keyframes msg-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.medibot-msg.bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--gray-800);
  border-bottom-left-radius: var(--space-xs);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--gray-200);
}

.medibot-msg.user {
  align-self: flex-end;
  background: var(--grad-primary);
  color: var(--white);
  border-bottom-right-radius: var(--space-xs);
  box-shadow: 0 4px 12px rgba(0, 119, 182, 0.15);
}

/* ⚠️ Warning Message (Medical/Prescription Block) */
.medibot-msg.warning {
  align-self: flex-start;
  background: rgba(230, 57, 70, 0.06);
  color: #B22222;
  border: 1.5px dashed var(--danger);
  border-bottom-left-radius: var(--space-xs);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.05);
}

.medibot-msg.warning a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 700;
}

.medibot-msg.warning a:hover {
  color: var(--primary-dark);
}

/* ── Quick Action Chips ──────────────────────────────────────── */
.medibot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 var(--space-md) var(--space-md);
  background: transparent;
}

.medibot-chip {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--gray-300);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.medibot-chip:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 119, 182, 0.15);
}

/* ── Chat Input Footer ───────────────────────────────────────── */
.medibot-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.medibot-input {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  padding: 0.6rem var(--space-md);
  font-size: 0.85rem;
  outline: none;
  background: var(--gray-100);
  transition: all var(--trans-fast);
}

.medibot-input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

.medibot-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--trans-fast);
  box-shadow: 0 4px 10px rgba(0, 119, 182, 0.15);
}

.medibot-send:hover {
  transform: scale(1.05);
  background: var(--primary-dark);
}

/* ── Typing Indicator ────────────────────────────────────────── */
.medibot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--gray-100);
  border-radius: var(--radius-md);
  align-self: flex-start;
  opacity: 0.8;
  margin-top: 4px;
}

.medibot-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--gray-500);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.medibot-typing span:nth-child(1) { animation-delay: -0.32s; }
.medibot-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Responsive Overrides */
@media (max-width: 480px) {
  .medibot-container {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .medibot-toggle {
    bottom: var(--space-md);
    right: var(--space-md);
  }
}
