.video-call {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-call-bg);
  color: var(--c-brand-text);
  z-index: 1000;
}

.video-call__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.4);
}

.video-call__title {
  font-size: 16px;
  font-weight: 600;
}

.video-call__status {
  font-size: 13px;
  opacity: 0.8;
}

.video-call__stage {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow: hidden;
}

.video-call__tile,
.video-call__local-wrapper {
  position: relative;
  background: var(--c-call-tile-bg);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-call__tile {
  /* Lets the contained video express its natural ratio; height auto from aspect-ratio */
  aspect-ratio: 16 / 9;
}

.video-call__tile-video {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* fit whole remote frame; no zoom-crop */
  background: var(--c-call-tile-bg);
}

.video-call__local-video {
  width: 100%;
  height: 100%;
  /* Wrapper aspect-ratio is set dynamically to match the actual stream
     dimensions, so `contain` here just guarantees no surprise zoom-crop
     in the brief moment before metadata loads. */
  object-fit: contain;
  background: var(--c-call-tile-bg);
}

.video-call__local-wrapper {
  position: absolute;
  bottom: 96px;
  right: 16px;
  width: 200px;
  max-width: 30vw;
  /* Default to landscape (typical desktop webcam). The Stimulus controller
     overrides aspect-ratio inline once the local stream's metadata loads,
     so portrait sources (mobile) also size correctly. */
  aspect-ratio: 16 / 9;
  border: 2px solid rgba(255, 255, 255, 0.25);
  z-index: 2;
}

.video-call__controls {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.4);
}

.vc-control {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-call-control-bg);
  color: var(--c-brand-text);
  transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
  padding: 0;
}

.vc-control:hover {
  background: rgba(255, 255, 255, 0.2);
}

.vc-control:active {
  transform: scale(0.94);
}

.vc-control--off {
  background: var(--c-error);
  color: var(--c-brand-text);
}

.vc-control--off:hover {
  background: #DC2626;
}

.vc-control--leave {
  background: var(--c-error);
  color: var(--c-brand-text);
}

.vc-control--leave:hover {
  background: #DC2626;
}

.vc-control--complete {
  background: var(--c-success);
  color: var(--c-brand-text);
}

.vc-control--complete:hover {
  background: #16A34A;
}

.vc-control__icon {
  width: 24px;
  height: 24px;
  display: block;
}

.vc-control__strike {
  stroke: currentColor;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.28s ease-out;
}

.vc-control--off .vc-control__strike {
  stroke-dashoffset: 0;
}

.video-call__notice {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  font-size: 18px;
}

.video-call__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-call-tile-bg);
  color: rgba(255, 255, 255, 0.55);
}

.video-call__placeholder svg {
  width: 45%;
  max-width: 120px;
  height: auto;
}

.video-call__placeholder--local svg {
  width: 60%;
  max-width: 70px;
}

.video-calls-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.video-calls-page__topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background-color: var(--c-popup-bg);
  border-bottom: 1px solid var(--c-border);
}

.video-calls-index {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 32px auto;
  padding: 0 20px;
  color: var(--c-base-text);
}

.video-calls-index__header h1 {
  font-size: 22px;
  margin-bottom: 16px;
}

.video-calls-index__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-calls-index__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-surface-subtle);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 16px;
}

.video-calls-index__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.video-calls-index__time {
  font-weight: 600;
  color: var(--c-visit-base);
}

.video-calls-index__title {
  font-size: 15px;
  font-weight: 500;
}

.video-calls-index__participant {
  color: var(--c-base-subtitle-text);
  font-size: 13px;
}

.video-calls-index__waiting {
  color: var(--c-base-subtitle-text);
  font-size: 13px;
}

.video-calls-index__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}

.video-calls-index__status--completed {
  background: rgba(34, 197, 94, 0.12);
  color: var(--c-success);
}

.video-calls-index__empty {
  color: var(--c-base-subtitle-text);
}

.vc-countdown {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--c-visit-highlight);
  border-bottom: 1px solid var(--c-border);
  border-left: 3px solid var(--c-visit-base);
}

.vc-countdown--joinable {
  background: var(--c-success);
  border-left-color: var(--c-success);
  color: var(--c-brand-text);
}

.vc-countdown__icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--c-visit-base);
  color: var(--c-brand-text);
}

.vc-countdown__icon svg { width: 18px; height: 18px; }

.vc-countdown--joinable .vc-countdown__icon {
  background: rgba(255,255,255,0.25);
}

.vc-countdown__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.vc-countdown__label {
  font-weight: 600;
  font-size: 14px;
}

.vc-countdown__sub {
  font-size: 12px;
  color: var(--c-base-subtitle-text);
}

.vc-countdown--joinable .vc-countdown__sub {
  color: rgba(255,255,255,0.9);
}

.vc-countdown__timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--c-visit-base);
  font-size: 16px;
}

.vc-countdown__join {
  text-decoration: none;
}
