/*
 * v-call app styles.
 *
 * No third-party resources are loaded. Inter is self-hosted from /fonts
 * (served same-origin from public/fonts). Dark mode follows
 * prefers-color-scheme only — no toggle, no localStorage, to honour the
 * privacy policy's "no local storage" promise.
 */

/* Self-hosted Inter (latin, weights 400/500/600). font-display: swap keeps
   text visible in the system fallback while the font loads. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-latin-600.woff2') format('woff2');
}

* {
  box-sizing: border-box;
}
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: #d2d2d7;
  --danger: #c53030;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1c;
    --card: #232325;
    --text: #f0f0f2;
    --text-secondary: #a0a0a6;
    --accent: #3a9bff;
    --accent-hover: #5aaeff;
    --border: #3a3a3d;
    --danger: #ff6b6b;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
}
body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  padding: 32px 20px 40px;
  gap: 20px;
}
header {
  text-align: center;
  max-width: 700px;
}
h1 {
  font-size: 30px;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}
header p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 15px;
}

.room-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.room-pill,
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.room-pill span,
.health-pill span {
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
}

.connect-section {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}
input {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  background: var(--card);
  color: var(--text);
}
input:focus {
  border-color: var(--accent);
}

button {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
button:hover {
  background: var(--card);
  border-color: var(--accent);
  color: var(--accent);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:disabled:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
button.danger {
  color: var(--danger);
  border-color: #f3b3b3;
}
@media (prefers-color-scheme: dark) {
  button.danger {
    border-color: #5a2a2a;
  }
}

.layout {
  display: grid;
  gap: 16px;
  width: min(980px, 100%);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.video-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.video-meta strong {
  color: var(--text);
  font-size: 14px;
}
.video-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}
video {
  width: 100%;
  border-radius: 12px;
  background: #1d1d1f;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.controls,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: min(980px, 100%);
}
.status {
  width: min(980px, 100%);
  text-align: center;
  font-size: 13px;
  padding: 12px 20px;
  background: var(--card);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.status.error {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #c53030;
}
.status.success {
  background: #f0fff4;
  border-color: #9ae6b4;
  color: #276749;
}
@media (prefers-color-scheme: dark) {
  .status.error {
    background: #3a2020;
    border-color: #6b2b2b;
    color: #ff9b9b;
  }
  .status.success {
    background: #1f3a25;
    border-color: #2b6b3a;
    color: #9ae6b4;
  }
}

.incoming-banner {
  display: none;
  width: min(980px, 100%);
  background: #f8fbff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.incoming-banner.visible {
  display: flex;
}
@media (prefers-color-scheme: dark) {
  .incoming-banner {
    background: #1f2a3a;
    border-color: #2b4b6b;
  }
}

.privacy-note {
  width: min(980px, 100%);
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin: -8px 0 0;
}
.site-footer {
  width: min(980px, 100%);
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 10px;
}
.site-footer nav a {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0 6px;
}
.site-footer nav a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.site-footer p {
  margin: 8px 0 0;
}

/* Skip link — visible on focus, off-screen otherwise (a11y). */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
}
.skip-link:focus {
  left: 8px;
}

/* Call timer pill */
#callTimerWrap[hidden] {
  display: none;
}

/* Device picker selects */
.device-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.device-select span {
  white-space: nowrap;
}
.device-select select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  max-width: 180px;
}
.device-select select:disabled {
  opacity: 0.5;
}

/* Chat panel */
.chat-panel {
  width: min(980px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 320px;
}
.chat-panel[hidden] {
  display: none;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.chat-header button {
  padding: 4px 10px;
  font-size: 12px;
}
.chat-log {
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  overflow-y: auto;
  flex: 1;
  font-size: 13.5px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-log li {
  margin: 0;
}
.chat-log li .chat-sender {
  color: var(--text-secondary);
  font-size: 12px;
  margin-right: 6px;
}
.chat-log li.self {
  text-align: right;
}
.chat-log li.self .chat-sender {
  color: var(--accent);
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1;
}

/* Remote video tiles (dynamic, for group calls) */
.video-card.remote .video-meta strong::before {
  content: '';
}

@media (max-width: 720px) {
  .connect-section {
    grid-template-columns: 1fr;
  }
  .controls button,
  .quick-actions button {
    flex: 1;
    min-width: 130px;
  }
  .device-select {
    flex: 1;
  }
  .device-select select {
    max-width: none;
  }
  h1 {
    font-size: 24px;
  }
}
