/* ============================================================
   Phone module — reusable iPhone-style mockup that renders
   per-modality content (video, voice, chat, sms, portal).

   Ported and adapted from the Arbiter Interactive Collateral
   project's phone styling. All collateral CSS variables
   (--red, --grey-*, --green, --blue, --white, --dark, --font,
   --ease-out) are mapped to our local design tokens here.
   ============================================================ */

/* Internal aliases so we can paste collateral rules with minimal edits.
   These are scoped to .arb-phone so they don't leak elsewhere. */
.arb-phone {
  --red: var(--red-600);
  --red-soft: var(--red-400);
  --green: rgb(34, 175, 95);
  --blue:  rgb(91, 106, 191);
  --grey-50:  var(--ink-100);
  --grey-100: var(--ink-200);
  --grey-200: var(--ink-300);
  --grey-300: var(--ink-400);
  --grey-400: var(--ink-500);
  --grey-500: var(--ink-600);
  --grey-700: var(--ink-800);
  --white:    var(--ink-0);
  --dark:     rgb(18, 18, 22);
  --font:     var(--font-text);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

/* ── Frame ──────────────────────────────────────────────── */
.arb-phone {
  width: 320px;
  height: 660px;
  background: #000;
  border-radius: 46px;
  padding: 13px;
  position: relative;
  box-shadow:
    inset 0 0 0 2px #2a2a2e,
    0 30px 70px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.08);
  font-family: var(--font);
  color: var(--ink-900);
  flex-shrink: 0;
}

.arb-phone-notch {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 26px;
  background: #000;
  border-radius: 13px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.arb-phone-notch-cam {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a1a2e;
  border: 2px solid #222;
}

.arb-phone-status-bar {
  position: absolute;
  top: 17px;
  left: 34px;
  right: 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9;
  color: white;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}
.arb-phone-status-bar .psb-icons {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 10px;
}
.arb-phone-status-bar .psb-signal {
  letter-spacing: -1px;
  font-size: 8px;
}

.arb-phone-screen {
  width: 100%;
  height: 100%;
  background: var(--white);
  border-radius: 36px;
  overflow: hidden;
  position: relative;
}

.arb-phone-screen-inner {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.arb-phone-home-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  z-index: 10;
  pointer-events: none;
}

/* ── Phone-content wrapper (one per modality) ──────────── */
.arb-phone .phone-content {
  position: absolute;
  inset: 0;
  padding-top: 28px;
}

/* Slide/fade transitions between steps. The cycle controller
   adds .is-leaving on the old, .is-entering on the new. */
.arb-phone .phone-content.is-leaving {
  animation: arb-phone-leave 320ms var(--ease-out) forwards;
}
.arb-phone .phone-content.is-entering {
  animation: arb-phone-enter 380ms var(--ease-out) forwards;
}
@keyframes arb-phone-leave {
  to { opacity: 0; transform: translateX(-22px); }
}
@keyframes arb-phone-enter {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ════════════════════════════════════════════════════════════════
   VIDEO
   ════════════════════════════════════════════════════════════════ */
.arb-phone .pc-video { background: var(--dark); }

.arb-phone .video-cover {
  width: calc(100% - 24px);
  height: 230px;
  margin: 16px 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* Silent autoplay preview inside the cover. Sits behind the play
   button so the play CTA stays the focal point. A subtle dim layer
   improves play-button contrast over bright frames. */
.arb-phone .video-cover .video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}
.arb-phone .video-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.30) 100%);
  z-index: 1;
  pointer-events: none;
}
.arb-phone .video-cover .video-play-btn {
  position: relative;
  z-index: 2;
}
.arb-phone .video-play-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  animation: arb-pulse-play 2s ease-in-out infinite;
}
.arb-phone .video-play-btn:hover { background: rgba(255, 255, 255, 0.40); transform: scale(1.08); }
.arb-phone .video-play-btn svg { width: 34px; height: 34px; fill: white; margin-left: 4px; }
@keyframes arb-pulse-play {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
  50% { box-shadow: 0 0 0 22px rgba(255, 255, 255, 0); }
}

.arb-phone .video-info { padding: 0 18px; color: white; }
.arb-phone .video-title { font-size: 21px; font-weight: 700; margin-bottom: 6px; line-height: 1.22; }
.arb-phone .video-subtitle { font-size: 15px; color: var(--grey-400); margin-bottom: 18px; }
.arb-phone .video-bullets { list-style: none; padding: 0; margin: 0; }
.arb-phone .video-bullets li {
  font-size: 15px; color: rgba(255, 255, 255, 0.78);
  padding: 6px 0; display: flex; align-items: flex-start; gap: 10px;
  line-height: 1.4;
}
.arb-phone .video-bullets li::before {
  content: '\2713';
  color: var(--red);
  font-weight: 700;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.4;
}
.arb-phone .video-cta {
  display: block;
  margin: 20px 18px 0;
  padding: 14px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  font-family: var(--font);
  cursor: pointer;
  width: calc(100% - 36px);
}

/* Inline video player (replaces the cover thumbnail when playing) */
.arb-phone .video-inline-player {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #000;
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.arb-phone .video-inline-player video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.arb-phone .video-inline-close {
  position: absolute;
  top: 38px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: white;
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  font-family: var(--font);
  line-height: 1;
}
.arb-phone .video-inline-close:hover { background: rgba(0, 0, 0, 0.8); }

/* ════════════════════════════════════════════════════════════════
   CHAT
   ════════════════════════════════════════════════════════════════ */
.arb-phone .pc-chat { background: var(--grey-50); display: flex; flex-direction: column; }
.arb-phone .chat-header {
  background: var(--white);
  padding: 10px 14px;
  margin-top: 16px;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  gap: 10px;
}
.arb-phone .chat-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 700;
}
.arb-phone .chat-name { font-size: 15px; font-weight: 700; }
.arb-phone .chat-status { font-size: 11px; color: var(--green); font-weight: 500; }

.arb-phone .chat-messages {
  flex: 1;
  padding: 12px 12px 6px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  scroll-behavior: smooth;
}
.arb-phone .chat-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}
.arb-phone .chat-msg.ai {
  background: var(--white);
  border: 1px solid var(--grey-200);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}
.arb-phone .chat-msg.member {
  background: var(--blue);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}
.arb-phone .chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 11px 14px;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
}
.arb-phone .chat-typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--grey-400);
  animation: arb-typing 1.4s ease-in-out infinite;
}
.arb-phone .chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.arb-phone .chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes arb-typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

.arb-phone .chat-input {
  padding: 9px 12px;
  background: var(--white);
  border-top: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  gap: 8px;
}
.arb-phone .chat-input-field {
  flex: 1; height: 32px;
  border: 1px solid var(--grey-200);
  border-radius: 16px;
  padding: 0 12px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--grey-400);
  display: flex;
  align-items: center;
}
.arb-phone .chat-input-send {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--blue);
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ════════════════════════════════════════════════════════════════
   SMS
   ════════════════════════════════════════════════════════════════ */
.arb-phone .pc-sms { background: var(--white); display: flex; flex-direction: column; }
.arb-phone .sms-header {
  padding: 10px 14px;
  margin-top: 16px;
  text-align: center;
  border-bottom: 1px solid var(--grey-200);
}
.arb-phone .sms-header-name { font-size: 15px; font-weight: 700; }
.arb-phone .sms-header-sub { font-size: 12px; color: var(--grey-400); }
.arb-phone .sms-messages {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.arb-phone .sms-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
  word-break: break-word;
}
.arb-phone .sms-bubble.incoming {
  background: var(--grey-100);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}
.arb-phone .sms-bubble.outgoing {
  background: var(--green);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}
.arb-phone .sms-delivered {
  font-size: 9px;
  color: var(--grey-400);
  text-align: right;
  margin-top: 0;
  margin-right: 4px;
}

/* ════════════════════════════════════════════════════════════════
   VOICE
   ════════════════════════════════════════════════════════════════ */
.arb-phone .pc-voice {
  background: linear-gradient(180deg, #1a1a2e 0%, #0a0a15 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
}
.arb-phone .voice-caller { margin-top: 32px; text-align: center; }
.arb-phone .voice-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #FF6B6B);
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
  animation: arb-avatar-ring 3s ease-in-out infinite;
}
@keyframes arb-avatar-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(218, 30, 64, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(218, 30, 64, 0); }
}
.arb-phone .voice-name { font-size: 19px; font-weight: 700; margin-bottom: 2px; }
.arb-phone .voice-subtitle { font-size: 13px; color: var(--grey-400); margin-bottom: 6px; }
.arb-phone .voice-timer {
  font-size: 14px;
  color: var(--green);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.arb-phone .voice-waveform {
  display: flex; align-items: center; justify-content: center;
  gap: 3px; height: 38px; margin: 18px 0 6px;
}
.arb-phone .wave-bar {
  width: 3px; border-radius: 2px;
  background: var(--red);
  animation: arb-waveBar 1.2s ease-in-out infinite;
}
.arb-phone.is-paused .wave-bar { animation-play-state: paused; opacity: 0.35; }
@keyframes arb-waveBar {
  0%, 100% { height: 6px; opacity: 0.4; }
  50% { height: 28px; opacity: 1; }
}

.arb-phone .voice-player {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px;
  margin: 4px 14px 14px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
}
.arb-phone .voice-player-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--red);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
  animation: arb-pulse-play-red 2s ease-in-out infinite;
  padding-left: 2px; /* nudge the ▶ glyph optically center */
}
.arb-phone .voice-player-btn:hover {
  background: var(--red-700, #b8001b);
  transform: scale(1.06);
}
.arb-phone .voice-player.playing .voice-player-btn,
.arb-phone .voice-player-btn:focus-visible { animation: none; }
@keyframes arb-pulse-play-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(218, 30, 64, 0.45); }
  50% { box-shadow: 0 0 0 14px rgba(218, 30, 64, 0); }
}
.arb-phone .voice-player-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: center;
  flex-shrink: 0;
}
.arb-phone .voice-player-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.arb-phone .voice-player-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--red); cursor: pointer; border: none;
}
.arb-phone .voice-player-slider::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--red); cursor: pointer; border: none;
}

.arb-phone .voice-transcript {
  width: 100%;
  padding: 0 14px 6px;
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.arb-phone .voice-transcript-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--grey-500);
  margin-bottom: 8px;
}
.arb-phone .transcript-line {
  display: flex;
  gap: 7px;
  margin-bottom: 6px;
  font-size: 12.5px;
  line-height: 1.45;
}
.arb-phone .transcript-speaker {
  font-weight: 700;
  flex-shrink: 0;
  min-width: 22px;
}
.arb-phone .transcript-speaker.ai { color: var(--red); }
.arb-phone .transcript-speaker.member { color: var(--grey-400); }
.arb-phone .transcript-text { color: rgba(255, 255, 255, 0.82); }
.arb-phone .transcript-line.is-active .transcript-text {
  color: white;
  background: rgba(218, 30, 64, 0.10);
  padding: 1px 4px;
  border-radius: 3px;
  margin: -1px -4px;
}
