/* ==========================================================
   KumaLIVE - Refined Modern Dark Theme & SaaS UI System
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surface & Base Colors */
  --bg-base: #0a0d14;
  --bg-surface: #111726;
  --bg-surface-hover: #161f33;
  --bg-surface-elevated: #1a233a;
  --bg-surface-subtle: #222d4a;
  
  /* Primary Brand Colors */
  --primary: #5865f2;
  --primary-hover: #4752c4;
  --primary-subtle: rgba(88, 101, 242, 0.12);
  
  --accent: #d946ef;
  --accent-subtle: rgba(217, 70, 239, 0.12);
  
  --success: #10b981;
  --success-subtle: rgba(16, 185, 129, 0.12);
  
  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.12);
  
  --danger: #f43f5e;
  --danger-subtle: rgba(244, 63, 94, 0.12);
  
  /* Typography */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Borders & Dividers */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-focus: rgba(88, 101, 242, 0.6);
  
  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #818cf8;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.brand-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.nav-brand .brand-badge {
  background: var(--primary-subtle);
  border: 1px solid rgba(88, 101, 242, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  color: #a5b4fc;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #e11d48;
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Cards */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* Forms */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

select.form-control option {
  background: var(--bg-surface-elevated);
  color: #fff;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-live {
  background: var(--danger-subtle);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f43f5e;
}

.badge-private {
  background: var(--warning-subtle);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-public {
  background: var(--success-subtle);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-role-admin {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-role-host {
  background: var(--primary-subtle);
  color: #818cf8;
  border: 1px solid rgba(88, 101, 242, 0.3);
}

.badge-role-mod {
  background: var(--accent-subtle);
  color: #f472b6;
  border: 1px solid rgba(217, 70, 239, 0.3);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4.5rem 1rem 3.5rem;
}

.hero h1 {
  font-size: 3rem;
  line-height: 1.15;
  margin-bottom: 1rem;
  color: #fff;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 2rem;
}

/* Room Grid */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.room-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.room-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.room-thumbnail {
  height: 160px;
  background: #151c2e;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.room-badges {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  right: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-viewers-count {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

.room-content {
  padding: 1.15rem;
}

.room-title {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ==========================================================
   LIVE ROOM & WORKSPACE
   ========================================================== */
.live-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: calc(100vh - 61px);
  overflow: hidden;
  position: relative;
}

@media (max-width: 992px) {
  .live-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.stage-container {
  position: relative;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem;
}

.stage-controls {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(17, 23, 38, 0.88);
  backdrop-filter: blur(16px);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

/* ==========================================================
   TRANSPARENT CHAT OVERLAY
   ========================================================== */
.chat-overlay-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  position: relative;
  transition: all 0.2s ease;
  z-index: 90;
}

.chat-overlay-container.floating-mode {
  position: absolute;
  right: 1.5rem;
  bottom: 5.5rem;
  top: 1.5rem;
  width: 320px;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.chat-header-title {
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.chat-controls-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.opacity-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.opacity-slider {
  -webkit-appearance: none;
  width: 60px;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-surface-subtle);
  outline: none;
}

.opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  position: relative;
}

.chat-message:hover {
  background: rgba(255, 255, 255, 0.05);
}

.chat-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.chat-sender {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chat-time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.chat-text {
  font-size: 0.85rem;
  word-break: break-word;
  color: var(--text-primary);
}

.chat-text.deleted {
  font-style: italic;
  color: var(--text-muted);
}

.chat-actions-hover {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  display: none;
  gap: 0.2rem;
  background: var(--bg-surface-elevated);
  padding: 0.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.chat-message:hover .chat-actions-hover {
  display: flex;
}

.chat-input-wrapper {
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.chat-form {
  display: flex;
  gap: 0.4rem;
}

.chat-input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.85rem;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 3000;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-danger { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }

/* High-Def Stage & Video Player Engine */
.stage-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #06080e;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transform: translateZ(0);
  will-change: transform;
}

