/* ── Moovaz Meet — Self-contained SaaS UI ──────────────────────── */

/* Inter Variable Font — self-hosted, no external calls */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
  --bg:           #060e1a;
  --surface:      #0d1e34;
  --surface-2:    #122642;
  --surface-3:    #1a3358;
  --border:       rgba(255,255,255,.07);
  --border-mid:   rgba(255,255,255,.12);
  --primary:      #075183;
  --primary-h:    #0a6aab;
  --primary-glow: rgba(7,81,131,.4);
  --accent:       #E31C4D;
  --accent-h:     #c4163f;
  --white:        #eaf1f8;
  --gray:         #6e90af;
  --gray-2:       #4a6a88;
  --green:        #22c55e;
  --amber:        #f59e0b;
  --red:          #ef4444;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--white);
}

/* ── Page wrapper ───────────────────────────────────────────────── */
.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Top navigation bar ─────────────────────────────────────────── */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; }
.topbar__logo { height: 22px; }
.topbar__sep { width: 1px; height: 18px; background: var(--border-mid); }
.topbar__label { font-size: 13px; font-weight: 600; color: var(--gray); letter-spacing: .3px; }
.topbar__right { display: flex; align-items: center; gap: 12px; }

/* ── Main content ───────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 48px;
}
@media (max-width: 640px) { .main { padding: 20px 14px 40px; } }

/* ── Page heading ───────────────────────────────────────────────── */
.page-heading { margin: 0 0 24px; }
.page-heading h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  margin: 0 0 4px;
  letter-spacing: -.3px;
}
.page-heading p { font-size: 13px; color: var(--gray); margin: 0; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 14px;
}
.card h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Row helpers ────────────────────────────────────────────────── */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .split { grid-template-columns: 1fr; } }

/* ── Buttons ─────────────────────────────────────────────────────── */
button {
  border: none;
  border-radius: 9px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .1s, opacity .15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  line-height: 1;
}
button:active:not(:disabled) { transform: scale(.96); }
button:disabled { opacity: .38; cursor: not-allowed; }

button.primary {
  background: var(--primary);
  color: #fff;
}
button.primary:hover:not(:disabled) {
  background: var(--primary-h);
  box-shadow: 0 4px 16px var(--primary-glow);
}
button.danger { background: var(--accent); color: #fff; }
button.danger:hover:not(:disabled) { background: var(--accent-h); }
button.warn {
  background: rgba(245,158,11,.15);
  color: #fcd34d;
  border: 1px solid rgba(245,158,11,.25);
}
button.warn:hover:not(:disabled) { background: rgba(245,158,11,.25); }
button.ghost {
  background: var(--surface-2);
  color: var(--white);
  border: 1px solid var(--border);
}
button.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-mid); }

/* ── Inputs ──────────────────────────────────────────────────────── */
input {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 10px 14px;
  color: var(--white);
  font-size: 14px;
  font-family: inherit;
  min-width: 220px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
input::placeholder { color: var(--gray-2); }

/* ── Status badge ────────────────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,.05);
  color: var(--gray);
  border: 1px solid var(--border);
}
.status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status.connecting { background: rgba(245,158,11,.12); color: #fcd34d; border-color: rgba(245,158,11,.2); }
.status.connected   { background: rgba(34,197,94,.12);  color: #86efac; border-color: rgba(34,197,94,.2); }
.status.error       { background: rgba(239,68,68,.12);  color: #fca5a5; border-color: rgba(239,68,68,.2); }
.status.ended       { background: rgba(255,255,255,.05); color: var(--gray); }
/* legacy class support */
.status.success { background: rgba(34,197,94,.12); color: #86efac; border-color: rgba(34,197,94,.2); }
.status.warning { background: rgba(245,158,11,.12); color: #fcd34d; border-color: rgba(245,158,11,.2); }
.status.info    { background: rgba(7,81,131,.2); color: #93c5fd; border-color: rgba(7,81,131,.35); }

/* ── Info panel ──────────────────────────────────────────────────── */
.info-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--gray);
  line-height: 1.7;
  margin-top: 12px;
}
.info-panel p { margin: 0 0 8px; }
.info-panel p:last-child { margin: 0; }
.info-panel ul, .info-panel ol { margin: 6px 0 0; padding-left: 18px; }
.info-panel li { margin-bottom: 4px; }
.info-panel strong { color: var(--white); }
.info-panel a { color: #93c5fd; text-decoration: none; }
.info-panel a:hover { text-decoration: underline; }
.info-panel h4 { margin: 0 0 8px; font-size: 13px; color: var(--white); font-weight: 600; }
.info-panel pre {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  color: #93c5fd;
  margin: 8px 0 0;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.6;
}
.info-panel code {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: #93c5fd;
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
}

/* ── Log panel ───────────────────────────────────────────────────── */
.log-panel {
  background: #020c17;
  border: 1px solid var(--border);
  color: #93c5fd;
  padding: 14px 16px;
  border-radius: 10px;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Stats row ───────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-box__label { font-size: 10px; color: var(--gray); font-weight: 600; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 4px; }
.stat-box__value { font-size: 20px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; }
.stat-box__value.primary { color: #93c5fd; }
.stat-box__value.green   { color: #86efac; }

/* ── Video area ──────────────────────────────────────────────────── */
.screen-share-container { background: #020c17; }

.video-container {
  position: relative;
  width: 100%;
  min-height: 380px;
  background: #020c17;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
@media (min-width: 640px) { .video-container { min-height: 460px; } }

#remoteVideo {
  width: 100%;
  height: auto;
  min-height: 380px;
  background: #000;
  border-radius: 10px;
  display: none;
  object-fit: contain;
}
@media (min-width: 640px) { #remoteVideo { min-height: 460px; } }

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020c17;
}
.placeholder-content { text-align: center; padding: 40px; }
.placeholder-content h4 { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--white); }
.placeholder-content p { margin: 0 0 24px; color: var(--gray); font-size: 13px; max-width: 280px; }

/* ── Spinner ─────────────────────────────────────────────────────── */
.loading-spinner {
  display: inline-block;
  width: 36px; height: 36px;
  border: 2.5px solid var(--surface-3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Video controls ──────────────────────────────────────────────── */
.video-controls { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Join link row ───────────────────────────────────────────────── */
.link-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.link-input {
  flex: 1; min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  color: #93c5fd;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  min-width: 0;
}
.link-input:focus { outline: none; border-color: var(--primary); }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,12,23,.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.modal-icon { font-size: 36px; margin-bottom: 12px; text-align: center; }
.modal-title { margin: 0 0 10px; color: var(--white); font-size: 20px; font-weight: 700; text-align: center; }
.modal-message { margin: 0 0 24px; color: var(--gray); font-size: 14px; line-height: 1.6; text-align: center; }
.modal-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Status indicators (enhanced) ───────────────────────────────── */
.status-container { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.network-indicator { font-size: 12px; color: var(--gray); }
.progress-indicator { display: flex; align-items: center; gap: 10px; }

/* ── Page footer ─────────────────────────────────────────────────── */
.page-footer {
  text-align: center;
  padding: 18px 20px;
  font-size: 11px;
  color: var(--gray-2);
  border-top: 1px solid var(--border);
  background: var(--surface);
  letter-spacing: .3px;
}
.page-footer a { color: var(--gray); text-decoration: none; }
.page-footer a:hover { color: var(--white); }

/* ── Divider ─────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ── Anchor button ───────────────────────────────────────────────── */
a.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  transition: background .15s;
}
a.btn-link:hover { background: var(--primary-h); }
a.btn-link.ghost {
  background: var(--surface-2);
  color: var(--white);
  border: 1px solid var(--border);
}
a.btn-link.ghost:hover { background: var(--surface-3); }

/* ── Session ID display ──────────────────────────────────────────── */
.session-id-display {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 10px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: #93c5fd;
  letter-spacing: .5px;
}

/* ── Card icon ───────────────────────────────────────────────────── */
.card-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Meta row (key/value info below cards) ───────────────────────── */
.meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--gray);
}
.meta-row strong { color: var(--white); font-weight: 600; }
.meta-row a      { color: #93c5fd; text-decoration: none; }
.meta-row a:hover { text-decoration: underline; }

/* ── Session chip (monospace ID display) ─────────────────────────── */
.session-chip {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 9px;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px;
  color: #93c5fd;
  letter-spacing: .4px;
}

/* ── Section label ───────────────────────────────────────────────── */
.section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 4px;
}

/* ── Admin page ──────────────────────────────────────────────────── */
body[data-role="admin"] { background: #04111f; }
