/* =============================================
   magicco.ai — widget.css (v2)
   AI Receptionist Widget
   ============================================= */

/* === Container === */
#mc-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* === Toggle Button === */
#mc-toggle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #5B8EF0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(91, 142, 240, 0.45), 0 2px 8px rgba(0,0,0,0.25);
  transition: background 220ms ease, transform 220ms ease, box-shadow 220ms ease;
  position: relative;
  flex-shrink: 0;
}

#mc-toggle:hover {
  background: #3A6BD4;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(91, 142, 240, 0.55), 0 2px 8px rgba(0,0,0,0.25);
}

#mc-toggle:active { transform: translateY(0); }

/* Pulse ring — only when panel is closed */
#mc-toggle::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid #5B8EF0;
  opacity: 0;
  animation: mc-pulse 3s ease-out 2.5s infinite;
  pointer-events: none;
}
#mc-toggle.mc-active::after { animation: none; }

@keyframes mc-pulse {
  0%   { transform: scale(1);   opacity: 0.65; }
  100% { transform: scale(1.65); opacity: 0;   }
}

/* Notification dot */
#mc-toggle .mc-notif {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  background: #F56565;
  border: 2px solid #080A0C;
  border-radius: 50%;
}

/* === Panel === */
#mc-panel {
  width: 368px;
  max-height: 600px;
  background: #13171D;
  border: 1px solid #1E242C;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.65), 0 4px 16px rgba(0,0,0,0.35);

  /* Closed state */
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  transition: opacity 230ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 230ms cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: bottom right;
}

#mc-panel.mc-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* === Header === */
#mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0E1115;
  border-bottom: 1px solid #1E242C;
  flex-shrink: 0;
}

.mc-header-info {
  display: flex;
  align-items: center;
  gap: 11px;
}

.mc-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5B8EF0 0%, #3A6BD4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.mc-header-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #EDF2F7;
  letter-spacing: -0.015em;
}

.mc-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: #6B7A8F;
  margin-top: 1px;
  letter-spacing: 0.01em;
}

.mc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #48BB78;
  box-shadow: 0 0 5px rgba(72, 187, 120, 0.65);
  flex-shrink: 0;
}

.mc-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid #1E242C;
  border-radius: 6px;
  color: #6B7A8F;
  cursor: pointer;
  transition: color 180ms, border-color 180ms, background 180ms;
}
.mc-close:hover {
  color: #EDF2F7;
  border-color: #252C36;
  background: #1A1F28;
}

/* === Messages === */
#mc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  scroll-behavior: smooth;
}

#mc-messages::-webkit-scrollbar { width: 3px; }
#mc-messages::-webkit-scrollbar-track { background: transparent; }
#mc-messages::-webkit-scrollbar-thumb { background: #1E242C; border-radius: 2px; }

/* === Message Rows === */
.mc-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: mc-msg-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mc-msg-row.mc-user { flex-direction: row-reverse; }

@keyframes mc-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mc-msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5B8EF0, #3A6BD4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-bottom: 2px;
}

/* === Bubbles === */
.mc-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.58;
}

.mc-bubble-bot {
  background: #1A1F28;
  border: 1px solid #252C36;
  color: #A8B4C4;
  border-bottom-left-radius: 4px;
}

.mc-bubble-bot a {
  color: #5B8EF0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mc-bubble-bot strong { color: #EDF2F7; font-weight: 600; }

.mc-bubble-user {
  background: #5B8EF0;
  color: #fff;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

/* === Typing Indicator === */
.mc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  min-width: 50px;
}

.mc-typing span {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: #4A5568;
  border-radius: 50%;
  animation: mc-bounce 1.2s ease infinite;
}

.mc-typing span:nth-child(2) { animation-delay: 0.18s; }
.mc-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes mc-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.5; }
  30%            { transform: translateY(-5px); opacity: 1;   }
}

/* === Summary === */
.mc-summary {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
}

.mc-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.78rem;
  padding-bottom: 5px;
  border-bottom: 1px solid #252C36;
}

.mc-summary-row:last-child { border-bottom: none; padding-bottom: 0; }

.mc-summary-label {
  color: #6B7A8F;
  font-weight: 500;
  flex-shrink: 0;
}

.mc-summary-value {
  color: #EDF2F7;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

/* === Input Area === */
#mc-input-area {
  padding: 10px 12px 13px;
  border-top: 1px solid #1E242C;
  background: #0E1115;
  flex-shrink: 0;
}

/* === Path Selection === */
.mc-path-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mc-path-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  background: #13171D;
  border: 1px solid #252C36;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: background 180ms, border-color 180ms;
}

.mc-path-item:hover {
  background: #1A1F28;
  border-color: rgba(91, 142, 240, 0.35);
}

.mc-path-item:active { background: #1E242C; }

.mc-path-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(91, 142, 240, 0.1);
  border-radius: 7px;
  color: #5B8EF0;
  flex-shrink: 0;
}

.mc-path-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.mc-path-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #EDF2F7;
  letter-spacing: -0.01em;
}

.mc-path-tagline {
  font-size: 0.73rem;
  color: #6B7A8F;
}

.mc-path-arrow {
  color: #4A5568;
  flex-shrink: 0;
  transition: color 180ms, transform 180ms;
}

.mc-path-item:hover .mc-path-arrow {
  color: #5B8EF0;
  transform: translateX(2px);
}

/* === Text Input === */
.mc-text-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.mc-input,
.mc-textarea {
  flex: 1;
  background: #13171D;
  border: 1px solid #252C36;
  border-radius: 8px;
  color: #EDF2F7;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.5;
  padding: 10px 12px;
  outline: none;
  resize: none;
  min-width: 0;
  transition: border-color 180ms;
}

.mc-input::placeholder,
.mc-textarea::placeholder { color: #4A5568; }

.mc-input:focus,
.mc-textarea:focus { border-color: rgba(91, 142, 240, 0.5); }

.mc-input.mc-error { border-color: rgba(245, 101, 101, 0.55); }

.mc-textarea { min-height: 68px; max-height: 110px; }

/* === Send Button === */
.mc-send-btn {
  width: 36px;
  height: 36px;
  background: #5B8EF0;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 180ms, transform 180ms;
}

.mc-send-btn:hover { background: #3A6BD4; transform: translateY(-1px); }
.mc-send-btn:active { transform: translateY(0); }

/* === Input Error === */
.mc-input-error {
  display: block;
  font-size: 0.74rem;
  color: #FC8181;
  margin-top: 5px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 200ms ease;
}

.mc-input-error.mc-visible { max-height: 36px; }

/* === Chips === */
.mc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mc-chip {
  background: #13171D;
  border: 1px solid #252C36;
  border-radius: 99px;
  color: #A8B4C4;
  font-family: inherit;
  font-size: 0.79rem;
  font-weight: 500;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, color 160ms, transform 160ms;
}

.mc-chip:hover {
  background: #1E242C;
  border-color: rgba(91, 142, 240, 0.4);
  color: #EDF2F7;
  transform: translateY(-1px);
}

.mc-chip:active { transform: translateY(0); }

/* === Skip Button === */
.mc-skip-btn {
  display: block;
  background: none;
  border: none;
  color: #4A5568;
  font-family: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  padding: 7px 1px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 160ms;
}

.mc-skip-btn:hover { color: #6B7A8F; }

/* === Submit / Reset Buttons === */
.mc-submit-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mc-submit-btn {
  width: 100%;
  background: #5B8EF0;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
  transition: background 180ms, transform 180ms, box-shadow 180ms;
  box-shadow: 0 0 0 1px rgba(91, 142, 240, 0.3), 0 3px 14px rgba(91, 142, 240, 0.2);
  letter-spacing: -0.01em;
}

.mc-submit-btn:hover {
  background: #3A6BD4;
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(91, 142, 240, 0.4), 0 6px 18px rgba(91, 142, 240, 0.28);
}

.mc-submit-btn:active { transform: translateY(0); }

.mc-reset-btn {
  width: 100%;
  background: none;
  border: 1px solid #1E242C;
  border-radius: 8px;
  color: #6B7A8F;
  font-family: inherit;
  font-size: 0.79rem;
  font-weight: 500;
  padding: 9px;
  cursor: pointer;
  transition: border-color 180ms, color 180ms, background 180ms;
}

.mc-reset-btn:hover {
  border-color: #252C36;
  color: #A8B4C4;
  background: rgba(255,255,255,0.02);
}

/* === Spinner === */
.mc-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  color: #6B7A8F;
  font-size: 0.82rem;
}

.mc-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #1E242C;
  border-top-color: #5B8EF0;
  border-radius: 50%;
  animation: mc-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes mc-spin { to { transform: rotate(360deg); } }

/* === Done State === */
.mc-done { padding: 2px 0; }

/* === Mobile === */
@media (max-width: 480px) {
  #mc-widget {
    bottom: 16px;
    right: 16px;
  }

  #mc-panel {
    width: calc(100vw - 32px);
    max-height: 75vh;
  }
}
