/* ═══ SyncWatch — Linear Design System ═══ */
/* Near-black canvas, lavender-blue accent, charcoal panels, hairline borders, technical precision */

:root {
  /* Linear exact colors */
  --primary: #5e6ad2;
  --primary-hover: #828fff;
  --primary-muted: rgba(94,106,210,0.15);
  --ink: #f7f8f8;
  --ink-muted: #d0d6e0;
  --ink-subtle: #8a8f98;
  --ink-tertiary: #62666d;
  --canvas: #010102;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #18191a;
  --surface-4: #191a1b;
  --hairline: #23252a;
  --hairline-strong: #34343a;
  --hairline-tertiary: #3e3e44;
  --success: #27a644;
  --error: #ef4444;

  /* Linear radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Linear fonts */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Consistent button height */
  --btn-h: 36px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 3px; }
::selection { background: var(--primary-muted); color: var(--ink); }

/* ═══ Landing ═══ */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--canvas);
}

.landing-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
}

.landing-logo {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.6px;
  color: var(--ink);
  margin-bottom: 4px;
}

.landing-logo span { color: var(--primary); }

.landing-subtitle {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink-subtle);
  margin-bottom: 32px;
}

.landing-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.landing-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-tertiary);
  letter-spacing: 0.3px;
}

.landing-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.landing-divider::before,
.landing-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* ═══ Inputs ═══ */
.input {
  width: 100%;
  height: var(--btn-h);
  padding: 0 12px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--ink-tertiary); }

/* ═══ Buttons — ALL share same height/radius ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--btn-h);
  padding: 0 16px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}

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

.btn-secondary {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--hairline);
}
.btn-secondary:hover { background: var(--surface-4); border-color: var(--hairline-strong); }

.btn-ghost {
  background: transparent;
  color: var(--ink-subtle);
}
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }

.btn-icon {
  width: var(--btn-h);
  height: var(--btn-h);
  padding: 0;
  border-radius: var(--r-md);
  font-size: 14px;
}

.btn-full { width: 100%; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══ Room Layout ═══ */
.room-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  overflow: hidden;
}

.room-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
  height: 48px;
  gap: 12px;
}

.room-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.room-header-title span { color: var(--primary); }

.room-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-muted);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 1px;
}

.room-code:hover { background: rgba(94,106,210,0.25); }

/* ═══ Header Action Bar — consistent buttons ═══ */
.room-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-header-actions .input {
  width: 280px;
  height: var(--btn-h);
  font-size: 12px;
}

.room-header-actions .btn {
  height: var(--btn-h);
  min-width: var(--btn-h);
}

.room-header-actions .btn-leave {
  padding: 0 14px;
  font-size: 12px;
}

/* ═══ Video ═══ */
.video-area {
  position: relative;
  background: #000;
}

.video-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.video-container iframe,
.video-container video {
  width: 100%;
  height: 100%;
  border: none;
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ink-tertiary);
  text-align: center;
  padding: 32px;
}

.video-placeholder-icon { font-size: 48px; opacity: 0.15; }
.video-placeholder-text { font-size: 14px; }

.video-url-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 40px 20px 16px;
}

.video-url-input {
  display: flex;
  gap: 6px;
  max-width: 480px;
  margin: 0 auto;
}

/* ═══ Chat Panel ═══ */
.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-left: 1px solid var(--hairline);
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--hairline);
  height: 44px;
}

.chat-tabs {
  display: flex;
  gap: 0;
  background: var(--canvas);
  padding: 2px;
  border-radius: var(--r-sm);
}

.chat-tab {
  padding: 5px 14px;
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-tertiary);
  background: transparent;
  border: none;
  font-family: var(--font);
  transition: all 0.15s;
}

.chat-tab.active {
  color: var(--ink);
  background: var(--surface-2);
}

.chat-tab:hover:not(.active) { color: var(--ink-subtle); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-msg {
  padding: 5px 0;
  font-size: 13px;
  line-height: 1.5;
  animation: msgIn 0.15s ease-out;
}

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

.chat-msg-name {
  font-weight: 500;
  font-size: 13px;
  margin-right: 6px;
}

.chat-msg-text { color: var(--ink-muted); }

.chat-msg-system {
  color: var(--ink-tertiary);
  font-size: 12px;
  padding: 3px 0;
}

/* ═══ Chat Input — send button INSIDE ═══ */
.chat-input-area {
  padding: 12px;
  border-top: 1px solid var(--hairline);
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.15s;
}

.chat-input-wrap:focus-within { border-color: var(--primary); }

.chat-input {
  flex: 1;
  height: var(--btn-h);
  padding: 0 12px;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.chat-input::placeholder { color: var(--ink-tertiary); }

.chat-send-btn {
  width: 30px;
  height: 30px;
  margin: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover { background: var(--primary-hover); }

/* Hide the old separate send button */
#btn-send { display: none; }

/* ═══ Users ═══ */
.users-list { padding: 6px; }

.users-section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-tertiary);
  padding: 10px 12px 4px;
  letter-spacing: 0.3px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  transition: background 0.1s;
}

.user-item:hover { background: var(--surface-2); }

.user-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.user-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 600;
}

.user-voice-icon { color: var(--success); font-size: 11px; }

/* ═══ Voice ═══ */
.voice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 4px 8px 8px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
}

.voice-bar.connected { border-color: rgba(39,166,68,0.2); }

.voice-bar-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  border: none;
  background: var(--surface-3);
  color: var(--ink-subtle);
  transition: all 0.15s;
}

.voice-bar-btn:hover { color: var(--ink); background: var(--surface-4); }
.voice-bar-btn.on { background: var(--success); color: #fff; }

.voice-bar-status {
  font-size: 12px;
  color: var(--ink-tertiary);
  flex: 1;
}

.voice-bar-status.connected { color: var(--success); }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .room-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 40vh 1fr;
  }

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

  .landing-card {
    padding: 36px 28px;
  }

  /* Header: stack into two rows */
  .room-header {
    flex-wrap: wrap;
    padding: 8px 12px;
    height: auto;
    gap: 8px;
  }

  .room-header-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .room-header-title {
    font-size: 13px;
  }

  .room-header-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }

  .room-header-actions .input {
    flex: 1;
    width: auto;
    min-width: 0;
    font-size: 12px;
  }

  /* Smaller voice bar on mobile */
  .voice-bar {
    padding: 6px 10px;
  }

  .voice-bar-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

.hidden { display: none !important; }
