/* ==========================================================================
   MediaVibes AI Agent — chat widget
   Self-contained: declares its own tokens so it drops into the site without
   depending on any other stylesheet. Brand colours and Montserrat unchanged.
   ========================================================================== */

.mv-chat-panel,
.mv-chat-float {
  --mvc-gold: #ffbf2f;
  --mvc-gold-soft: #ffd351;
  --mvc-gold-deep: #ffb300;
  --mvc-orange: #ff7a1a;
  --mvc-orange-deep: #ff6d00;
  --mvc-grad-gold: linear-gradient(135deg, #ffd351 0%, #ffb300 100%);
  --mvc-grad-brand: linear-gradient(120deg, #ffd351 0%, #ff9c4d 52%, #ff6d00 100%);
  --mvc-ink: #0f172a;
  --mvc-ink-soft: #64748b;
  --mvc-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------------------ launcher --- */

.mv-chat-float {
  position: fixed;
  right: 20px;
  bottom: 164px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--mvc-grad-brand);
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 0;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
  z-index: 1100;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mv-chat-float:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.3);
}

/* Attention ring until the agent has been opened once. */
.mv-chat-float.mv-attention::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 191, 47, 0.6);
  animation: mv-ring 2.6s ease-out infinite;
  pointer-events: none;
}

@keyframes mv-ring {
  0% { transform: scale(0.88); opacity: 0.9; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { opacity: 0; }
}

.mv-chat-tip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  white-space: nowrap;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--mvc-ink);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--mvc-ease), transform 0.25s var(--mvc-ease);
}

.mv-chat-float.mv-attention .mv-chat-tip { opacity: 1; transform: translateY(-50%) translateX(0); }

/* --------------------------------------------------------------- panel --- */

.mv-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(396px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 40px));
  z-index: 1400;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, #0c1626 0%, #091120 100%);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.28s var(--mvc-ease), transform 0.28s var(--mvc-ease),
    visibility 0.28s var(--mvc-ease);
}

.mv-chat-panel.is-open { opacity: 1; visibility: visible; transform: none; }

/* -------------------------------------------------------------- header --- */

.mv-chat-head {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(22rem 10rem at 0% 0%, rgba(255, 191, 47, 0.18), transparent 70%),
    rgba(255, 255, 255, 0.03);
}

.mv-chat-avatar {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--mvc-grad-brand);
  color: #111827;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(255, 191, 47, 0.28);
}

.mv-chat-titles { min-width: 0; flex: 1; }

.mv-chat-titles h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.mv-chat-head-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s var(--mvc-ease), color 0.2s var(--mvc-ease);
}

.mv-chat-head-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ---------------------------------------------------------------- body --- */

.mv-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.mv-chat-body::-webkit-scrollbar { width: 8px; }
.mv-chat-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 999px; }

.mv-msg {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 0.885rem;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: mv-msg-in 0.3s var(--mvc-ease) both;
}

@keyframes mv-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.mv-msg-bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom-left-radius: 6px;
  color: #e9eff8;
}

.mv-msg-user {
  align-self: flex-end;
  background: var(--mvc-grad-gold);
  border-bottom-right-radius: 6px;
  color: #14181f;
  font-weight: 600;
}

.mv-msg-note {
  align-self: center;
  max-width: 100%;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 122, 26, 0.12);
  border: 1px solid rgba(255, 122, 26, 0.26);
  color: #ffcda6;
  font-size: 0.76rem;
  text-align: center;
}

.mv-msg a { color: var(--mvc-gold); text-decoration: underline; }
.mv-msg-user a { color: #6b3f00; }

/* Typing indicator */
.mv-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.mv-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mvc-gold);
  opacity: 0.45;
  animation: mv-dot 1.3s ease-in-out infinite;
}

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

@keyframes mv-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ------------------------------------------------------------ starters --- */

.mv-chat-chips {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 16px 12px;
}

.mv-chip {
  border: 1px solid rgba(255, 191, 47, 0.3);
  background: rgba(255, 191, 47, 0.08);
  color: #ffdf9e;
  border-radius: 999px;
  padding: 7px 13px;
  font: inherit;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--mvc-ease), color 0.2s var(--mvc-ease),
    transform 0.2s var(--mvc-ease);
}

.mv-chip:hover { background: rgba(255, 191, 47, 0.18); color: #fff; transform: translateY(-1px); }

/* -------------------------------------------------------------- footer --- */

.mv-chat-foot {
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.mv-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 6px 6px 6px 14px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s var(--mvc-ease), box-shadow 0.2s var(--mvc-ease);
}

.mv-chat-form:focus-within {
  border-color: rgba(255, 191, 47, 0.5);
  box-shadow: 0 0 0 4px rgba(255, 191, 47, 0.12);
}

.mv-chat-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.885rem;
  line-height: 1.5;
  padding: 8px 0;
  max-height: 104px;
  resize: none;
  outline: none;
}

.mv-chat-input::placeholder { color: rgba(255, 255, 255, 0.38); }

.mv-chat-send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--mvc-grad-gold);
  color: #111827;
  font-size: 0.95rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s var(--mvc-ease), opacity 0.2s var(--mvc-ease);
}

.mv-chat-send:hover:not(:disabled) { transform: scale(1.06); }
.mv-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

.mv-chat-legal {
  margin: 9px 2px 0;
  text-align: center;
  font-size: 0.69rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.38);
}

.mv-chat-legal a { color: rgba(255, 191, 47, 0.8); }

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 768px) {
  .mv-chat-float {
    right: 16px;
    bottom: 152px;
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
}

@media (max-width: 575.98px) {
  .mv-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border-width: 0;
  }

  .mv-chat-tip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mv-chat-float.mv-attention::after { display: none; }
  .mv-msg, .mv-typing span { animation: none; }
}
