/*
  MeetSpace Demo — styles
  EDIT branding colors in :root below.
  Palette is teal/coral on warm slate — intentionally NOT Zoom blue,
  Meet green, or Teams purple.
*/

:root {
  /* --- Brand colors (edit these) --- */
  --color-bg: #1a1f24;
  --color-surface: #243038;
  --color-surface-2: #2e3a44;
  --color-border: #3d4a55;
  --color-text: #f0f4f7;
  --color-muted: #9aa8b4;
  --color-accent: #2ec4b6;       /* teal — primary buttons */
  --color-accent-hover: #25a99d;
  --color-accent-text: #0d1a18;
  --color-coral: #ff6b4a;        /* leave / danger */
  --color-coral-hover: #e85a3c;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(46, 196, 182, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 107, 74, 0.08), transparent 45%);
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.step {
  width: 100%;
  display: none;
}

.step.step--active {
  display: flex;
  justify-content: center;
}

.step--incall.step--active {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 3rem);
  max-width: 1100px;
  margin: 0 auto;
  gap: 1rem;
}

/* --- Brand --- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.brand--compact {
  margin-bottom: 0.75rem;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-accent), #1a9b8e);
  color: var(--color-accent-text);
  font-weight: 700;
  font-size: 1rem;
}

.brand__name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand__badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

.brand--on-dark .brand__name {
  color: var(--color-text);
}

/* --- Cards --- */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card--waiting {
  text-align: center;
  max-width: 360px;
}

.invite__title {
  margin: 0 0 1.25rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.invite__meta {
  margin: 0 0 1.5rem;
  padding: 0;
}

.invite__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--color-border);
}

.invite__row:last-child {
  border-bottom: none;
}

.invite__row dt {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.invite__row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  font-size: 0.9rem;
}

.hint {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: center;
}

.step-heading {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.step-sub {
  margin: 0 0 1.25rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* --- Preview tile --- */
.preview {
  margin-bottom: 1.25rem;
}

.preview__tile {
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background: linear-gradient(160deg, #1e2a32, #152028);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.preview__tile.is-cam-off {
  background: #12181c;
}

.preview__initial {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.preview__label {
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* --- Form --- */
.field {
  display: block;
  margin-bottom: 1rem;
}

.field__label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
}

.field__input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 1rem;
}

.field__input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.toggles {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.toggle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.toggle[aria-pressed="false"] {
  opacity: 0.65;
  background: var(--color-bg);
}

.toggle:hover {
  border-color: var(--color-accent);
}

/* --- Buttons --- */
.btn {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

.btn--ghost:hover {
  color: var(--color-text);
  border-color: var(--color-muted);
}

/* --- Waiting spinner --- */
.spinner {
  padding: 1rem 0;
}

.spinner__ring {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner__text {
  margin: 0;
  font-weight: 600;
}

.waiting__detail {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* --- In-call --- */
.call-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.25rem 0.5rem;
}

.call-header .brand {
  margin-bottom: 0;
}

.call-header__title {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  min-width: 140px;
}

.call-header__timer {
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  min-height: 280px;
  align-content: start;
}

.tile {
  position: relative;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.tile--host {
  background: linear-gradient(145deg, #2a3842, #1e2a32);
}

.tile--self {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.tile__avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-accent);
}

.tile--self .tile__avatar {
  background: var(--color-accent);
  color: var(--color-accent-text);
  border-color: transparent;
}

.tile.is-video-off .tile__avatar {
  /* same placeholder — UI-only toggle */
}

.tile__name {
  position: absolute;
  left: 0.6rem;
  bottom: 0.5rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.tile__name em {
  font-style: normal;
  color: var(--color-muted);
  font-weight: 400;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  width: fit-content;
  margin: 0 auto;
}

.ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 4.5rem;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 12px;
  background: var(--color-surface-2);
  color: var(--color-text);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}

.ctrl:hover {
  background: var(--color-border);
}

.ctrl[aria-pressed="false"] {
  opacity: 0.55;
}

.ctrl--danger {
  background: var(--color-coral);
  color: #fff;
}

.ctrl--danger:hover {
  background: var(--color-coral-hover);
}

.ctrl__label {
  font-weight: 600;
}

@media (max-width: 560px) {
  .stage {
    grid-template-columns: 1fr;
  }

  .controls {
    border-radius: 16px;
    flex-wrap: wrap;
  }
}


/* Muted participants already on the call */
.tile--muted .tile__avatar {
  color: #0d1a18;
  border-color: transparent;
}

/* Generic skin-tone placeholders (not photos) */
.tile__avatar--skin-deep {
  background: #5c3a2e;
  color: #f5ebe0;
}

.tile__avatar--skin-light {
  background: #e8c4a8;
  color: #3a2a20;
}

.tile__avatar--skin-medium {
  background: #c68642;
  color: #1a120c;
}

.tile__mute {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
}


.tile--video {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.tile__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}


/* Unable-to-join overlay above in-call session */
.step--incall {
  position: relative;
}

.join-blocker {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(10, 14, 18, 0.72);
  backdrop-filter: blur(4px);
}

.join-blocker__card {
  width: min(420px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
}

.join-blocker__icon {
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  background: rgba(255, 107, 74, 0.18);
  color: var(--color-coral);
  font-weight: 800;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.join-blocker__title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.join-blocker__body {
  margin: 0 0 1.25rem;
  color: var(--color-muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.join-blocker__download {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  text-decoration: none;
}

.join-blocker__hint {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.join-blocker__hint code {
  font-size: 0.75rem;
  color: var(--color-text);
}
