/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d0d0f;
  --surface:     #131316;
  --surface-2:   #1a1a1f;
  --border:      #242429;
  --border-soft: #1e1e23;
  --accent:      #7c6aff;
  --accent-dim:  #7c6aff22;
  --accent-glow: #7c6aff44;
  --text-1:      #f0eff5;
  --text-2:      #8e8d9a;
  --text-3:      #55545f;
  --live:        #3ddc84;
  --live-dim:    #3ddc8422;
  --danger:      #ff5f5f;
  --radius:      10px;
  --radius-lg:   16px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.screen {
  width: 100%;
  min-height: 100vh;
}

/* ── Brand ────────────────────────────────────────────────────────────────── */
.brand-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.brand-dot.live {
  background: var(--live);
  box-shadow: 0 0 0 3px var(--live-dim);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--live-dim); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

/* ── Login Screen ─────────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, #7c6aff12 0%, transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: -8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field input,
.field select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8d9a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.field select option {
  background: var(--surface-2);
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}

.btn-primary:hover  { opacity: 0.88; }
.btn-primary:active { transform: scale(0.98); }

.error-msg {
  font-size: 12px;
  color: var(--danger);
  text-align: center;
}

/* ── Room Header ──────────────────────────────────────────────────────────── */
.room-header {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.presence-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.presence-tag {
  background: var(--live-dim);
  color: var(--live);
  border: 1px solid #3ddc8433;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn svg { width: 18px; height: 18px; }

.icon-btn:hover {
  color: var(--text-1);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.icon-btn.active {
  color: var(--live);
  border-color: var(--live);
  background: var(--live-dim);
}

/* ── Room Body ────────────────────────────────────────────────────────────── */
.room-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* ── Video Panel ──────────────────────────────────────────────────────────── */
.video-panel {
  position: relative;
  background: #000;
  overflow: hidden;
}

#jitsi-container {
  width: 100%;
  height: 100%;
}

#jitsi-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.jitsi-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080809;
}

.placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
}

.placeholder-inner svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.placeholder-inner p {
  font-size: 13px;
}

/* ── Caption Panel ────────────────────────────────────────────────────────── */
.caption-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.caption-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.caption-status {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 20px;
  padding: 2px 8px;
}

.caption-status.off {
  background: var(--surface-2);
  color: var(--text-3);
}

.caption-status.on {
  background: var(--live-dim);
  color: var(--live);
}

.caption-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.caption-feed::-webkit-scrollbar { width: 4px; }
.caption-feed::-webkit-scrollbar-track { background: transparent; }
.caption-feed::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.caption-empty {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
  text-align: center;
  margin: auto;
}

/* Caption entries */
.caption-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeUp 0.2s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.caption-entry.self .caption-bubble {
  background: var(--accent-dim);
  border-color: var(--accent-glow);
}

.caption-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
}

.caption-meta .name {
  font-weight: 500;
  color: var(--text-2);
}

.caption-meta .time {
  margin-left: auto;
}

.caption-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.caption-original {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
}

.caption-translated {
  font-size: 12px;
  color: var(--accent);
  line-height: 1.5;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
  font-style: italic;
}

/* Caption controls */
.caption-controls {
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mic-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}

.mic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background 0.2s;
}

.mic-dot.active {
  background: var(--live);
  box-shadow: 0 0 0 3px var(--live-dim);
  animation: pulse 1.4s ease-in-out infinite;
}

.interim-text {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  min-height: 18px;
  line-height: 1.4;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .room-body {
    grid-template-columns: 1fr;
    grid-template-rows: 55vh 1fr;
  }

  .caption-panel {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}
