/* ═══════════════════════════════════════════════
  CodeMesh — Design System
  ═══════════════════════════════════════════════ */

:root {
  /* Colors */
  --bg-primary: #0a0b0f;
  --bg-secondary: #12131a;
  --bg-tertiary: #1a1b26;
  --bg-card: #16171f;
  --bg-hover: #1e1f2e;
  --bg-glass: rgba(22, 23, 31, 0.85);

  --text-primary: #e4e6f0;
  --text-secondary: #8b8fa3;
  --text-muted: #5a5e72;
  --text-accent: #a78bfa;

  --accent-primary: #6C5CE7;
  --accent-secondary: #00CEFF;
  --accent-gradient: linear-gradient(135deg, #6C5CE7 0%, #00CEFF 100%);
  --accent-gradient-hover: linear-gradient(135deg, #7c6cf7 0%, #1adeff 100%);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(108, 92, 231, 0.4);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.15);

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.2s;
  --duration-slow: 0.4s;
}

/* ═══════════ RESET & BASE ═══════════ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection {
  background: rgba(108, 92, 231, 0.4);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ═══════════ LOADING OVERLAY ═══════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader {
  position: relative;
  width: 100px;
  height: 100px;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.loader-ring:nth-child(2) {
  inset: 8px;
  border-top-color: var(--accent-secondary);
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.loader-ring:nth-child(3) {
  inset: 16px;
  border-top-color: var(--text-muted);
  animation-duration: 2.4s;
}

.loader-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
  text-transform: uppercase;
}

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

/* ═══════════ VIEWS ═══════════ */
.view {
  position: absolute;
  inset: 0;
  animation: viewFadeIn 0.4s var(--ease);
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ═══════════ AUTH VIEW ═══════════ */
.auth-bg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.auth-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.auth-particles .particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
  opacity: 0;
  animation: particleFade 4s infinite;
}

@keyframes particleFade {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }

  50% {
    opacity: 0.6;
  }

  100% {
    opacity: 0;
    transform: translateY(-120px) scale(1.2);
  }
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  z-index: 2;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
}

.logo-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo-text span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  position: relative;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--duration) var(--ease);
  position: relative;
  z-index: 2;
}

.auth-tab.active {
  color: var(--text-primary);
}

.auth-tab:hover:not(.active) {
  color: var(--text-primary);
}

.auth-tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  transition: transform var(--duration-slow) var(--ease);
  z-index: 1;
}

.auth-tab-indicator.right {
  transform: translateX(100%);
}

/* Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.input-wrapper input:focus+.input-icon,
.input-wrapper input:focus~.input-icon {
  color: var(--accent-primary);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.form-error {
  color: var(--danger);
  font-size: 0.8rem;
  min-height: 0;
  transition: all var(--duration) var(--ease);
}

.form-error:not(:empty) {
  min-height: 20px;
  padding: 6px 0;
}

/* ══════════════════════ */
/* CREATOR FOOTER STYLES  */
/* ══════════════════════ */
.creator-credit {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0.8;
  z-index: 10;
  pointer-events: none;
}

/* ═══════════ BUTTONS ═══════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 8px;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-arrow {
  width: 16px;
  height: 16px;
  transition: transform var(--duration) var(--ease);
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ═══════════ NAVBAR ═══════════ */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo-icon {
  width: 32px;
  height: 32px;
}

.nav-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-title span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user {
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

/* ═══════════ DASHBOARD ═══════════ */
.dashboard {
  height: calc(100vh - 57px);
  overflow-y: auto;
  padding: 32px;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.join-input-group {
  display: flex;
  gap: 6px;
}

.input-sm {
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--duration) var(--ease);
  width: 200px;
}

.input-sm:focus {
  border-color: var(--accent-primary);
}

.input-sm::placeholder {
  color: var(--text-muted);
}

.input-full {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--duration) var(--ease);
}

.input-full:focus {
  border-color: var(--accent-primary);
}

select.input-full {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='%238b8fa3' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* Sessions Grid */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}

.session-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.session-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.session-card:hover::before {
  opacity: 1;
}

.session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.session-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.session-card-lang {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
}

.session-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.session-card-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.session-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.session-card:hover .session-card-actions {
  opacity: 1;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg {
  margin-bottom: 20px;
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 400px;
  line-height: 1.6;
}

/* ═══════════════ MODAL ═══════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalIn 0.3s var(--ease);
}

@keyframes modalIn {
  from {
    opacity: 0;
  }

  from .modal-content {
    transform: scale(0.95) translateY(10px);
  }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ═══════════════ EDITOR TOOLBAR ═══════════════ */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  min-height: 52px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-center {
  display: flex;
  align-items: center;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-title-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-id-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--duration) var(--ease);
}

.session-id-badge:hover {
  color: var(--accent-secondary);
}

.save-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.save-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  transition: background var(--duration) var(--ease);
}

.save-status.saving .save-dot {
  background: var(--warning);
}

.save-status.unsaved .save-dot {
  background: var(--danger);
}

.toolbar-select {
  padding: 6px 32px 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='%238b8fa3' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

.toolbar-select:focus {
  border-color: var(--accent-primary);
}

/* Collaborators */
.collaborators {
  display: flex;
  align-items: center;
  gap: -6px;
}

.collab-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--bg-secondary);
  margin-left: -6px;
  position: relative;
  cursor: default;
  transition: transform var(--duration) var(--ease);
}

.collab-avatar:first-child {
  margin-left: 0;
}

.collab-avatar:hover {
  transform: scale(1.15);
  z-index: 2;
}

.collab-avatar .collab-tooltip {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}

.collab-avatar:hover .collab-tooltip {
  opacity: 1;
}

/* ═══════════════ RUN BUTTON ═══════════════ */
.btn-run {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3);
}

.btn-run:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-run.running {
  pointer-events: none;
  opacity: 0.7;
  animation: runPulse 1s ease-in-out infinite;
}

@keyframes runPulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

.btn-xs {
  padding: 4px;
  font-size: 0.75rem;
}

.btn-xs:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ═══════════════ EDITOR MAIN (flex layout) ═══════════════ */
.editor-main {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* ═══════════════ EDITOR CONTAINER ═══════════════ */
.editor-container {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #1a1b26;
}

/* ═══════════════ OUTPUT PANEL ═══════════════ */
.output-panel {
  height: 240px;
  min-height: 120px;
  background: #0d0e12;
  border-top: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s var(--ease);
}

@keyframes slideUp {
  from {
    height: 0;
    opacity: 0;
  }
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #111218;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.output-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.output-title svg {
  color: var(--accent-secondary);
}

.output-exec-time {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 1px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.output-exec-time:empty {
  display: none;
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.output-content {
  flex: 1;
  overflow: auto;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: #d4d4d8;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.output-content .output-error {
  color: #f87171;
}

.output-content .output-success {
  color: #34d399;
}

.output-content .output-info {
  color: var(--accent-secondary);
  font-style: italic;
}

.editor-container .cm-editor {
  height: 100%;
  font-family: var(--font-mono);
  font-size: 14px;
}

.editor-container .cm-editor .cm-scroller {
  overflow: auto;
  font-family: var(--font-mono) !important;
}

.editor-container .cm-editor.cm-focused {
  outline: none;
}

.editor-container .cm-editor .cm-gutters {
  background: #12131a;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
}

.editor-container .cm-editor .cm-activeLineGutter {
  background: rgba(108, 92, 231, 0.1);
  color: var(--text-secondary);
}

.editor-container .cm-editor .cm-activeLine {
  background: rgba(108, 92, 231, 0.05);
}

.editor-container .cm-editor .cm-selectionBackground {
  background: rgba(108, 92, 231, 0.25) !important;
}

.editor-container .cm-editor .cm-cursor {
  border-left-color: var(--accent-secondary);
  border-left-width: 2px;
}

.editor-container .cm-editor .cm-matchingBracket {
  background: rgba(108, 92, 231, 0.3);
  outline: 1px solid rgba(108, 92, 231, 0.5);
}

/* Remote cursors */
.remote-cursor {
  border-left: 2px solid;
  position: relative;
}

.remote-cursor-label {
  position: absolute;
  top: -18px;
  left: -1px;
  padding: 1px 6px;
  font-size: 0.6rem;
  font-weight: 600;
  border-radius: 3px 3px 3px 0;
  white-space: nowrap;
  pointer-events: none;
  color: #fff;
  line-height: 1.4;
}

/* ═══════════════ TOASTS ═══════════════ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 10000;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s var(--ease);
  max-width: 360px;
}

.toast.toast-success {
  border-left: 3px solid var(--success);
}

.toast.toast-error {
  border-left: 3px solid var(--danger);
}

.toast.toast-info {
  border-left: 3px solid var(--accent-secondary);
}

.toast.toast-out {
  animation: toastOut 0.3s var(--ease) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 768px) {
  .auth-container {
    margin: 16px;
    padding: 24px;
  }

  .dashboard {
    padding: 16px;
  }

  .dashboard-header {
    flex-direction: column;
  }

  .dashboard-actions {
    width: 100%;
  }

  .join-input-group {
    flex: 1;
  }

  .input-sm {
    width: 100%;
  }

  .sessions-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-left .session-title-text {
    max-width: 150px;
  }

  .toolbar-right span {
    display: none;
  }
}

/* ═══════════════ LABEL HINT ═══════════════ */
.label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ═══════════════ ROLE BADGE ═══════════════ */
.role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.role-owner {
  background: rgba(108, 92, 231, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(108, 92, 231, 0.3);
}

.role-badge.role-editor {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.role-badge.role-viewer {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* ═══════════════ ADMIN BUTTON ═══════════════ */
.btn-admin {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
}

.btn-admin:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

/* ═══════════════ ADMIN PANEL ═══════════════ */
.admin-title-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 20px;
  margin-left: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-content {
  padding: 24px 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 4px;
  width: fit-content;
}

.admin-tab {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.admin-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.admin-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.admin-panel-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 12px;
  background: var(--bg-secondary);
  border-radius: 20px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.admin-table tbody td {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.admin-table tbody tr:hover {
  background: var(--bg-hover);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table .badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-admin {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-user {
  background: rgba(108, 92, 231, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(108, 92, 231, 0.3);
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-banned {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.admin-actions {
  display: flex;
  gap: 6px;
}

.btn-ban {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-ban:hover {
  background: rgba(251, 191, 36, 0.25);
}

.btn-unban {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-unban:hover {
  background: rgba(16, 185, 129, 0.25);
}

.btn-delete {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-delete:hover {
  background: rgba(248, 113, 113, 0.25);
}

/* Collaborator role dropdown */
.collab-avatar .role-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
  min-width: 120px;
}

.role-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}

.role-dropdown button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.role-dropdown button.active-role {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Viewer mode overlay hint */
.viewer-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 14px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  z-index: 10;
  pointer-events: none;
  animation: fadeIn 0.3s var(--ease);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
