/* ============================================================
   GenAI Chat Assistant — Premium redesign
   ============================================================ */
:root {
  --mc-ai-navy: #0f172a;
  --mc-ai-navy-2: #1e3a8a;
  --mc-ai-blue: #2563eb;
  --mc-ai-gold: #d4af37;
  --mc-ai-gold-soft: #f0c14b;
  --mc-ai-surface: #f6f8fc;
}

/* ---- Floating launcher ---- */
.mc-ai-launcher {
  position: fixed; right: 1.75rem; bottom: 1.75rem; z-index: 1200;
  width: 64px; height: 64px; border-radius: 20px; border: none; cursor: pointer;
  background: linear-gradient(145deg, #1e3a8a 0%, #0f172a 100%);
  color: #fff; font-size: 1.5rem;
  box-shadow: 0 14px 34px rgba(15,23,42,.42), inset 0 1px 0 rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease, opacity .2s ease, border-radius .3s ease;
}
.mc-ai-launcher::after { content: ''; position: absolute; inset: 0; border-radius: inherit; border: 1px solid rgba(212,175,55,.35); pointer-events: none; }
.mc-ai-launcher:hover { transform: translateY(-3px) scale(1.06); border-radius: 24px; box-shadow: 0 20px 44px rgba(30,58,138,.5); }
.mc-ai-launcher:active { transform: scale(.96); }
.mc-ai-launcher.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.4) translateY(10px); }
.mc-ai-launcher i { position: relative; z-index: 2; }
/* small gold "online" dot on launcher */
.mc-ai-launcher .mc-ai-badge {
  position: absolute; top: -3px; right: -3px; width: 16px; height: 16px; border-radius: 50%;
  background: #22c55e; border: 2.5px solid #fff; z-index: 3;
}
.mc-ai-pulse {
  position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(212,175,55,.5); animation: mcPulse 2.4s infinite;
}
@keyframes mcPulse { 70% { box-shadow: 0 0 0 18px rgba(212,175,55,0); } 100% { box-shadow: 0 0 0 0 rgba(212,175,55,0); } }

/* ---- Panel shell ---- */
.mc-ai-panel {
  position: fixed; right: 1.75rem; bottom: 1.75rem; z-index: 1201;
  width: 396px; max-width: calc(100vw - 2rem); height: 600px; max-height: calc(100vh - 3rem);
  background: #fff; border-radius: 22px; overflow: hidden;
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: 0 32px 70px rgba(15,23,42,.34), 0 4px 14px rgba(15,23,42,.12);
  display: flex; flex-direction: column;
  /* keep children (esp. the header) clipped to the rounded top corners */
  -webkit-mask-image: -webkit-radial-gradient(#fff, #000);
  opacity: 0; transform: translateY(24px) scale(.94); transform-origin: bottom right; pointer-events: none;
  transition: opacity .28s ease, transform .32s cubic-bezier(.34,1.4,.64,1);
}
.mc-ai-panel.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ---- Header ---- */
.mc-ai-head {
  position: relative; overflow: hidden; flex: 0 0 auto; margin: 0;
  /* match the panel's rounded top corners so the header is flush to the very top */
  border-top-left-radius: 22px; border-top-right-radius: 22px;
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  color: #fff; padding: 1.05rem 1.1rem; display: flex; align-items: center; justify-content: space-between;
}
.mc-ai-head::before { /* subtle gold sheen */
  content: ''; position: absolute; top: -60%; right: -20%; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(212,175,55,.28), transparent 65%); pointer-events: none;
}
.mc-ai-head::after { /* gold underline accent */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--mc-ai-gold), transparent);
}
.mc-ai-id { display: flex; align-items: center; gap: .7rem; position: relative; z-index: 2; }
.mc-ai-id-av {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(145deg, rgba(255,255,255,.18), rgba(255,255,255,.06));
  border: 1px solid rgba(212,175,55,.5);
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: var(--mc-ai-gold-soft);
}
.mc-ai-id strong { display: block; font-size: 1rem; letter-spacing: .2px; font-weight: 700; }
.mc-ai-id small { display: flex; align-items: center; gap: .35rem; opacity: .9; font-size: .72rem; margin-top: 1px; }
.mc-ai-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: mcOnline 2s infinite; }
@keyframes mcOnline { 70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.mc-ai-close {
  position: relative; z-index: 2; background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; transition: background .18s ease, transform .18s ease;
}
.mc-ai-close:hover { background: rgba(239,68,68,.85); transform: rotate(90deg); }

/* ---- Message body ---- */
.mc-ai-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1.1rem 1rem; background: var(--mc-ai-surface);
  display: flex; flex-direction: column; gap: .8rem;
  background-image: radial-gradient(rgba(30,58,138,.05) 1px, transparent 1px);
  background-size: 22px 22px;
  scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
.mc-ai-body::-webkit-scrollbar { width: 6px; }
.mc-ai-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.mc-ai-msg { display: flex; gap: .55rem; align-items: flex-end; animation: mcMsgIn .3s ease both; }
@keyframes mcMsgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.mc-ai-user { flex-direction: row-reverse; }
.mc-ai-av {
  width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(145deg, #1e3a8a, #0f172a); color: var(--mc-ai-gold-soft);
  display: flex; align-items: center; justify-content: center; font-size: .78rem;
  border: 1px solid rgba(212,175,55,.4);
}
.mc-ai-bubble {
  max-width: 78%; padding: .68rem .85rem; border-radius: 16px; font-size: .89rem; line-height: 1.5;
  box-shadow: 0 2px 8px rgba(15,23,42,.06); word-wrap: break-word;
}
.mc-ai-assistant .mc-ai-bubble { background: #fff; color: #1e293b; border: 1px solid #e6ebf3; border-bottom-left-radius: 5px; }
.mc-ai-user .mc-ai-bubble { background: linear-gradient(135deg, #2563eb, #1e3a8a); color: #fff; border-bottom-right-radius: 5px; box-shadow: 0 4px 12px rgba(37,99,235,.28); }
.mc-ai-bubble strong { font-weight: 700; }
.mc-ai-assistant .mc-ai-bubble strong { color: var(--mc-ai-navy-2); }
.mc-ai-bubble table { width: 100%; border-collapse: collapse; margin: .45rem 0; font-size: .8rem; }
.mc-ai-bubble th, .mc-ai-bubble td { border: 1px solid #e2e8f0; padding: .28rem .45rem; text-align: left; }
.mc-ai-bubble th { background: #eef2ff; color: var(--mc-ai-navy-2); }
.mc-ai-typing .mc-ai-bubble { display: flex; gap: 5px; padding: .75rem .9rem; }
.mc-dot { width: 7px; height: 7px; background: #94a3b8; border-radius: 50%; animation: mcBlink 1.2s infinite; }
.mc-dot:nth-child(2) { animation-delay: .2s; } .mc-dot:nth-child(3) { animation-delay: .4s; }
@keyframes mcBlink { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

/* ---- Quick chips ---- */
.mc-ai-quick { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem .9rem; background: #fff; border-top: 1px solid #eef1f6; }
.mc-ai-chip {
  background: #fff; color: var(--mc-ai-navy-2); border: 1px solid #d5deee; border-radius: 999px;
  padding: .34rem .72rem; font-size: .75rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: all .18s ease; box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.mc-ai-chip:hover { background: linear-gradient(135deg, #1e3a8a, #0f172a); color: #fff; border-color: transparent; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(30,58,138,.28); }

/* ---- Input form ---- */
.mc-ai-form { flex-shrink: 0; display: flex; gap: .5rem; padding: .75rem .9rem; background: #fff; border-top: 1px solid #eef1f6; align-items: center; }
.mc-ai-form input {
  flex: 1; border: 1px solid #d5deee; border-radius: 12px; padding: .62rem .85rem; font-size: .88rem; outline: none;
  background: #f8fafc; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.mc-ai-form input::placeholder { color: #94a3b8; }
.mc-ai-form input:focus { border-color: var(--mc-ai-blue); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.mc-ai-form button {
  background: linear-gradient(135deg, #1e3a8a, #0f172a); color: var(--mc-ai-gold-soft); border: none;
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer; flex-shrink: 0; font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  box-shadow: 0 4px 12px rgba(15,23,42,.22);
}
.mc-ai-form button:hover:not(:disabled) { transform: translateY(-1px) scale(1.04); box-shadow: 0 6px 16px rgba(30,58,138,.35); }
.mc-ai-form button:active:not(:disabled) { transform: scale(.94); }
.mc-ai-form button:disabled { opacity: .45; cursor: default; }

/* ---- Footer / disclaimer ---- */
.mc-ai-disclaimer {
  flex-shrink: 0; font-size: .68rem; color: #94a3b8; text-align: center; padding: 0 .9rem .7rem; background: #fff;
  display: flex; align-items: center; justify-content: center; gap: .35rem;
}
.mc-ai-disclaimer i { color: var(--mc-ai-gold); }

@media (max-width: 480px) {
  .mc-ai-panel { right: .5rem; left: .5rem; bottom: .5rem; width: auto; height: calc(100vh - 1rem); border-radius: 18px; }
  .mc-ai-launcher { right: 1.1rem; bottom: 1.1rem; width: 58px; height: 58px; }
}

