/* ===================================================================
 *  captain-chris.css - Captain Chris character visual system
 *  Shared avatar + portrait components used wherever Captain Chris
 *  surfaces (dashboard AI widget, chat panel, dosing intelligence,
 *  marketing hero, knowledge cards).
 * =================================================================== */

/* ── Circular avatar (chat header, AI widget header, dosing byline) ── */
.cc-avatar {
  display: inline-block;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22d3ee, #0e7490);
  background-image: url("../img/captain-chris-face-transparent.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  position: relative;
  overflow: hidden;
  vertical-align: middle;
}

.cc-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.18), transparent 55%);
  pointer-events: none;
}

/* Size variants */
.cc-avatar--xs { width: 22px; height: 22px; }
.cc-avatar--sm { width: 28px; height: 28px; }
.cc-avatar--md { width: 36px; height: 36px; }
.cc-avatar--lg { width: 48px; height: 48px; }
.cc-avatar--xl { width: 64px; height: 64px; }

/* Live indicator dot — shows Captain Chris is "on watch" */
.cc-avatar--live::before {
  content: "";
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg-base, #04162a);
  z-index: 2;
  animation: cc-pulse 2.4s ease-in-out infinite;
}

@keyframes cc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* Subtle hover bob for interactive contexts */
.cc-avatar.cc-avatar--interactive {
  transition: transform 0.2s ease;
}
.cc-avatar.cc-avatar--interactive:hover {
  transform: translateY(-1px) scale(1.04);
}

/* ── Full portrait (marketing card, large dashboard contexts) ──── */
.cc-portrait {
  display: block;
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background-color: #0b3a55;
  background-image: url("../img/captain-chris-face-transparent.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow:
    0 18px 48px rgba(0, 212, 170, 0.18),
    0 4px 18px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(0, 212, 170, 0.4) inset;
}

/* ── Inline byline avatar (chat AI replies, dosing card byline) ── */
.cc-byline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-dim, #b8c4d6);
  font-style: italic;
}

.cc-byline .cc-avatar {
  flex-shrink: 0;
}

.cc-byline-name {
  font-weight: 600;
  color: var(--text-bright, #f8fafc);
  font-style: normal;
  letter-spacing: 0.01em;
}

/* ── FAB variant — chat-fab gets Captain Chris artwork when closed ── */
.chat-fab.cc-fab {
  background-image: url("../img/captain-chris-face-transparent.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-size: 0;
  color: transparent;
  /* Layered ring to keep the brand teal halo around the portrait */
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.45), 0 0 0 2px rgba(0, 212, 170, 0.4) inset;
}

.chat-fab.cc-fab.open {
  background-image: none;
  background: linear-gradient(135deg, var(--teal, #00d4aa), var(--blue, #1d4ed8));
  font-size: 1.1rem;
  color: #04162a;
}

/* ── Dosing Intelligence header with Captain Chris avatar ─────── */
.dosing-section-hdr.di-chris-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.di-chris-hdr-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal, #00d4aa);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* When the dosing-card byline wraps cc-byline, neutralize the legacy
   .di-chris-avatar default styles so the avatar and text align inline. */
.di-chris-avatar.cc-byline {
  display: flex;
  align-items: center;
  font-size: 0.74rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 8px;
  margin-top: 10px;
}

/* ── Chat AI message with inline Captain Chris avatar ─────────── */
.chat-msg.chat-msg--cc {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: flex-start;
  max-width: 92%;
}

.chat-msg.chat-msg--cc .cc-avatar {
  margin-top: 2px;
}

.chat-msg.chat-msg--cc .chat-msg-body {
  min-width: 0;
}


/* Print fallback: hide the avatar (it's decorative) */
@media print {
  .cc-avatar, .cc-portrait { background: none !important; box-shadow: none !important; }
}
