/* ========================================
   LiveScreenShare — Media Studies Huisstijl
   Brand: #7B1F62 | Avenir | Minimal
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;700;900&display=swap');

/* --- Brand Tokens --- */
:root {
  --brand: #7B1F62;
  --brand-light: #9a3580;
  --brand-dark: #5c1649;
  --bg: #ffffff;
  --surface: #f5f5f5;
  --card: #ffffff;
  --card-hover: #fafafa;
  --border: #e5e5e5;
  --border-hover: #ccc;
  --text: #1a1a1a;
  --text-dim: #666;
  --text-muted: #999;
  --green: #00a86b;
  --red: #d42f2f;
  --font: 'Nunito Sans', 'Avenir', 'Avenir Next', -apple-system, sans-serif;
  --transition: 0.15s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-weight: 300;
}

/* --- Layout --- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

.page-narrow {
  max-width: 560px;
}

.page-wide {
  max-width: 1440px;
  padding: 0 48px;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 2px solid var(--brand);
}

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--text);
}

.logo img {
  height: 36px;
  width: auto;
}

.logo-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.logo-text {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  line-height: 1.3;
}

.logo-text .brand-name {
  color: var(--brand);
  font-size: 0.85rem;
}

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

/* --- Typography --- */
h1 {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

h2 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  margin-top: 12px;
  font-weight: 300;
}

.accent {
  color: var(--brand);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn:hover {
  color: var(--text);
  border-color: var(--text);
}

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

.btn-primary:hover {
  background: var(--brand-light);
  border-color: var(--brand-light);
}

.btn-large {
  padding: 16px 44px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-danger:hover {
  opacity: 0.85;
}

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 2px solid var(--border);
}

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

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.7rem;
}

/* --- Inputs --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.input-group label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.input {
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  outline: none;
  transition: var(--transition);
}

.input:focus {
  border-color: var(--brand);
}

.input-code {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  max-width: 300px;
  font-variant-numeric: tabular-nums;
}

/* --- Room Code Display --- */
.room-code-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border: 2px solid var(--brand);
  background: var(--bg);
}

.room-code-value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.copy-btn {
  padding: 6px 14px;
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.65rem;
  font-family: var(--font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: var(--transition);
}

.copy-btn:hover {
  color: var(--brand);
  border-color: var(--brand);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 2px solid var(--border);
  color: var(--text-dim);
}

.badge-active {
  border-color: var(--green);
  color: var(--green);
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* =========================================
   Landing Page
   ========================================= */
.landing-hero {
  text-align: center;
  padding: 100px 0 48px;
}

.landing-hero h1 {
  font-size: 3.4rem;
  letter-spacing: -0.03em;
}

/* Brand bar under hero */
.brand-bar {
  height: 4px;
  width: 60px;
  background: var(--brand);
  margin: 24px auto 0;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-width: 700px;
  margin: 56px auto 0;
  border: 2px solid var(--border);
}

.role-card {
  padding: 48px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
}

.role-card+.role-card {
  border-left: 2px solid var(--border);
}

.role-card:hover {
  background: var(--surface);
}

.role-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--brand);
  margin-bottom: 12px;
}

.role-card h2 {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.role-card p {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 220px;
  font-weight: 300;
}

.role-card .btn {
  margin-top: 28px;
}

/* =========================================
   Student Page
   ========================================= */
.student-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}

.join-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 340px;
}

.join-form .input {
  width: 100%;
}

.share-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.share-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.preview-container {
  width: 480px;
  max-width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface);
  border: 2px solid var(--border);
  overflow: hidden;
  position: relative;
}

.preview-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* =========================================
   Teacher Dashboard
   ========================================= */
.teacher-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  min-height: calc(100vh - 90px);
  border: 2px solid var(--border);
  border-top: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 2px solid var(--border);
  padding: 24px;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.student-count {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-top: 4px;
}

.student-count strong {
  color: var(--brand);
}

/* --- Queue --- */
.queue {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 300;
}

.empty-state p:first-of-type {
  color: var(--text-dim);
  font-weight: 400;
  margin-bottom: 4px;
}

.empty-state svg {
  display: none;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.queue-item:hover {
  padding-left: 8px;
}

.queue-item.active {
  border-left: 3px solid var(--brand);
  padding-left: 9px;
  background: rgba(123, 31, 98, 0.04);
}

.queue-item-thumb {
  width: 64px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.queue-item-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-item-info {
  flex: 1;
  min-width: 0;
}

.queue-item-name {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-status {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.queue-item-remove {
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  opacity: 0;
  font-family: var(--font);
}

.queue-item:hover .queue-item-remove {
  opacity: 1;
}

.queue-item-remove:hover {
  color: var(--red);
}

/* --- Main Viewer --- */
.main-viewer {
  display: flex;
  flex-direction: column;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.viewer-header h3 {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.viewer-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  position: relative;
  min-height: 500px;
}

.viewer-content video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
}

.viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 300;
}

/* --- Setup Screen --- */
.setup-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  gap: 40px;
}

/* =========================================
   States / Screens
   ========================================= */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-flex.active {
  display: flex;
}

/* =========================================
   Utility
   ========================================= */
.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

.mt-4 {
  margin-top: 32px;
}

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

.text-center {
  text-align: center;
}

.text-dim {
  color: var(--text-dim);
}

.text-sm {
  font-size: 0.8rem;
}

/* =========================================
   Connection Status Bar
   ========================================= */
.connection-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 100;
  display: none;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
}

.connection-bar.error {
  display: flex;
  border-color: var(--red);
  color: var(--red);
}

.connection-bar.connecting {
  display: flex;
  border-color: var(--brand);
  color: var(--brand);
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
  .page {
    padding: 0 20px;
  }

  .page-wide {
    padding: 0 20px;
  }

  .header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .teacher-layout {
    grid-template-columns: 1fr;
  }

  .role-cards {
    grid-template-columns: 1fr;
  }

  .role-card+.role-card {
    border-left: none;
    border-top: 2px solid var(--border);
  }

  h1 {
    font-size: 2rem;
  }

  .landing-hero h1 {
    font-size: 2.4rem;
  }
}