/* ============================================================
   McMillanAI — AI Coach Widget
   Self-contained. Internal pages only. Backend: coach-chat.
   All classes prefixed .mc- to avoid collisions with page CSS.
   ============================================================ */

:root {
  --mc-navy: #0F1B2D;
  --mc-navy-light: #1A2A42;
  --mc-gold: #C9A84C;
  --mc-gold-soft: #D8BD6E;
  --mc-white: #FFFFFF;
  --mc-off-white: #F5F6F8;
  --mc-text: #2A3142;
  --mc-gray: #6B7787;
  --mc-border: #D1D9E0;
}

/* ---- Floating launcher ---- */
#mc-coach-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  background: var(--mc-navy);
  color: var(--mc-gold);
  border: 1.5px solid var(--mc-gold);
  border-radius: 999px;
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(15, 27, 45, 0.35);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
#mc-coach-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(15, 27, 45, 0.45);
  background: var(--mc-navy-light);
}
#mc-coach-launcher svg { width: 19px; height: 19px; }
#mc-coach-launcher.mc-open { background: var(--mc-gold); color: var(--mc-navy); border-color: var(--mc-gold); }

/* ---- Chat window ---- */
#mc-coach-window {
  position: fixed;
  right: 24px;
  bottom: 88px;
  z-index: 9001;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--mc-off-white);
  border: 1px solid var(--mc-border);
  border-top: 3px solid var(--mc-gold);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15, 27, 45, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'DM Sans', -apple-system, sans-serif;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#mc-coach-window.mc-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---- Header ---- */
.mc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--mc-navy);
  border-bottom: 2px solid var(--mc-gold);
  flex-shrink: 0;
}
.mc-head-icon {
  width: 30px; height: 30px;
  background: var(--mc-gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mc-head-icon svg { width: 16px; height: 16px; fill: var(--mc-navy); }
.mc-head-text { flex: 1; min-width: 0; }
.mc-head-name {
  font-size: 14px; font-weight: 700; color: var(--mc-white);
  display: flex; align-items: center; gap: 7px;
}
.mc-head-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--mc-navy); background: var(--mc-gold);
  padding: 2px 6px; border-radius: 3px;
}
.mc-head-status { font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 1px; }
.mc-head-close {
  background: transparent; border: none; color: var(--mc-gold);
  cursor: pointer; padding: 4px; display: flex; flex-shrink: 0;
}
.mc-head-close svg { width: 18px; height: 18px; }
.mc-head-expand {
  background: transparent; border: none; color: var(--mc-gold);
  cursor: pointer; padding: 4px; display: flex; flex-shrink: 0;
}
.mc-head-expand svg { width: 15px; height: 15px; }
.mc-head-expand:hover, .mc-head-close:hover { color: var(--mc-gold-soft); }

/* Expanded (larger) window */
#mc-coach-window.mc-expanded {
  width: 640px;
  height: 820px;
  max-height: calc(100vh - 120px);
}

/* ---- Messages ---- */
.mc-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--mc-off-white);
}
.mc-messages::-webkit-scrollbar { width: 5px; }
.mc-messages::-webkit-scrollbar-thumb { background: var(--mc-gold); border-radius: 3px; }

.mc-welcome { padding: 6px 2px; }
.mc-welcome h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 19px; color: var(--mc-navy); margin: 0 0 4px;
}
.mc-welcome-note {
  font-size: 11px; color: var(--mc-gray);
  text-transform: uppercase; letter-spacing: 1px; margin: 0 0 10px;
}
.mc-welcome-msg { font-size: 13.5px; line-height: 1.6; color: var(--mc-text); margin: 0 0 14px; }
.mc-suggestions { display: flex; flex-direction: column; gap: 7px; }
.mc-suggestion {
  text-align: left; padding: 9px 12px;
  background: var(--mc-white); border: 1px solid var(--mc-border);
  border-radius: 6px; font-size: 13px; color: var(--mc-text);
  cursor: pointer; font-family: inherit; line-height: 1.45;
  transition: border-color .15s ease, background .15s ease;
}
.mc-suggestion:hover { border-color: var(--mc-gold); background: #FFFBF0; }

.mc-msg { display: flex; flex-direction: column; gap: 3px; max-width: 92%; }
.mc-msg.mc-user { align-self: flex-end; align-items: flex-end; }
.mc-msg.mc-bot { align-self: flex-start; align-items: flex-start; }
.mc-msg-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--mc-gray);
}
.mc-msg-bubble { padding: 10px 13px; font-size: 13.5px; line-height: 1.65; border-radius: 8px; }
.mc-msg.mc-user .mc-msg-bubble { background: var(--mc-navy); color: var(--mc-white); }
.mc-msg.mc-bot .mc-msg-bubble {
  background: var(--mc-white); color: var(--mc-text);
  border-left: 3px solid var(--mc-gold);
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.mc-msg-bubble strong { font-weight: 700; }
.mc-msg-bubble em { font-style: italic; }

.mc-typing { display: flex; gap: 4px; padding: 3px 0; }
.mc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mc-gold); opacity: 0.4;
  animation: mc-bounce 1.2s infinite ease-in-out;
}
.mc-typing span:nth-child(2) { animation-delay: 0.15s; }
.mc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mc-bounce {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ---- Input ---- */
.mc-input-area {
  flex-shrink: 0; display: flex; gap: 8px;
  padding: 11px 12px; background: var(--mc-white);
  border-top: 1px solid var(--mc-border);
}
.mc-input {
  flex: 1; resize: none; border: 1px solid var(--mc-border);
  border-radius: 6px; padding: 9px 11px;
  font-family: inherit; font-size: 13.5px; line-height: 1.5;
  color: var(--mc-text); background: var(--mc-off-white);
  outline: none; max-height: 96px; transition: border-color .15s ease;
}
.mc-input:focus { border-color: var(--mc-gold); }
.mc-input::placeholder { color: #A0AEC0; }
.mc-send {
  flex-shrink: 0; align-self: stretch;
  padding: 0 16px; background: var(--mc-gold); color: var(--mc-navy);
  border: none; border-radius: 6px; font-family: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity .15s ease;
}
.mc-send:disabled { opacity: 0.45; cursor: default; }

.mc-foot {
  flex-shrink: 0; padding: 7px 12px; text-align: center;
  font-size: 10.5px; color: var(--mc-gray);
  background: var(--mc-white); border-top: 1px solid var(--mc-border);
}

/* ---- Mobile ---- */
@media (max-width: 560px) {
  #mc-coach-window,
  #mc-coach-window.mc-expanded {
    right: 0; bottom: 0; width: 100vw; max-width: 100vw;
    height: 100vh; max-height: 100vh; border-radius: 0;
    border-left: none; border-right: none; border-bottom: none;
  }
  #mc-coach-launcher { right: 16px; bottom: 16px; }
  .mc-head-expand { display: none; }
}
