/* Mastermind Gurukul AI Widget v3 */
/* Colors from mastermindgurukul.com: Blue #1a3c6e / Yellow #f5c518 / White */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --mmg-blue:      #1a3c6e;
  --mmg-blue-dark: #0f2444;
  --mmg-yellow:    #f5c518;
  --mmg-yellow2:   #ffdd57;
  --mmg-white:     #ffffff;
  --mmg-bg:        #f0f4ff;
  --mmg-border:    #dce5f5;
  --mmg-text:      #1a2540;
  --mmg-muted:     #6b7a99;
  --mmg-shadow:    0 8px 40px rgba(26,60,110,.22), 0 2px 8px rgba(0,0,0,.10);
}

/* ── Root ─────────────────────────────── */
.mmg-root {
  position: fixed;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
}
.mmg-pos-bottom-right { bottom: 22px; right: 22px; }
.mmg-pos-bottom-left  { bottom: 22px; left: 22px; align-items: flex-start; }
.mmg-pos-top-right    { top: 22px; right: 22px; flex-direction: column-reverse; }
.mmg-pos-top-left     { top: 22px; left: 22px; flex-direction: column-reverse; align-items: flex-start; }

/* ── Greeting Bubble ──────────────────── */
.mmg-greet-bubble {
  position: relative;
  background: var(--mmg-white);
  border: 1.5px solid var(--mmg-border);
  border-radius: 16px 16px 4px 16px;
  box-shadow: var(--mmg-shadow);
  color: var(--mmg-text);
  font-size: 13px;
  line-height: 1.55;
  max-width: 260px;
  padding: 12px 36px 12px 14px;
  animation: mmg-bubble-in .45s cubic-bezier(.34,1.56,.64,1) both;
  animation-delay: 1.5s;
  opacity: 0;
}
.mmg-pos-bottom-left .mmg-greet-bubble,
.mmg-pos-top-left    .mmg-greet-bubble { border-radius: 16px 16px 16px 4px; }

@keyframes mmg-bubble-in {
  from { opacity:0; transform:translateY(12px) scale(.92); }
  to   { opacity:1; transform:translateY(0)    scale(1); }
}
.mmg-greet-bubble p { margin: 0; }
.mmg-greet-close {
  position: absolute; top: 7px; right: 8px;
  background: none; border: none; color: var(--mmg-muted);
  cursor: pointer; font-size: 12px; line-height: 1; padding: 2px;
  transition: color .15s;
}
.mmg-greet-close:hover { color: var(--mmg-blue); }

/* ── FAB ──────────────────────────────── */
.mmg-fab {
  align-items: center;
  background: linear-gradient(135deg, var(--mmg-blue), var(--mmg-blue-dark));
  border: none;
  border-radius: 56px;
  box-shadow: 0 4px 20px rgba(26,60,110,.45), 0 2px 6px rgba(0,0,0,.2);
  color: var(--mmg-white);
  cursor: pointer;
  display: flex;
  gap: 8px;
  padding: 13px 20px 13px 16px;
  position: relative;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  animation: mmg-fab-in .5s cubic-bezier(.34,1.56,.64,1) .3s both;
}
@keyframes mmg-fab-in {
  from { transform:scale(0) translateY(30px); opacity:0; }
  to   { transform:scale(1) translateY(0);    opacity:1; }
}
.mmg-fab:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 8px 28px rgba(26,60,110,.55);
}
.mmg-fab-txt  { font-size: 14px; font-weight: 600; letter-spacing:.2px; white-space:nowrap; }
.mmg-fab-icon, .mmg-fab-close-icon { display:flex; align-items:center; }

/* Yellow accent stripe on FAB */
.mmg-fab::after {
  content:'';
  position: absolute;
  bottom: 0; left: 14px; right: 14px;
  height: 3px;
  background: var(--mmg-yellow);
  border-radius: 2px;
}

/* Pulse ring */
.mmg-fab::before {
  content:'';
  position: absolute; inset: -6px;
  border-radius: 60px;
  border: 2px solid rgba(26,60,110,.35);
  animation: mmg-ring 2.8s ease-out infinite;
}
@keyframes mmg-ring {
  0%  { transform:scale(1);    opacity:.6; }
  70% { transform:scale(1.22); opacity:0; }
  100%{ transform:scale(1.22); opacity:0; }
}

/* Notification dot */
.mmg-fab-notif {
  position: absolute; top: -4px; right: -4px;
  width: 14px; height: 14px;
  background: #e53935; border-radius: 50%;
  border: 2px solid #fff;
  animation: mmg-notif-pop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes mmg-notif-pop { from{transform:scale(0)} to{transform:scale(1)} }

/* ── Panel ────────────────────────────── */
.mmg-panel {
  background: var(--mmg-white);
  border: 1.5px solid var(--mmg-border);
  border-radius: 18px;
  box-shadow: var(--mmg-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 360px;
  max-height: 560px;
  transform-origin: bottom right;
  animation: mmg-panel-in .3s cubic-bezier(.34,1.56,.64,1) both;
}
.mmg-pos-bottom-left .mmg-panel,
.mmg-pos-top-left    .mmg-panel { transform-origin: bottom left; }
@keyframes mmg-panel-in {
  from { opacity:0; transform:scale(.88) translateY(14px); }
  to   { opacity:1; transform:scale(1)   translateY(0); }
}

/* Header */
.mmg-hdr {
  background: linear-gradient(135deg, var(--mmg-blue), var(--mmg-blue-dark));
  border-bottom: 3px solid var(--mmg-yellow);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex-shrink: 0;
}
.mmg-hdr-logo {
  height: 36px; width: auto; max-width: 80px;
  border-radius: 6px; object-fit: contain;
  background: white; padding: 3px;
}
.mmg-hdr-info { flex: 1; min-width: 0; }
.mmg-hdr-title {
  color: var(--mmg-yellow);
  font-size: 13px; font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mmg-hdr-status {
  color: rgba(255,255,255,.75);
  font-size: 10.5px; display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.mmg-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4caf50;
  animation: mmg-blink 2s ease-in-out infinite;
}
@keyframes mmg-blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.mmg-hdr-btns { display:flex; gap:4px; flex-shrink:0; }
.mmg-hdr-btn {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 7px;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: 5px 7px;
  display: flex; align-items: center;
  transition: all .15s;
}
.mmg-hdr-btn:hover { background: rgba(255,255,255,.22); color:#fff; }

/* Name bar */
.mmg-name-bar {
  background: var(--mmg-bg);
  border-bottom: 1px solid var(--mmg-border);
  display: flex; gap: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
}
.mmg-name-bar input,
.mmg-name-bar select {
  background: var(--mmg-white);
  border: 1.5px solid var(--mmg-border);
  border-radius: 8px;
  color: var(--mmg-text);
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  outline: none;
  padding: 6px 10px;
  transition: border-color .2s;
}
.mmg-name-bar input { flex: 1; }
.mmg-name-bar select { width: 110px; flex-shrink: 0; }
.mmg-name-bar input:focus, .mmg-name-bar select:focus { border-color: var(--mmg-blue); }

/* Messages */
.mmg-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.mmg-msgs::-webkit-scrollbar { width: 4px; }
.mmg-msgs::-webkit-scrollbar-thumb { background: var(--mmg-blue); border-radius: 10px; opacity:.4; }

/* Welcome */
.mmg-welcome {
  display: flex; gap: 9px; align-items: flex-start;
  animation: mmg-fadein .4s ease-out;
}
.mmg-welcome-ava {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--mmg-blue), var(--mmg-blue-dark));
  border: 2px solid var(--mmg-yellow);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.mmg-welcome-bbl {
  background: var(--mmg-bg);
  border: 1.5px solid var(--mmg-border);
  border-radius: 14px; border-top-left-radius: 3px;
  color: var(--mmg-text);
  font-size: 13px; line-height: 1.6;
  padding: 10px 13px;
}

/* Messages */
.mmg-msg { display:flex; gap:8px; animation: mmg-fadein .3s ease-out; }
.mmg-msg.mmg-user { flex-direction: row-reverse; }
@keyframes mmg-fadein {
  from{opacity:0;transform:translateY(8px)}
  to  {opacity:1;transform:translateY(0)}
}
.mmg-ava {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--mmg-blue);
  border: 2px solid var(--mmg-yellow);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; color: white;
}
.mmg-msg.mmg-user .mmg-ava { background: var(--mmg-yellow); border-color: var(--mmg-blue); }
.mmg-bbl {
  max-width: 80%;
  font-size: 13px; line-height: 1.6;
  padding: 9px 13px;
  border-radius: 14px;
}
.mmg-msg.mmg-ai   .mmg-bbl {
  background: var(--mmg-bg);
  border: 1.5px solid var(--mmg-border);
  border-top-left-radius: 3px;
  color: var(--mmg-text);
}
.mmg-msg.mmg-user .mmg-bbl {
  background: linear-gradient(135deg, var(--mmg-blue), var(--mmg-blue-dark));
  border-top-right-radius: 3px;
  color: white;
}

/* Typing dots */
.mmg-typing {
  display:flex; align-items:center; gap:4px;
  padding: 9px 13px;
  background: var(--mmg-bg);
  border: 1.5px solid var(--mmg-border);
  border-radius: 14px; border-top-left-radius: 3px;
  width: fit-content;
}
.mmg-typing span {
  width: 7px; height: 7px;
  background: var(--mmg-blue); border-radius: 50%;
  animation: mmg-bounce 1.2s ease-in-out infinite;
}
.mmg-typing span:nth-child(2){animation-delay:.2s}
.mmg-typing span:nth-child(3){animation-delay:.4s}
@keyframes mmg-bounce {
  0%,80%,100%{transform:translateY(0);opacity:.4}
  40%         {transform:translateY(-7px);opacity:1}
}

/* Error */
.mmg-err {
  background: #fff0f0; border: 1px solid #ffcccc;
  border-radius: 8px; color: #c0392b;
  font-size: 12px; padding: 8px 12px; text-align:center;
}

/* Quick chips */
.mmg-chips {
  border-top: 1px solid var(--mmg-border);
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px; flex-shrink: 0;
  background: #fafcff;
}
.mmg-chip {
  background: white;
  border: 1.5px solid var(--mmg-border);
  border-radius: 20px;
  color: var(--mmg-blue);
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 11px; font-weight: 500;
  padding: 4px 11px;
  transition: all .18s;
}
.mmg-chip:hover {
  background: var(--mmg-blue);
  border-color: var(--mmg-blue);
  color: white;
}

/* Input bar */
.mmg-input-bar {
  align-items: flex-end;
  background: white;
  border-top: 1.5px solid var(--mmg-border);
  display: flex; gap: 8px;
  padding: 10px 12px;
  flex-shrink: 0;
}
.mmg-input-bar textarea {
  background: var(--mmg-bg);
  border: 1.5px solid var(--mmg-border);
  border-radius: 12px;
  color: var(--mmg-text);
  flex: 1;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  max-height: 90px; resize: none;
  outline: none;
  padding: 9px 12px;
  transition: border-color .2s;
}
.mmg-input-bar textarea:focus { border-color: var(--mmg-blue); }
#mmg-send {
  background: linear-gradient(135deg, var(--mmg-blue), var(--mmg-blue-dark));
  border: none; border-radius: 12px;
  color: white; cursor: pointer;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .2s;
  flex-shrink: 0;
}
#mmg-send:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 4px 14px rgba(26,60,110,.4);
}
#mmg-send:disabled { opacity:.4; cursor:not-allowed; transform:none; }

/* Yellow accent line inside send btn */
#mmg-send::after {
  display: none; /* keep it clean */
}

/* Powered by */
.mmg-powered {
  background: var(--mmg-bg);
  border-top: 1px solid var(--mmg-border);
  color: var(--mmg-muted);
  font-size: 10px;
  padding: 5px 12px;
  text-align: center;
  flex-shrink: 0;
}
.mmg-powered a { color: var(--mmg-blue); text-decoration: none; font-weight: 600; }
.mmg-powered a:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 420px) {
  .mmg-panel { width: calc(100vw - 28px); max-height: 80vh; }
  .mmg-pos-bottom-right, .mmg-pos-top-right { right: 10px; }
  .mmg-pos-bottom-left,  .mmg-pos-top-left  { left: 10px; }
  .mmg-pos-bottom-right, .mmg-pos-bottom-left { bottom: 10px; }
  .mmg-pos-top-right,    .mmg-pos-top-left    { top: 10px; }
}
