/* ========================================
   LiveScreenShare — Design System
   Clean, minimal, dark design
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Tokens --- */
:root {
  --bg:          #07070d;
  --surface:     #0f0f1a;
  --card:        #161625;
  --card-hover:  #1c1c30;
  --border:      #252540;
  --border-lit:  #3a3a5c;
  --text:        #eeeef5;
  --text-dim:    #8585a0;
  --text-muted:  #55556a;
  --accent:      #4f8cff;
  --accent-glow: rgba(79, 140, 255, 0.15);
  --accent-hover:#6da3ff;
  --green:       #34d399;
  --green-glow:  rgba(52, 211, 153, 0.12);
  --red:         #f87171;
  --red-glow:    rgba(248, 113, 113, 0.12);
  --orange:      #fbbf24;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   18px;
  --shadow:      0 2px 20px rgba(0,0,0,0.35);
  --transition:  0.2s ease;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* --- Layout --- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px;
}

.page-narrow {
  max-width: 560px;
}

.page-wide {
  max-width: 1440px;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
}

.logo {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo span {
  color: var(--accent);
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* --- Typography --- */
h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-dim);
}

.subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  margin-top: 8px;
}

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-lit);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 24px rgba(79, 140, 255, 0.3);
}

.btn-large {
  padding: 20px 40px;
  font-size: 1.15rem;
  border-radius: var(--radius);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 4px 24px rgba(248, 113, 113, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--border-lit);
  color: var(--text);
  background: var(--card);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-icon {
  font-size: 1.2em;
}

/* --- Input --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input {
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-code {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-align: center;
  max-width: 280px;
}

/* --- Room Code Display --- */
.room-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.room-code-value {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.copy-btn {
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.copy-btn:hover {
  background: var(--card-hover);
  color: var(--text);
}

/* --- Status Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-active {
  background: var(--green-glow);
  color: var(--green);
}

.badge-waiting {
  background: var(--accent-glow);
  color: var(--accent);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* =========================================
   Landing Page
   ========================================= */
.landing-hero {
  text-align: center;
  padding: 80px 0 60px;
}

.landing-hero h1 {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.landing-hero h1 span {
  color: var(--accent);
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 640px;
  margin: 48px auto 0;
}

.role-card {
  padding: 40px 28px;
  text-align: center;
}

.role-card .role-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 20px;
}

.role-card:first-child .role-icon {
  background: var(--accent-glow);
}

.role-card:last-child .role-icon {
  background: var(--green-glow);
}

.role-card h2 {
  color: var(--text);
  margin-bottom: 8px;
}

.role-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* =========================================
   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: 360px;
}

.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: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.preview-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* =========================================
   Teacher Page — Dashboard
   ========================================= */
.teacher-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  min-height: 80vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.student-count {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.student-count strong {
  color: var(--text);
}

/* --- Student Queue --- */
.queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}

.queue-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.queue-empty .empty-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.queue-item:hover {
  border-color: var(--border-lit);
  background: var(--card-hover);
}

.queue-item.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.queue-item-thumb {
  width: 80px;
  height: 45px;
  background: var(--surface);
  border-radius: 6px;
  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: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-status {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.queue-item-remove {
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  transition: var(--transition);
  opacity: 0;
}

.queue-item:hover .queue-item-remove {
  opacity: 1;
}

.queue-item-remove:hover {
  color: var(--red);
  background: var(--red-glow);
}

/* --- Main Viewer --- */
.main-viewer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.viewer-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.viewer-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  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: 12px;
  color: var(--text-muted);
}

.viewer-placeholder .placeholder-icon {
  font-size: 3rem;
  opacity: 0.3;
}

/* --- Setup (before room created) --- */
.setup-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  gap: 32px;
}

/* =========================================
   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: 12px; align-items: center; }
.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 0.85rem; }

/* =========================================
   Animations
   ========================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.35s ease forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.slide-in {
  animation: slideIn 0.3s ease forwards;
}

/* =========================================
   Tooltip
   ========================================= */
.tooltip {
  position: fixed;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 999;
  box-shadow: var(--shadow);
  animation: fadeIn 0.15s ease;
}

/* =========================================
   Connection Status Bar
   ========================================= */
.connection-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 100;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

.connection-bar.error {
  display: flex;
  background: var(--red-glow);
  border: 1px solid var(--red);
  color: var(--red);
}

.connection-bar.connecting {
  display: flex;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--accent);
}
