:root {
  --bg-base: #090b10;
  --bg-surface: #11151f;
  --bg-surface-elevated: #181f2f;
  --bg-glass: rgba(17, 21, 31, 0.75);
  --bg-glass-card: rgba(24, 31, 47, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(229, 160, 13, 0.5);
  
  --plex-amber: #e5a00d;
  --plex-amber-hover: #f5af19;
  --plex-amber-glow: rgba(229, 160, 13, 0.25);

  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px var(--plex-amber-glow);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(229, 160, 13, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: #252e42;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #333e58;
}

/* Header & Navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--plex-amber), #f57c00);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--plex-amber-glow);
}

.brand-logo svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  background: rgba(229, 160, 13, 0.15);
  color: var(--plex-amber);
  border: 1px solid rgba(229, 160, 13, 0.3);
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--plex-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.75rem;
  color: #000;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--accent-red);
}

/* Tab Navigation */
.tab-bar-container {
  max-width: 1100px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}

.tab-bar {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.4rem;
  gap: 0.4rem;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  flex: 1;
  min-width: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--plex-amber);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(229, 160, 13, 0.25);
}

.tab-btn .badge-pill {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  background: var(--accent-green);
  color: #000;
  border-radius: var(--radius-full);
  font-weight: 700;
}

/* Main Container */
.main-content {
  max-width: 1100px;
  margin: 1.5rem auto 4rem;
  padding: 0 1rem;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

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

/* Hero / Section Headers */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Cards & Glass Containers */
.card {
  background: var(--bg-glass-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--plex-amber), #f57c00);
  color: #000;
  box-shadow: 0 4px 15px var(--plex-amber-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--plex-amber-hover), #ff8f00);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229, 160, 13, 0.4);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #fff;
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-amber);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-purple);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent-blue);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .navbar {
    padding: 0.65rem 0.85rem;
  }
  .brand-text h1 {
    font-size: 0.95rem;
  }
  .user-badge {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
  }
  .btn-logout {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
  }
  .tab-bar-container {
    padding: 0 0.5rem;
    position: relative;
  }
  .tab-bar {
    padding: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tab-btn {
    min-width: 105px;
    padding: 0.55rem 0.65rem;
    font-size: 0.78rem;
    gap: 0.35rem;
  }
  .card {
    padding: 1.15rem;
  }
  .chat-wrapper {
    height: calc(100vh - 210px);
    min-height: 520px;
  }
  .chat-bubble {
    max-width: 90%;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
  }
  .chat-bubble-image {
    max-width: 200px;
    max-height: 180px;
  }
  .chat-input-bar {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }
  .btn-attach-img {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
  .chat-input-bar input {
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
  }
  .chat-input-bar .btn-primary {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }
  .stream-grid {
    grid-template-columns: 1fr;
  }
  .media-item-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .media-thumb {
    width: 60px;
    height: 90px;
  }
}
