/* ═══════════════════════════════════════════
   ScreenCast - Professional Dark Theme
═══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1526;
  --bg-card: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(99,179,237,0.4);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-glow: rgba(99,102,241,0.35);
  --red: #ef4444;
  --red-glow: rgba(239,68,68,0.35);
  --green: #22c55e;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Fullscreen live mode: hide header, expand container */
body.live-mode .site-header { transform: translateY(-100%); opacity: 0; pointer-events: none; }
body.live-mode .main-container { padding: 0; max-width: 100%; }
body.live-mode .live-section { gap: 0; }

/* ── Background Particles ── */
.bg-particles {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139,92,246,0.10) 0%, transparent 55%);
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: float linear infinite;
  opacity: 0;
}

@keyframes float {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  background: rgba(7,11,20,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.logo { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 700; }
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.logo-icon svg { width: 20px; height: 20px; }

.header-badge, .viewer-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 50px;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  font-size: 0.82rem; font-weight: 600; color: #a5b4fc;
}

.viewer-badge { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #86efac; }

/* ── Pulse dot ── */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); position: relative;
}
.pulse-dot::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; background: var(--accent);
  animation: pulse 1.5s ease-out infinite; opacity: 0;
}
.pulse-dot.green { background: var(--green); }
.pulse-dot.green::after { background: var(--green); }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(2.5); opacity: 0; } }

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.glass-card:hover { border-color: var(--border-hover); }

/* ── Main container ── */
.main-container { position: relative; z-index: 1; padding: 48px 32px; max-width: 900px; margin: 0 auto; }

/* ── Hero ── */
.hero-section { display: flex; flex-direction: column; align-items: center; gap: 40px; text-align: center; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px; border-radius: 50px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.25);
  font-size: 0.82rem; color: #a5b4fc; font-weight: 600;
}

.hero-title { font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 800; line-height: 1.15; }
.gradient-text {
  background: linear-gradient(135deg, #6366f1, #a78bfa, #c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.hero-subtitle { font-size: 1.05rem; color: var(--text-secondary); line-height: 1.8; max-width: 540px; }

/* ── Settings Panel ── */
.settings-panel { padding: 28px; width: 100%; max-width: 600px; }
.settings-title { font-size: 1rem; font-weight: 700; margin-bottom: 24px; color: var(--text-secondary); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.setting-group { display: flex; flex-direction: column; gap: 10px; }
.setting-group.full-width { grid-column: 1 / -1; }
.setting-label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.optional-tag { color: var(--text-muted); font-weight: 400; }

/* Radio buttons */
.radio-group { display: flex; gap: 8px; }
.radio-btn {
  flex: 1; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-family: 'Cairo', sans-serif;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.radio-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.radio-btn.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff; box-shadow: 0 0 20px var(--accent-glow);
}

/* 4K button — gold premium look */
#q4k {
  border-color: rgba(234,179,8,0.35);
  color: #fbbf24;
  background: rgba(234,179,8,0.06);
}
#q4k:hover {
  border-color: rgba(234,179,8,0.7);
  background: rgba(234,179,8,0.12);
  color: #fde68a;
}
#q4k.active {
  background: linear-gradient(135deg, #b45309, #d97706, #f59e0b);
  border-color: #f59e0b;
  color: #fff;
  box-shadow: 0 0 22px rgba(245,158,11,0.5);
}

/* Toggle */
.toggle-wrapper { display: flex; align-items: center; }
.toggle-input { display: none; }
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-track {
  width: 44px; height: 24px; background: var(--text-muted);
  border-radius: 50px; position: relative; transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-track::after {
  content: ''; position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform var(--transition);
}
.toggle-input:checked ~ .toggle-label .toggle-track { background: var(--accent); }
.toggle-input:checked ~ .toggle-label .toggle-track::after { transform: translateX(-20px); }
.toggle-text-on { font-size: 0.85rem; color: var(--text-primary); }
.toggle-text-off { font-size: 0.85rem; color: var(--text-muted); display: none; }
.toggle-input:not(:checked) ~ .toggle-label .toggle-text-on { display: none; }
.toggle-input:not(:checked) ~ .toggle-label .toggle-text-off { display: block; }

/* Password input */
.password-input-wrapper { display: flex; align-items: center; position: relative; }
.input-icon { position: absolute; right: 14px; width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.password-input {
  width: 100%; padding: 12px 44px 12px 44px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'Cairo', sans-serif; font-size: 0.9rem;
  transition: border-color var(--transition);
  direction: rtl;
}
.password-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.password-input::placeholder { color: var(--text-muted); }
.toggle-pass-btn {
  position: absolute; left: 12px; background: none; border: none;
  cursor: pointer; color: var(--text-muted); padding: 4px;
  transition: color var(--transition);
}
.toggle-pass-btn:hover { color: var(--text-primary); }
.toggle-pass-btn svg { width: 18px; height: 18px; }

/* ── Start Button ── */
.btn-start {
  position: relative; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50px; padding: 2px;
  box-shadow: 0 0 40px var(--accent-glow);
  transition: transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
}
.btn-start:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 0 60px var(--accent-glow); }
.btn-start:active { transform: translateY(0) scale(0.98); }
.btn-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 48px; border-radius: 50px;
  background: linear-gradient(135deg, #5558e8, #7c3aed);
  font-family: 'Cairo', sans-serif; font-size: 1.1rem; font-weight: 700;
  color: #fff; position: relative; z-index: 1;
}
.btn-icon { width: 22px; height: 22px; }
.btn-glow {
  position: absolute; inset: -2px; border-radius: 50px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  filter: blur(12px); opacity: 0.6; z-index: 0;
  animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.8; } }

/* ── Feature cards ── */
.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; width: 100%; }
.feature-card { display: flex; align-items: center; gap: 12px; padding: 16px 18px; }
.feature-icon { font-size: 1.5rem; flex-shrink: 0; }
.feature-text { display: flex; flex-direction: column; gap: 2px; }
.feature-text strong { font-size: 0.82rem; font-weight: 700; }
.feature-text span { font-size: 0.72rem; color: var(--text-muted); }

/* ── LIVE SECTION ── fullscreen layout ── */
.live-section {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  background: #000;
}

/* Fullscreen video fills all remaining space */
.preview-wrapper {
  flex: 1; position: relative;
  padding: 0; overflow: hidden;
  border-radius: 0; border: none;
  background: #000;
}
.preview-video {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
  background: #000;
}

/* Top HUD overlay — hidden until hover */
.live-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.live-section:hover .live-hud { opacity: 1; pointer-events: all; }

/* Bottom share bar overlay — hidden until hover */
.live-bottom-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.80) 0%, transparent 100%);
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.live-section:hover .live-bottom-bar { opacity: 1; pointer-events: all; }

/* Recording bar inside live section */
.recording-bar {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 11; white-space: nowrap;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-radius: 50px;
  background: rgba(239,68,68,0.18); border: 1px solid rgba(239,68,68,0.4);
  backdrop-filter: blur(10px); font-size: 0.88rem;
}

.live-indicator {
  display: flex; align-items: center; gap: 8px;
  color: #ff6b6b; font-weight: 700; font-size: 0.9rem;
}
.live-dot {
  width: 10px; height: 10px; background: var(--red); border-radius: 50%;
  animation: blink 1s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.live-stats { display: flex; gap: 10px; }
.stat-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 50px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 0.8rem; color: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
}

.live-actions { display: flex; gap: 8px; margin-right: auto; }
.btn-icon-action {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); backdrop-filter: blur(6px);
}
.btn-icon-action svg { width: 18px; height: 18px; }
.btn-icon-action:hover { background: rgba(255,255,255,0.22); color: #fff; }
.btn-icon-action.danger { border-color: rgba(239,68,68,0.5); color: #ff8080; }
.btn-icon-action.danger:hover { background: rgba(239,68,68,0.25); box-shadow: 0 0 20px var(--red-glow); }
.btn-icon-action.recording { background: rgba(239,68,68,0.2); border-color: var(--red); color: var(--red); animation: blink 1s infinite; }

/* Share URL row in bottom bar */
.share-url {
  flex: 1; padding: 8px 14px;
  background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-sm); font-size: 0.85rem;
  color: #c4b5fd; font-family: monospace;
  direction: ltr; text-align: left; backdrop-filter: blur(6px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-copy {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: var(--radius-sm);
  background: var(--accent); border: none; color: #fff;
  font-family: 'Cairo', sans-serif; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn-copy:hover { background: #5558e8; box-shadow: 0 0 20px var(--accent-glow); }
.btn-copy.copied { background: var(--green); }

.quality-tag {
  padding: 5px 12px; border-radius: 50px;
  background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.4);
  font-size: 0.75rem; color: #a5b4fc; font-weight: 600;
  backdrop-filter: blur(6px);
}

.rec-dot { width: 10px; height: 10px; background: var(--red); border-radius: 50%; animation: blink 0.8s infinite; flex-shrink: 0; }
.btn-stop-rec {
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--red); border: none; color: #fff;
  font-family: 'Cairo', sans-serif; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-stop-rec:hover { background: #dc2626; }

/* Recording bar */
.recording-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-radius: var(--radius);
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  font-size: 0.9rem;
}
.rec-dot { width: 10px; height: 10px; background: var(--red); border-radius: 50%; animation: blink 0.8s infinite; flex-shrink: 0; }
.btn-stop-rec {
  margin-right: auto; padding: 7px 16px; border-radius: var(--radius-sm);
  background: var(--red); border: none; color: #fff;
  font-family: 'Cairo', sans-serif; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-stop-rec:hover { background: #dc2626; }

/* ═══ WATCH PAGE ═══ */
.watch-page { overflow: hidden; }
.watch-main { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 72px); }

/* Password gate */
.password-gate {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 48px 40px; max-width: 420px; width: 90%; text-align: center;
}
.gate-icon { font-size: 3rem; }
.password-gate h2 { font-size: 1.5rem; font-weight: 800; }
.password-gate p { color: var(--text-secondary); font-size: 0.9rem; }
.gate-input-wrapper { display: flex; gap: 10px; width: 100%; }
.gate-password-input {
  flex: 1; padding: 12px 16px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'Cairo', sans-serif; font-size: 0.9rem;
  transition: border-color var(--transition);
}
.gate-password-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.btn-gate-submit {
  padding: 12px 22px; border-radius: var(--radius-sm);
  background: var(--accent); border: none; color: #fff;
  font-family: 'Cairo', sans-serif; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn-gate-submit:hover { background: #5558e8; }
.gate-error { color: var(--red); font-size: 0.85rem; }

/* Connecting spinner */
.connecting-overlay {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  color: var(--text-secondary); font-size: 0.95rem;
}
.connecting-spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Video player */
.player-container {
  position: relative; width: 100%; max-width: 1200px;
  background: #000; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
}
.remote-video { width: 100%; max-height: 80vh; display: block; object-fit: contain; background: #000; }

.player-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  opacity: 0; transition: opacity var(--transition);
}
.player-container:hover .player-controls { opacity: 1; }

.live-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 50px;
  background: rgba(239,68,68,0.25); border: 1px solid rgba(239,68,68,0.5);
  color: #fca5a5; font-size: 0.78rem; font-weight: 700;
}
.stream-info {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: rgba(255,255,255,0.7);
}
.ctrl-btn {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer; transition: all var(--transition);
}
.ctrl-btn:hover { background: rgba(255,255,255,0.2); }

/* Ended overlay */
.ended-overlay {
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
.ended-icon { font-size: 4rem; }
.ended-overlay h2 { font-size: 2rem; font-weight: 800; }
.ended-overlay p { color: var(--text-secondary); }
.btn-return {
  padding: 12px 28px; border-radius: 50px;
  background: var(--accent); color: #fff; font-family: 'Cairo', sans-serif;
  font-weight: 700; text-decoration: none;
  transition: all var(--transition);
  box-shadow: 0 0 30px var(--accent-glow);
}
.btn-return:hover { background: #5558e8; transform: translateY(-2px); }

/* Toast */
.toast {
  position: fixed; bottom: 30px; right: 50%; transform: translateX(50%);
  padding: 12px 24px; border-radius: 50px; z-index: 9999;
  background: rgba(30,40,60,0.95); border: 1px solid var(--border);
  backdrop-filter: blur(12px); font-size: 0.9rem; font-weight: 600;
  box-shadow: var(--shadow); transition: all 0.3s ease;
  white-space: nowrap;
}
.toast.show { animation: toastIn 0.3s ease; }
@keyframes toastIn { from { transform: translateX(50%) translateY(20px); opacity: 0; } to { transform: translateX(50%) translateY(0); opacity: 1; } }

/* Utility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
  .main-container { padding: 24px 16px; }
  .settings-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .site-header { padding: 12px 16px; }
  .live-topbar { flex-wrap: wrap; gap: 12px; }
  .controls-center { display: none; }
}
@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 2rem; }
}
