/* ==============================================================================
   StreamLoop UI Design System - Exact Montage Specification
   Mobile-First Native App Experience & Responsive Desktop Layout
   Primary Gradients: Electric Blue (#2563EB) & Neon Purple (#7C3AED)
   Landing: Deep Midnight Navy (#080B16)
   App: Clean Modern Pure White / Light Slate (#F8FAFC)
   ============================================================================== */

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

:root {
  /* Gradients */
  --grad-primary: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --grad-primary-hover: linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%);
  --grad-purple-pink: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  --grad-cyan-blue: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --grad-badge-live: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --grad-btn-cta: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);

  /* Color Palette */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-500: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;

  --purple-50: #f5f3ff;
  --purple-100: #ede9fe;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;

  --dark-bg: #080b16;
  --dark-surface: #101528;
  --dark-card: #161c34;
  --dark-border: rgba(255, 255, 255, 0.08);
  --dark-text-muted: #94a3b8;

  --light-bg: #f8fafc;
  --light-surface: #ffffff;
  --light-border: #e2e8f0;
  --light-border-subtle: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.04), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 12px 28px -4px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 10px 25px -4px rgba(37, 99, 235, 0.35);
  --shadow-glow-purple: 0 10px 25px -4px rgba(124, 58, 237, 0.35);

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  font-family: var(--font-sans);
  background-color: var(--light-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ==============================================================================
   Layouts & Shells (Desktop vs Native Mobile Responsive)
   ============================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--light-bg);
}

/* Desktop Sidebar */
.app-sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid var(--light-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-header {
  padding: 22px 20px;
  border-bottom: 1px solid var(--light-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-menu {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

.sidebar-item {
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background-color: var(--primary-50);
  color: var(--primary-600);
}

.sidebar-link.active {
  background: var(--grad-btn-cta);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.sidebar-link .icon {
  font-size: 1.15rem;
  width: 22px;
  display: inline-flex;
  justify-content: center;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 84px; /* Space for mobile bottom bar */
}

@media (min-width: 992px) {
  .app-main {
    padding-bottom: 32px;
  }
}

/* Responsive Top Bar */
.app-topbar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--light-border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-content {
  padding: 20px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

/* On Mobile Screens: Native Mobile App Appearance */
@media (max-width: 991px) {
  .app-sidebar {
    display: none;
  }
  .app-content {
    padding: 16px 16px 30px;
    max-width: 480px; /* StreamLoop mobile screen container width */
  }
  .desktop-only {
    display: none !important;
  }
}

@media (min-width: 992px) {
  .mobile-only {
    display: none !important;
  }
}

/* ==============================================================================
   Mobile Top Bar (StreamLoop Exact Header)
   - Left: Logo or Back Button
   - Right: Notification Bell + User Avatar or "+ Action"
   ============================================================================== */

.mobile-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-top: 4px;
}

.mobile-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-icon-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--light-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-back:hover {
  background: var(--primary-50);
  color: var(--primary-600);
}

.user-avatar-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ==============================================================================
   StreamLoop Mobile Bottom Navigation (4 native tabs)
   ============================================================================== */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #ffffff;
  border-top: 1px solid var(--light-border);
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
}

@media (max-width: 991px) {
  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 12px;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  flex: 1;
  height: 100%;
  transition: all 0.2s;
}

.bottom-nav-item.active {
  color: var(--primary-600);
}

.bottom-nav-item .nav-icon {
  font-size: 1.25rem;
}

/* ==============================================================================
   StreamLoop Cards, Badges & UI Elements
   ============================================================================== */

/* White Clean Cards */
.card {
  background: #ffffff;
  border: 1px solid var(--light-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* StreamLoop 2x2 Metric Cards (Mobile Grid) */
.stat-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .stat-grid-2x2 {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

.mobile-stat-card {
  background: #ffffff;
  border: 1px solid var(--light-border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  min-height: 105px;
}

.mobile-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.mobile-stat-icon.green { background: #ecfdf5; color: #10b981; }
.mobile-stat-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.mobile-stat-icon.amber { background: #fffbeb; color: #f59e0b; }
.mobile-stat-icon.blue { background: #eff6ff; color: #3b82f6; }

.mobile-stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 2px;
}

.mobile-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* StreamLoop Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-btn-cta);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
  opacity: 0.95;
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-secondary);
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  border-color: var(--primary-500);
  color: var(--primary-600);
}

.btn-outline:hover {
  background: var(--primary-50);
}

.btn-danger {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fca5a5;
  color: #991b1b;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-full);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-full);
}

/* StreamLoop Live Badge */
.badge-live-streamloop {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

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

.badge-stopped-streamloop {
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-stopped-streamloop::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #94a3b8;
}

/* StreamLoop Stream Card (Recent Streams) */
.stream-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--light-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.stream-item-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #cbd5e1;
}

.stream-item-thumb {
  width: 72px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: #0f172a;
}

.stream-item-info {
  flex: 1;
  min-width: 0;
}

.stream-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* StreamLoop Select Video Source Cards (Create Stream) */
.source-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.source-choice-card {
  border: 1.5px solid var(--light-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.2s;
}

.source-choice-card.selected {
  border-color: var(--primary-500);
  background: #f0f7ff;
}

.source-choice-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--light-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-600);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.source-choice-card.selected .source-choice-icon {
  background: var(--primary-500);
  color: #ffffff;
  border-color: var(--primary-500);
}

/* Filter pills (All, YouTube, Uploads) */
.filter-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-pill {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid var(--light-border);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* StreamLoop Profile Menu List */
.profile-menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--light-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s;
}

.profile-menu-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.profile-menu-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-menu-left i {
  font-size: 1.1rem;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--light-border);
  background-color: #ffffff;
  color: var(--text-primary);
  font-size: 0.92rem;
  transition: all 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Brand Logo */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
}

.brand-badge {
  background: var(--grad-btn-cta);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.brand-text {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.landing-shell .brand-text {
  color: #ffffff;
}

/* Switch / Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #2563eb;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

/* Progress bar */
.progress-container {
  background: #e2e8f0;
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  background: var(--grad-btn-cta);
  height: 100%;
  border-radius: var(--radius-full);
}

/* Modern Responsive Pagination */
.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.pagination-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.pagination-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.pagination-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  background: #f8fafc;
}
