/* ============================================
   COPILOT SCREEN SHARE — DESIGN SYSTEM
   Based on Microsoft Fluent 2 / Copilot
   ============================================ */

/* ── Font faces ── */
@font-face {
  font-family: 'Segoe UI Web';
  src: url('https://static2.sharepointonline.com/files/fabric/assets/fonts/segoeui-westeuropean/segoeui-light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Segoe UI Web';
  src: url('https://static2.sharepointonline.com/files/fabric/assets/fonts/segoeui-westeuropean/segoeui-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Segoe UI Web';
  src: url('https://static2.sharepointonline.com/files/fabric/assets/fonts/segoeui-westeuropean/segoeui-semibold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Segoe UI Web';
  src: url('https://static2.sharepointonline.com/files/fabric/assets/fonts/segoeui-westeuropean/segoeui-bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ── Design tokens (Fluent 2) ── */
:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 14%;
  --surface: 0 0% 100%;
  --text-primary: 0 0% 14%;
  --text-subtle: 0 0% 38%;
  --text-disabled: 0 0% 55%;
  --text-placeholder: 0 0% 62%;

  /* Primary CTA — dark filled (M365 marketing) */
  --primary: 0 0% 11%;
  --primary-foreground: 0 0% 100%;
  --primary-hover: 0 0% 20%;
  --primary-active: 0 0% 28%;

  /* Brand accent — Copilot (links, badges, accents) */
  --brand: 237 81% 60%;
  --brand-background: 228 100% 96%;
  --brand-background-hover: 228 100% 90%;

  --secondary: 0 0% 100%;
  --secondary-hover: 0 0% 96%;
  --secondary-border: 0 0% 78%;
  --secondary-foreground: 0 0% 14%;

  --muted: 220 14% 96%;
  --muted-foreground: 215 14% 46%;

  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 100%;

  --status-success: 142 71% 45%;
  --status-error: 0 84% 60%;

  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 237 81% 60%;
  --radius-pill: 9999px;

  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --shadow-card: 0 2px 4px hsl(0 0% 0% / 0.04), 0 0 0 1px hsl(0 0% 0% / 0.06);
  --shadow-card-hover: 0 2px 8px hsl(0 0% 0% / 0.08), 0 0 0 1px hsl(0 0% 0% / 0.06);
  --shadow-elevated: 0 8px 16px hsl(0 0% 0% / 0.14), 0 0 0 1px hsl(0 0% 0% / 0.05);

  --font-primary: 'Segoe UI Variable', 'Segoe UI Web', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
}

/* ── Typography (Fluent type ramp) ── */
.text-title-1   { font-size: 26px; line-height: 34px; font-weight: 600; }
.text-title-2   { font-size: 20px; line-height: 28px; font-weight: 600; }
.text-subtitle-2 { font-size: 14px; line-height: 20px; font-weight: 600; color: hsl(var(--foreground)); }
.text-body-1    { font-size: 15px; line-height: 22px; font-weight: 400; }
.text-body-2    { font-size: 14px; line-height: 20px; font-weight: 400; }

.text-subtle    { color: hsl(var(--text-subtle)); }

/* ── Form elements ── */
.form-label {
  display: block; font-size: 14px; font-weight: 600;
  color: hsl(var(--foreground)); margin-bottom: 6px;
}

.form-input {
  width: 100%; height: 36px; padding: 0 12px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-bottom-color: hsl(0 0% 54%);
  border-radius: var(--radius);
  font-family: var(--font-primary); font-size: 14px;
  color: hsl(var(--foreground));
  outline: none; transition: border-color 0.1s;
}
.form-input::placeholder { color: hsl(var(--text-placeholder)); }
.form-input:focus {
  border-color: hsl(var(--input));
  border-bottom: 2px solid hsl(var(--ring));
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: hsl(220 14% 96%);
  overflow: auto;
  padding: 24px;
}

.login-container {
  width: 100%; max-width: 420px;
  animation: fadeIn 0.3s ease-out both;
}

.login-card {
  background: hsl(var(--background));
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elevated);
  padding: 40px 40px 32px;
}

.login-header {
  text-align: center; margin-bottom: 24px;
}

.copilot-icon {
  width: 44px; height: 44px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}

.login-title {
  font-size: 22px; font-weight: 600; line-height: 28px;
  color: hsl(var(--foreground));
}

.copilot-gradient-line {
  width: 44px; height: 2px; margin: 8px auto 10px;
  background: linear-gradient(90deg, hsl(237 75% 59%), hsl(193 94% 63%), hsl(199 89% 55%));
  border-radius: 1px;
}

.login-subtitle {
  font-size: 13px; line-height: 18px;
  color: hsl(var(--text-subtle));
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { position: relative; }

.login-error {
  background: hsl(0 72% 97%);
  color: hsl(0 72% 44%);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
}

.login-btn {
  width: 100%; height: 40px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-family: var(--font-primary);
  transition: background 0.1s;
  margin-top: 8px;
}
.login-btn:hover { background: hsl(var(--primary-hover)); }
.login-btn:active { background: hsl(var(--primary-active)); }
.login-btn:disabled { opacity: 0.5; cursor: default; }

.login-footer {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid hsl(var(--border));
}

.app-footer {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  flex-shrink: 0;
}

.login-footer, .app-footer { /* shared footer styles */ }

.footer-text { font-size: 11px; color: hsl(var(--text-disabled)); }
.footer-link { font-size: 11px; color: hsl(var(--text-disabled)); text-decoration: none; }
.footer-link:hover { color: hsl(var(--foreground)); text-decoration: underline; }
.footer-sep { width: 1px; height: 10px; background: hsl(var(--border)); }

/* ============================================
   APP LAYOUT
   ============================================ */
.app-body {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 20px;
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0; z-index: 10;
}

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

.copilot-icon-sm {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}

.header-title {
  font-size: 14px; font-weight: 600;
  color: hsl(var(--foreground));
  display: flex; align-items: center; gap: 6px;
}

.login-preview-tag {
  display: inline-block;
  margin: 6px auto 4px;
}

.preview-tag {
  font-size: 10px; font-weight: 600;
  color: hsl(var(--text-disabled));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1px 6px;
  letter-spacing: 0.02em;
}

.header-right {
  display: flex; align-items: center; gap: 4px;
}

.user-badge {
  display: flex; align-items: center;
  padding: 0 8px;
  height: 32px;
}

.user-name {
  font-size: 13px; font-weight: 600;
  color: hsl(var(--text-subtle));
}

.header-sep {
  width: 1px; height: 16px;
  background: hsl(var(--border));
  margin: 0 4px;
}

.sign-out-btn {
  font-size: 13px; height: 32px;
  border-radius: var(--radius);
  background: transparent; border: none;
  color: hsl(var(--text-subtle));
  cursor: pointer; padding: 0 8px;
  font-family: var(--font-primary); font-weight: 400;
  transition: background 0.1s, color 0.1s;
}
.sign-out-btn:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }

/* ── Main content ── */
.app-main {
  flex: 1; overflow-y: auto;
  display: flex; justify-content: center;
  padding: 0;
  background: hsl(220 14% 97%);
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard {
  width: 100%; max-width: 720px;
  padding: 40px 32px 60px;
}

.dashboard-welcome {
  margin-bottom: 24px;
}
.dashboard-welcome .text-title-1 { margin-bottom: 6px; }

.admin-badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: var(--radius-pill);
  background: hsl(var(--brand-background));
  color: hsl(var(--brand));
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.dashboard-section {
  margin-bottom: 24px;
}
.dashboard-section .text-subtitle-2 {
  margin-bottom: 12px;
}

/* App cards grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.app-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--background));
  transition: box-shadow 0.15s;
}
.app-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.app-card-icon {
  width: 40px; height: 40px; border-radius: var(--radius-lg);
  background: hsl(var(--brand-background));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: hsl(var(--brand));
}
.app-card-icon svg { width: 20px; height: 20px; }

.app-card-info { flex: 1; min-width: 0; }
.app-card-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.app-card-desc { font-size: 13px; line-height: 18px; color: hsl(var(--text-subtle)); }

.app-card-link {
  font-size: 13px; font-weight: 600;
  color: hsl(var(--brand));
  text-decoration: none;
  flex-shrink: 0; align-self: center;
  padding: 6px 14px; border-radius: var(--radius-pill);
  border: 1px solid hsl(var(--brand) / 0.3);
  transition: background 0.1s, border-color 0.1s;
}
.app-card-link:hover { background: hsl(var(--brand-background)); border-color: hsl(var(--brand) / 0.5); }

/* Start section */
.start-section {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.start-section::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, hsl(237 75% 59%), hsl(193 94% 63%), hsl(199 89% 55%));
}

.start-section-icon {
  width: 52px; height: 52px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.start-section-icon img { width: 52px; height: 52px; }

.start-section .text-title-2 { margin-bottom: 6px; }
.start-section .text-body-1 { max-width: 420px; margin: 0 auto 24px; color: hsl(var(--text-subtle)); }

.start-section-steps {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 420px; margin: 0 auto 28px;
  text-align: left;
}

.step-item {
  display: flex; align-items: flex-start; gap: 12px;
}

.step-number {
  width: 22px; height: 22px; border-radius: 50%;
  background: hsl(var(--foreground));
  color: white;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 0px;
}

.step-text {
  font-size: 14px; line-height: 22px;
  color: hsl(var(--text-subtle));
}
.step-text strong { color: hsl(var(--foreground)); font-weight: 600; }

.start-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 28px;
  background: hsl(var(--primary)); color: white;
  border: none; border-radius: var(--radius-pill);
  font-family: var(--font-primary);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}
.start-btn:hover { background: hsl(var(--primary-hover)); }
.start-btn:active { background: hsl(var(--primary-active)); }
.start-btn svg { width: 18px; height: 18px; }

/* Project cards (admin) */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.project-card {
  padding: 20px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--background));
  transition: box-shadow 0.15s;
}
.project-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.project-card-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}

.project-avatar {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}

.project-card-name { font-size: 14px; font-weight: 600; }
.project-card-meta { font-size: 12px; color: hsl(var(--text-subtle)); margin-top: 2px; }

.project-card-apps {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 14px;
}

.app-tag {
  display: inline-flex;
  padding: 2px 8px; border-radius: var(--radius);
  background: hsl(var(--muted));
  font-size: 12px; font-weight: 400;
  color: hsl(var(--muted-foreground));
}

.project-start-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 36px;
  background: hsl(var(--primary)); color: white;
  border: none; border-radius: var(--radius-pill);
  font-family: var(--font-primary); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.1s;
}
.project-start-btn:hover { background: hsl(var(--primary-hover)); }

/* ============================================
   SCREEN SHARE STATE
   ============================================ */
.sharing-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%;
  padding: 40px 32px;
  flex: 1;
}

.sharing-content {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 8px;
}

.sharing-copilot-icon {
  width: 56px; height: 56px; margin-bottom: 8px;
}
.sharing-copilot-icon img { width: 56px; height: 56px; }

.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: hsl(var(--status-success) / 0.08);
  color: hsl(142 71% 32%);
  font-size: 12px; font-weight: 600;
  margin-bottom: 4px;
}

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: hsl(var(--status-success));
  animation: pulseDot 2s ease-in-out infinite;
}

.sharing-hint {
  max-width: 340px; margin-bottom: 16px;
}

.sharing-privacy {
  max-width: 400px;
  color: hsl(var(--text-disabled));
  font-size: 12px; line-height: 18px;
  margin-bottom: 24px;
}

.stop-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 24px;
  background: hsl(var(--destructive)); color: white;
  border: none; border-radius: var(--radius-pill);
  font-family: var(--font-primary); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.1s;
}
.stop-btn:hover { background: hsl(0 72% 45%); }
.stop-btn svg { width: 16px; height: 16px; }

/* ── Debug panel ── */
.debug-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 220px;
  background: hsl(222 20% 11%);
  border-top: 1px solid hsl(222 13% 22%);
  display: flex; flex-direction: column;
  z-index: 50;
  animation: panelSlideUp 0.2s ease-out;
}

.debug-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid hsl(222 13% 18%);
  flex-shrink: 0;
}

.debug-title {
  font-size: 11px; font-weight: 600;
  color: hsl(0 0% 55%);
  text-transform: uppercase; letter-spacing: 0.04em;
}

.debug-actions { display: flex; gap: 4px; }

.debug-btn {
  padding: 3px 8px; border-radius: 4px;
  background: hsl(222 20% 16%);
  border: 1px solid hsl(222 13% 22%);
  color: hsl(0 0% 55%);
  font-size: 11px; font-family: var(--font-primary);
  cursor: pointer; transition: background 0.1s;
}
.debug-btn:hover { background: hsl(222 20% 20%); color: hsl(0 0% 75%); }

.debug-logs {
  flex: 1; overflow-y: auto;
  padding: 6px 14px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 11px; line-height: 1.6;
}
.debug-logs::-webkit-scrollbar { width: 4px; }
.debug-logs::-webkit-scrollbar-track { background: transparent; }
.debug-logs::-webkit-scrollbar-thumb { background: hsl(222 13% 22%); border-radius: 2px; }

.debug-entry {
  display: flex; align-items: baseline; gap: 6px;
  padding: 1px 0;
}

.debug-time { color: hsl(0 0% 36%); flex-shrink: 0; }

.debug-tag {
  padding: 1px 5px; border-radius: 3px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; flex-shrink: 0;
}
.debug-tag.INFO     { background: hsl(0 0% 18%); color: hsl(0 0% 50%); }
.debug-tag.CAPTURE  { background: hsl(270 30% 18%); color: hsl(270 50% 65%); }
.debug-tag.SEARCH   { background: hsl(210 40% 18%); color: hsl(210 70% 65%); }
.debug-tag.GPT      { background: hsl(142 30% 16%); color: hsl(142 50% 60%); }
.debug-tag.STREAM   { background: hsl(280 30% 18%); color: hsl(280 50% 65%); }
.debug-tag.VOICE    { background: hsl(30 40% 18%); color: hsl(30 70% 60%); }
.debug-tag.USER     { background: hsl(237 30% 18%); color: hsl(237 50% 65%); }
.debug-tag.ERROR    { background: hsl(0 40% 18%); color: hsl(0 60% 60%); }

.debug-msg { color: hsl(0 0% 72%); }
.debug-data { color: hsl(0 0% 40%); margin-left: 6px; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

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

.animate-in {
  animation: slideUpFade 0.3s ease-out both;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.04s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.08s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.12s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .login-card { padding: 32px 24px 28px; }
  .dashboard { padding: 24px 16px 40px; }
  .app-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .start-section { padding: 24px 16px; }
}
