@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-color: #08090c;
  --surface-color: rgba(17, 20, 28, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-purple: #9d4edd;
  --accent-purple-glow: rgba(157, 78, 221, 0.4);
  --accent-cyan: #00f5d4;
  --accent-cyan-glow: rgba(0, 245, 212, 0.3);
  --accent-red: #ff0054;
  --accent-red-glow: rgba(255, 0, 84, 0.5);
  --text-primary: #f8f9fa;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;
  --gradient-neon: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  --font-family: 'Cairo', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  direction: rtl; /* RTL Support for Arabic */
}

/* Background decorative glows */
body::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(157, 78, 221, 0.15) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(0, 245, 212, 0.12) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Header & Navigation */
header {
  background-color: rgba(8, 9, 12, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1.2rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-weight: 800;
  font-size: 1.6rem;
  background: var(--gradient-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.logo span {
  color: var(--text-primary);
}

.logo-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-red);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-red);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-btn {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

/* Main Container */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Glass Card */
.glass-card {
  background: var(--surface-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 2.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(157, 78, 221, 0.25);
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  background: var(--gradient-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.3;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
}

/* Streaming Choice Grid */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
  margin-top: 2rem;
}

.choice-card {
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 3rem 2rem;
}

.choice-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-neon);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.choice-card:hover::before {
  opacity: 1;
}

.choice-card:hover {
  transform: translateY(-8px);
}

.icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--accent-cyan);
  transition: all 0.3s ease;
}

.choice-card:hover .icon-wrapper {
  background: var(--gradient-neon);
  color: var(--bg-color);
  box-shadow: 0 0 20px var(--accent-purple-glow);
}

.choice-card h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

.choice-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 1rem;
}

.primary-btn {
  background: var(--gradient-neon);
  color: var(--bg-color);
  border: none;
  padding: 0.8rem 2rem;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-family);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--accent-purple-glow);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.primary-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 25px var(--accent-purple-glow), 0 0 10px var(--accent-cyan-glow);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.8rem 2rem;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-family);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
}

/* Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

.stream-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.video-container {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: #030406;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror camera for streamer */
}

/* Viewer video should not be mirrored */
.viewer-video video {
  transform: none !important;
}

.video-placeholder {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
}

.video-placeholder i {
  font-size: 4rem;
}

.badge-live {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: var(--accent-red);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 0 15px var(--accent-red-glow);
  z-index: 10;
  animation: pulse-red 2s infinite;
  display: none; /* Hidden by default */
}

.badge-offline {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  z-index: 10;
  border: 1px solid var(--border-color);
}

@keyframes pulse-red {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 0, 84, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(255, 0, 84, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 0, 84, 0);
  }
}

/* Control Buttons Bar */
.control-bar {
  display: flex;
  gap: 1rem;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.02);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.control-btn {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.control-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.control-btn.active-btn {
  background-color: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px var(--accent-purple-glow);
}

.control-btn.danger-btn {
  background-color: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
  box-shadow: 0 0 15px var(--accent-red-glow);
}

/* Setup Panel */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel-title {
  font-size: 1.3rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.8rem;
  margin-bottom: 0.5rem;
}

/* Stream Key & Server Address Copy Card */
.copy-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.copy-group label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.copy-input-container {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.copy-input-container input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-family: monospace;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-left: 1px solid var(--border-color);
  color: var(--accent-cyan);
  padding: 0 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: bold;
}

.copy-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-color);
}

/* Method Selector Tabs */
.tab-container {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  position: relative;
  transition: color 0.3s ease;
}

.tab-btn.active-tab {
  color: var(--accent-cyan);
}

.tab-btn.active-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent-cyan);
}

.tab-content {
  display: none;
}

.tab-content.active-content {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* Instructions List */
.instructions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.instructions-list li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.instructions-list li::before {
  content: '✦';
  color: var(--accent-cyan);
}

/* Status Widget */
.status-widget {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.status-value {
  font-weight: 700;
}

.status-connected {
  color: var(--accent-cyan);
}

.status-disconnected {
  color: var(--text-muted);
}

/* Chat box for Player Page */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 500px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  min-height: 300px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
}

.chat-user {
  font-weight: 800;
  color: var(--accent-purple);
}

.chat-text {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border-right: 2px solid var(--accent-purple);
  width: fit-content;
  max-width: 90vw;
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.chat-input-bar input {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  outline: none;
  font-family: var(--font-family);
  font-size: 0.95rem;
}

.chat-input-bar input:focus {
  border-color: var(--accent-purple);
}

.send-chat-btn {
  background: var(--accent-purple);
  color: white;
  border: none;
  padding: 0 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-family: var(--font-family);
  transition: all 0.3s ease;
}

.send-chat-btn:hover {
  background: #b566ff;
  box-shadow: 0 0 10px var(--accent-purple-glow);
}

/* Footer styling */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: auto;
}

/* Utility classes */
.text-gradient {
  background: var(--gradient-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pulse-animation {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  display: inline-block;
  margin-left: 0.5rem;
}

.pulse-animation.pulse-offline {
  background: var(--text-muted);
  box-shadow: none;
}
