/* Smart Cascadia — Call Player styles (used with js/call-player.js)
   Theme it per page by overriding the --cp-* variables on .call-player. */

.call-player {
  --cp-unspoken: #4b5563;
  --cp-ai: #60a5fa;
  --cp-caller: #f3f4f6;
  --cp-avatar: #374151;
  --cp-bg: #030712; /* the background behind the player, for the transcript edge fades */
  max-width: 880px;
  margin: 0 auto;
  color: #fff; /* own text color, so it reads on pages whose body text is dark */
}
.call-player .cp-title { margin-bottom: 1.75rem; }

.cp-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.cp-play {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55);
  animation: cp-invite 2.4s ease-out infinite;
  transition: background-color 0.2s, transform 0.15s;
}
.cp-play:hover { background: #1d4ed8; transform: scale(1.05); }
.cp-play:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
.cp-play svg { width: 1.4rem; height: 1.4rem; }
.call-player.is-playing .cp-play { animation: none; }
@keyframes cp-invite {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55); }
  70%, 100% { box-shadow: 0 0 0 14px rgba(37, 99, 235, 0); }
}

.cp-meta { flex: 1; min-width: 0; }
.cp-status { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.45rem; }
.cp-progress-row { display: flex; align-items: center; gap: 0.75rem; }
.cp-progress {
  flex: 1;
  height: 6px;
  background: #1f2937;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
}
.cp-progress:focus-visible { outline: 2px solid #93c5fd; outline-offset: 4px; }
.cp-progress-fill { height: 100%; width: 0; background: #2563eb; border-radius: inherit; }
.cp-time { font-size: 0.8rem; color: #9ca3af; font-variant-numeric: tabular-nums; white-space: nowrap; }

.cp-volume { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.cp-mute {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid #374151;
  background: transparent;
  color: #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.cp-mute:hover { color: #fff; border-color: #6b7280; background: #1f2937; }
.cp-mute:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
.cp-mute svg { width: 1.15rem; height: 1.15rem; }
.cp-volume-slider {
  --cp-vol: 100%;
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #2563eb var(--cp-vol), #1f2937 var(--cp-vol));
  cursor: pointer;
}
.cp-volume-slider:focus-visible { outline: 2px solid #93c5fd; outline-offset: 4px; }
.cp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
}
.cp-volume-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: none; }
.cp-volume-slider::-moz-range-track { background: transparent; }
/* Phones control volume with their hardware buttons (iOS ignores page volume), so keep just the mute button there. */
@media (hover: none) and (pointer: coarse), (max-width: 480px) {
  .cp-volume-slider { display: none; }
}

.cp-video {
  width: 356px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  margin: 0 auto 1.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #000;
}
.cp-video iframe { display: block; width: 100%; height: 100%; }

.cp-stage { position: relative; }
.cp-stage::before,
.cp-stage::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2.5rem;
  pointer-events: none;
  z-index: 1;
}
.cp-stage::before { top: 0; background: linear-gradient(var(--cp-bg), transparent); }
.cp-stage::after { bottom: 0; background: linear-gradient(transparent, var(--cp-bg)); }
.cp-scroll {
  position: relative;
  height: 440px;
  overflow-y: auto;
  padding: 2rem 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: #1f2937 transparent;
}

.cp-turn {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  max-width: 58%;
  margin-bottom: 1.75rem;
}
.cp-turn.cp-side-left { margin-right: auto; padding-left: 4%; }
.cp-turn.cp-side-right { margin-left: auto; padding-right: 2%; }
.cp-avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--cp-avatar);
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}
.cp-avatar svg { width: 1.15rem; height: 1.15rem; }
.cp-name { font-size: 1.15rem; font-weight: 700; color: #fff; line-height: 1.3; margin-bottom: 0.2rem; }
.cp-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.4rem;
  width: fit-content;
  max-width: 100%;
  border-radius: 0.4rem;
}
.cp-name-label { display: inline-flex; align-items: center; gap: 0.4rem; }
/* Notes emerge from the edge of the name, so the container clips them while they slide in. */
.cp-notes { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; overflow: hidden; padding: 2px 0; }
.cp-notes:empty { display: none; }
.cp-note {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
  transform-origin: left center;
}
.cp-note[hidden] { display: none; }
/* Note colors: pick with "| color: name" (amber is the default). */
.cp-note.cp-note-color-green { color: #6ee7b7; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.45); }
.cp-note.cp-note-color-blue { color: #93c5fd; background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.45); }
.cp-note.is-typing .cp-note-text::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 0.85em;
  margin-left: 1px;
  vertical-align: -0.1em;
  background: currentColor;
  animation: cp-caret 0.7s steps(1) infinite;
}
@keyframes cp-caret { 50% { opacity: 0; } }
.cp-note-icon { width: 0.8rem; height: 0.8rem; flex-shrink: 0; }
.cp-note.is-new { animation: cp-note-slide 0.35s cubic-bezier(0.76, 0, 0.24, 1) both; }
@keyframes cp-note-slide {
  from { transform: translateX(-110%); opacity: 0; }
  50% { opacity: 1; }
  to { transform: none; opacity: 1; }
}
.cp-known-icon { width: 1rem; height: 1rem; color: #34d399; flex-shrink: 0; }
.cp-name.is-logging { animation: cp-logged-flash 2.4s ease-out; }
@keyframes cp-logged-flash {
  0% { background: rgba(52, 211, 153, 0.35); box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.35); }
  100% { background: rgba(52, 211, 153, 0); box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}
.cp-logged {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #052e1c;
  background: #34d399;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  animation: cp-logged-badge 2.6s ease-out forwards;
}
@keyframes cp-logged-badge {
  0% { opacity: 0; transform: translateY(4px); }
  12%, 75% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
.cp-initials { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.02em; }
.cp-text { font-size: 1.05rem; font-weight: 600; line-height: 1.55; color: var(--cp-unspoken); }
.cp-line { cursor: pointer; border-radius: 0.25rem; }
.cp-line:hover .cp-w:not(.is-spoken) { color: #6b7280; }
.cp-w { transition: color 0.18s ease-out; }
.cp-ai .cp-w.is-spoken { color: var(--cp-ai); }
.cp-caller .cp-w.is-spoken { color: var(--cp-caller); }

.cp-turn.is-active.cp-ai .cp-avatar { background: #2563eb; color: #fff; animation: cp-speaking 1.4s ease-in-out infinite; }
.cp-turn.is-active.cp-caller .cp-avatar { background: #e5e7eb; color: #111827; animation: cp-speaking-caller 1.4s ease-in-out infinite; }
@keyframes cp-speaking {
  0%, 100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(96, 165, 250, 0); }
}
@keyframes cp-speaking-caller {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 231, 235, 0.4); }
  50% { box-shadow: 0 0 0 7px rgba(229, 231, 235, 0); }
}

/* Status rows: a system check between turns (yellow while checking, green when done). */
.cp-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 58%;
  margin-top: -0.5rem;
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cp-unspoken);
  transition: color 0.3s;
}
.cp-check.cp-side-right { margin-left: auto; }
.cp-check-dot {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #374151;
  color: #052e1c;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}
.cp-check-dot svg { width: 0.65rem; height: 0.65rem; opacity: 0; }
.cp-check.is-checking { color: #fde68a; }
.cp-check.is-checking .cp-check-dot { background: #fbbf24; animation: cp-check-pulse 1s ease-in-out infinite; }
.cp-check.is-done { color: #6ee7b7; }
.cp-check.is-done .cp-check-dot { background: #34d399; animation: cp-check-pop 0.35s cubic-bezier(0.76, 0, 0.24, 1); }
.cp-check.is-done .cp-check-dot svg { opacity: 1; }
@keyframes cp-check-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
}
@keyframes cp-check-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.cp-error { text-align: center; color: #d1d5db; }
.cp-error a { color: #93c5fd; font-weight: 700; }

@media (max-width: 640px) {
  .cp-turn { max-width: 92%; }
  .cp-check { width: 92%; }
  .cp-turn.cp-side-left { padding-left: 0; }
  .cp-turn.cp-side-right { padding-right: 0; }
  .cp-scroll { height: 400px; }
  .cp-name { font-size: 1rem; }
  .cp-text { font-size: 0.98rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-play, .cp-turn.is-active .cp-avatar, .cp-name.is-logging, .cp-note.is-new, .cp-note-text::after, .cp-check-dot { animation: none !important; }
  .cp-w { transition: none; }
}
