/* =============================================================================
   Connect Calls — Wave 3 DEV-4 (additive, frontend-only)

   Owns three things:
     1. ScheduledCallsPanel — the new additive "My scheduled calls" panel docked
        in the Inbox Column C context drawer (messaging-hub.html), wired to the
        already-real get_scheduled_calls / confirm / cancel family.
     2. Call-request DRAWER chrome — re-keys video/voice-call-request-modal away
        from the off-brand `fixed inset-0` green/purple modals to gold,
        offset-aware, focus-trapped drawers that never float over the dashboard
        iframe (html.page-mode-embedded => position:static, in-flow).
     3. RBAC FOUC contract — `[data-rbac-hide-until-resolved]` hides provider /
        admin affordances at first paint until rbac.js resolves the role.

   Brand: gold primary var(--marriage-gold) / var(--color-primary); accent
   var(--love-pink) #ec4899; text/icons on light surfaces use the darker
   --marriage-gold-700 (a11y.css .gold-text/.gold-icon). NO --color-accent.
   ============================================================================= */

/* ---- RBAC FOUC: hide provider/admin affordances until role resolves -------- */
/* rbac.js stamps body.role-<role> + processes data-rbac-show after /roles/me.
   Until then, anything marked data-rbac-hide-until-resolved stays hidden so a
   member never sees a flash of provider/admin UI. rbac.js removes the gate by
   setting html.rbac-resolved (added by the tiny inline resolver on each page).
   Embedded dashboard short-circuits to resolved (backend authz is the gate). */
html:not(.rbac-resolved) [data-rbac-hide-until-resolved] {
  display: none !important;
}

/* ============================================================================
   1. ScheduledCallsPanel (Column C)
   ============================================================================ */
.sched-calls {
  border: 0.0625rem solid var(--marriage-gold-200, #fde68a);
  border-radius: 0.75rem;
  background: var(--marriage-gold-50, #fffbeb);
  padding: 0.875rem;
  margin-bottom: 1rem;
}
.dark .sched-calls {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.28);
}
.sched-calls[hidden] { display: none; }

.sched-calls__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.sched-calls__title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--marriage-gold-700, #b8860b);
}
.dark .sched-calls__title { color: var(--marriage-gold-300, #fbbf24); }

.sched-calls__list { list-style: none; margin: 0; padding: 0; }

.sched-call {
  border-top: 0.0625rem solid var(--marriage-gold-200, #fde68a);
  padding: 0.625rem 0;
}
.sched-call:first-child { border-top: none; }
.dark .sched-call { border-top-color: rgba(212, 175, 55, 0.22); }

.sched-call__row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.sched-call__icon { flex: 0 0 auto; color: var(--marriage-gold-700, #b8860b); margin-top: 0.125rem; }
.dark .sched-call__icon { color: var(--marriage-gold-300, #fbbf24); }
.sched-call__body { flex: 1 1 auto; min-width: 0; }

.sched-call__peer {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-1, #111827);
}
.dark .sched-call__peer { color: #f3f4f6; }

/* Dual-zone time line — both ends with IANA zone labels (NRI contract). */
.sched-call__when {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-1, #111827);
  margin-top: 0.125rem;
}
.dark .sched-call__when { color: #e5e7eb; }
.sched-call__when-peer {
  display: block;
  font-size: 0.75rem;
  color: var(--text-2, #6b7280);
}

.sched-call__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  margin-top: 0.25rem;
}
.sched-call__status {
  padding: 0.0625rem 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sched-call__status--pending {
  background: var(--marriage-gold-100, #fef3c7);
  color: var(--marriage-gold-700, #b8860b);
}
.sched-call__status--confirmed {
  background: #dcfce7;
  color: #15803d;
}
.dark .sched-call__status--confirmed { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.dark .sched-call__status--pending { background: rgba(212, 175, 55, 0.18); color: #fbbf24; }
.sched-call__type { color: var(--text-2, #6b7280); }

.sched-call__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.sched-call__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 0.0625rem solid transparent;
  cursor: pointer;
}
.sched-call__btn--confirm {
  background: linear-gradient(135deg, var(--love-pink-500, #ec4899), var(--marriage-gold-500, #d4af37));
  color: #ffffff;
}
.sched-call__btn--confirm:hover { filter: brightness(1.04); }
.sched-call__btn--cancel {
  background: transparent;
  border-color: var(--border-1, #e5e7eb);
  color: var(--text-2, #6b7280);
}
.sched-call__btn--cancel:hover { background: var(--surface-2, #f3f4f6); }
.dark .sched-call__btn--cancel { border-color: #374151; color: #9ca3af; }
.dark .sched-call__btn--cancel:hover { background: rgba(255,255,255,0.06); }
.sched-call__btn:disabled { opacity: 0.55; cursor: default; }

/* Empty / error states — honest, never a bare spinner. */
.sched-calls__empty,
.sched-calls__error {
  font-size: 0.8125rem;
  color: var(--text-2, #6b7280);
  padding: 0.25rem 0;
}
.sched-calls__signin {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--love-pink-500, #ec4899), var(--marriage-gold-500, #d4af37));
}

/* Skeleton rows (loading) */
.sched-skel {
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 37%, rgba(0,0,0,0.06) 63%);
  background-size: 400% 100%;
  animation: schedSkel 1.4s ease infinite;
  border-radius: 0.375rem;
  height: 0.75rem;
  margin-bottom: 0.5rem;
}
.sched-skel--short { width: 55%; }
.dark .sched-skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.06) 63%);
  background-size: 400% 100%;
}
@keyframes schedSkel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sched-skel { animation: none; } }

/* ============================================================================
   2. Call-request DRAWER (video / voice request modals)
   Re-keys the off-brand `fixed inset-0` green/purple modal to a gold,
   offset-aware, focus-trapped drawer. Standalone: a right-anchored sheet below
   the shared header. Embedded: in-flow (never floats over the dashboard chrome).
   ============================================================================ */
.call-drawer__backdrop {
  position: fixed;
  top: var(--app-header-offset, 4rem);
  left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 39;
}
.call-drawer__backdrop[hidden] { display: none; }

.call-drawer {
  position: fixed;
  top: var(--app-header-offset, 4rem);
  right: 0;
  bottom: 0;
  width: min(40rem, 100%);
  max-width: 100%;
  background: #ffffff;
  box-shadow: -0.5rem 0 1.5rem rgba(0, 0, 0, 0.18);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--motion-base, 0.2s) var(--ease-decelerate, ease);
}
.dark .call-drawer { background: #1f2937; color: #f3f4f6; }
.call-drawer.is-open { transform: translateX(0); }
.call-drawer[hidden] { display: none; }

.call-drawer__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  color: #ffffff;
  background: linear-gradient(135deg, var(--love-pink-500, #ec4899), var(--marriage-gold-500, #d4af37));
}
.call-drawer__title { font-size: 1.25rem; font-weight: 700; }
.call-drawer__sub { font-size: 0.8125rem; opacity: 0.95; }
.call-drawer__close {
  flex: 0 0 auto;
  width: 2.75rem; height: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  border: none;
  cursor: pointer;
}
.call-drawer__close:hover { background: rgba(255,255,255,0.25); }

.call-drawer__body { flex: 1 1 auto; overflow-y: auto; padding: 1.5rem; }
.call-drawer__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 0.0625rem solid var(--border-1, #e5e7eb);
}
.dark .call-drawer__foot { border-top-color: #374151; }

/* EMBEDDED MODE: render in-flow, never an overlay. */
html.page-mode-embedded .call-drawer,
html.page-mode-embedded .call-drawer__backdrop {
  position: static;
  top: auto;
  transform: none;
  width: 100%;
  max-width: 100%;
  box-shadow: none;
  z-index: auto;
}
html.page-mode-embedded .call-drawer:not(.is-open) { display: none; }
html.page-mode-embedded .call-drawer__backdrop { display: none; }

@media (prefers-reduced-motion: reduce) {
  .call-drawer { transition: none; }
}

/* Darked option (voice callback — self-stubbed "not available yet"). */
.call-option--darked {
  opacity: 0.6;
  cursor: not-allowed;
}
.call-option--darked input { pointer-events: none; }
.call-darked-note {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-2, #6b7280);
}

/* ============================================================================
   3. Live-room "simulated" prominence (video-call / voice-call / video-chat)
   The #mockProviderBanner must stay PROMINENT — never present a procurement-
   gated live room as real. Make it a full-width, high-contrast band that is
   visible by default (not display:none) and offset-aware.
   ============================================================================ */
.mock-room-banner {
  display: block;
  width: 100%;
  background: #fde68a;            /* amber-200 */
  color: #78350f;                /* amber-900 */
  text-align: center;
  padding: 0.625rem 1rem;
  font-weight: 700;
  font-size: 0.9375rem;
  border-bottom: 0.1875rem solid #d97706;  /* amber-600 */
}
.mock-room-banner i { margin-right: 0.5rem; }
