/* RemoteDesk – Design System */
:root {
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --blue-50: #EFF6FF;
  --blue-100: #DBEAFE;
  --cyan-400: #22D3EE;
  --cyan-500: #06B6D4;
  --green-500: #22C55E;
  --green-600: #16A34A;
  --red-500: #EF4444;
  --red-600: #DC2626;
  --yellow-400: #FACC15;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 2px 8px rgba(0,0,0,.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.15);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'Courier New', 'Roboto Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: #0F172A;
  color: var(--gray-800);
  min-height: 100vh;
  overflow-x: hidden;
}

/* SCREENS */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* APP SHELL */
.app-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #0F172A 100%);
  display: flex;
  flex-direction: column;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(10px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.3px;
}
.logo svg { width: 32px; height: 32px; }
.logo.small svg { width: 26px; height: 26px; }
.logo.small { font-size: 15px; gap: 8px; }

.topnav { display: flex; gap: 32px; }
.topnav a {
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .15s;
}
.topnav a:hover, .topnav a.active { color: #fff; }

/* LANDING MAIN */
.landing-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 40px 20px;
}

/* PANELS */
.panel {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 400px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.05);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}

.panel-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.host-icon { background: var(--blue-50); color: var(--blue-600); }
.guest-icon { background: #F0FDF4; color: var(--green-600); }
.panel-icon svg { width: 22px; height: 22px; }

.panel h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.panel-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* SESSION DISPLAY */
.session-display {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  text-align: center;
}

.session-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.session-id {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--blue-600);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.session-placeholder { color: var(--gray-300); letter-spacing: 2px; }

.session-status {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 8px;
}
.session-status.connected { color: var(--green-500); }
.session-status.waiting { color: var(--yellow-400); }

/* HOST CONTROLS */
.host-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* SECURITY INFO */
.security-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}
.security-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--gray-500);
}
.security-badge svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--green-500); }

/* DIVIDER */
.panel-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  flex-shrink: 0;
}
.panel-divider span {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.5);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

/* CONNECT FORM */
.connect-form { margin-bottom: 24px; }

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.id-input-row {
  display: flex;
  gap: 8px;
}

.id-input {
  flex: 1;
  height: 44px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--gray-800);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background: white;
}
.id-input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-100);
}
.id-input::placeholder { color: var(--gray-300); letter-spacing: 1px; font-size: 14px; }

.connect-status {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 8px;
  min-height: 18px;
}
.connect-status.error { color: var(--red-500); }
.connect-status.success { color: var(--green-500); }

/* RECENT */
.recent-section { border-top: 1px solid var(--gray-200); padding-top: 16px; }
.recent-label { font-size: 12px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.recent-empty { font-size: 13px; color: var(--gray-300); text-align: center; padding: 12px 0; }
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .1s;
}
.recent-item:hover { background: var(--gray-50); }
.recent-item-id { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--gray-700); letter-spacing: 2px; }
.recent-item-time { font-size: 11px; color: var(--gray-400); }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--blue-600); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }

.btn-success { background: var(--green-500); color: white; }
.btn-success:hover:not(:disabled) { background: var(--green-600); }

.btn-danger { background: var(--red-500); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--red-600); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover:not(:disabled) { border-color: var(--gray-400); background: var(--gray-50); }

.btn-ghost { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-200); }

.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: var(--radius-sm); }
.w-full { width: 100%; }

/* SESSION TOPBAR */
.session-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--gray-900);
  border-bottom: 1px solid var(--gray-800);
  gap: 20px;
  flex-shrink: 0;
  color: white;
}

.session-meta { display: flex; align-items: center; gap: 16px; flex: 1; justify-content: center; }

.connection-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
}
.connection-pill.connected { background: rgba(34,197,94,.15); color: #4ade80; }
.connection-pill.connected .dot { background: #22c55e; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: pulse 2s infinite;
}

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

.session-id-small { font-size: 12px; color: rgba(255,255,255,.45); }
.session-id-small strong { color: rgba(255,255,255,.8); font-family: var(--mono); letter-spacing: 1px; }

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

/* HOST WORKSPACE */
.host-workspace {
  flex: 1;
  background: #0A0F1E;
  display: flex;
  align-items: center;
  justify-content: center;
}

.host-info-card {
  text-align: center;
  color: white;
  max-width: 420px;
}

.waiting-anim {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  border: 2px solid rgba(37, 99, 235, 0.4);
  border-radius: 50%;
  animation: ripple 2.5s infinite;
}
.pulse-ring:nth-child(1) { width: 60px; height: 60px; }
.pulse-ring:nth-child(2) { width: 80px; height: 80px; animation-delay: 0.5s; }
.pulse-ring:nth-child(3) { width: 100px; height: 100px; animation-delay: 1s; }

@keyframes ripple {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.screen-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  background: rgba(37, 99, 235, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(37, 99, 235, 0.3);
}
.screen-icon svg { width: 24px; height: 24px; color: var(--blue-400, #60a5fa); }

.host-info-card h3 { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.host-info-card p { font-size: 14px; color: rgba(255,255,255,.5); margin-bottom: 24px; line-height: 1.6; }

.big-session-id {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--cyan-400);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius);
  padding: 14px 24px;
  margin-bottom: 24px;
  display: inline-block;
}

/* HOST STREAMING */
.host-streaming {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.streaming-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green-500);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.rec-dot {
  width: 8px;
  height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  animation: blink 1s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

#local-preview {
  max-width: 600px;
  width: 100%;
  border-radius: var(--radius);
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
}

.stream-controls {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}
.ctrl-btn:hover { background: rgba(255,255,255,.12); color: white; border-color: rgba(255,255,255,.3); }
.ctrl-btn svg { width: 16px; height: 16px; }
.ctrl-btn.active { background: var(--blue-600); border-color: var(--blue-600); color: white; }

/* GUEST WORKSPACE */
.guest-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #0A0F1E;
}

.remote-screen-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050a14;
}

.remote-video {
  max-width: 100%;
  max-height: 100%;
  cursor: none;
}

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

/* CONNECTING OVERLAY */
.connecting-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  gap: 20px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.connecting-overlay p { font-size: 14px; color: rgba(255,255,255,.6); }

.connecting-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: rgba(255,255,255,.35);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.05);
  transition: all .3s;
}
.step::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  flex-shrink: 0;
}
.step.active {
  color: rgba(255,255,255,.85);
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.3);
}
.step.active::before { background: var(--blue-600); animation: pulse 1s infinite; }
.step.done { color: var(--green-500); }
.step.done::before { background: var(--green-500); animation: none; }

/* SIDEBAR */
.guest-sidebar {
  width: 220px;
  background: var(--gray-900);
  border-left: 1px solid var(--gray-800);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-800);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,.4);
}
.stat-row span:last-child { color: rgba(255,255,255,.8); font-family: var(--mono); }

.shortcut-row { display: flex; justify-content: center; }
kbd {
  background: var(--gray-800);
  border: 1px solid var(--gray-700);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: var(--mono);
  color: rgba(255,255,255,.7);
}

.clipboard-area {
  width: 100%;
  height: 80px;
  background: var(--gray-800);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.8);
  font-size: 12px;
  padding: 8px;
  resize: none;
  outline: none;
  font-family: var(--font);
}
.clipboard-area:focus { border-color: var(--blue-600); }

/* TOOLBAR GROUP */
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.05);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid rgba(255,255,255,.1);
}

.divider-v {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.15);
  margin: 0 4px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.toggle-label:hover { background: rgba(255,255,255,.08); }
.toggle-label input { width: 14px; height: 14px; accent-color: var(--blue-600); }
.toggle-text { font-size: 12px; color: rgba(255,255,255,.7); white-space: nowrap; font-weight: 500; }

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--gray-900);
  color: white;
  border: 1px solid var(--gray-700);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 300px;
  animation: slideIn 0.2s ease;
}
.toast.success { border-left: 3px solid var(--green-500); }
.toast.error { border-left: 3px solid var(--red-500); }
.toast.info { border-left: 3px solid var(--blue-600); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* CUSTOM CURSOR */
.custom-cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.8);
  border: 2px solid white;
  pointer-events: none;
  z-index: 100;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  transition: transform .05s;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .landing-main { flex-direction: column; align-items: center; }
  .panel { width: min(400px, 100%); }
  .panel-divider { width: auto; transform: rotate(90deg); }
  .topbar { padding: 14px 20px; }
  .topnav { display: none; }
  .guest-sidebar { width: 180px; }
}

@media (max-width: 600px) {
  .session-topbar { flex-wrap: wrap; gap: 10px; }
  .session-meta { order: 3; width: 100%; justify-content: flex-start; }
  .guest-sidebar { display: none; }
}
