:root {
  --primary-yellow: #FFC107;
  --primary-blue: #2196F3;
  --primary-red: #CE1126;
  --primary-white: #FFFFFF;
  --background-dark: #121212;
  --background-darker: #0A0A0A;
  --shadow-dark: rgba(0, 0, 0, 0.5);
  --shadow-light: rgba(255, 255, 255, 0.08);
  --gradient-primary: linear-gradient(45deg, #FFC107, #CE1126, #2196F3);
  --create-button-glow: rgba(255, 193, 7, 0.3);
  --divider-3d: linear-gradient(to bottom, #2A2A2A 0%, #4A4A4A 50%, #2A2A2A 100%);
  --create-button-bg: linear-gradient(135deg, #FF5733 0%, #C70039 100%);
  --form-3d: linear-gradient(to bottom, #1A1A1A 0%, #2A2A2A 50%, #1A1A1A 100%);
}

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

body {
  background-color: var(--background-dark);
  color: var(--primary-white);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  transform: none !important;
}

/* Navigation Bar (Top) - Sticky for Desktop */
.nav-bar {
  position: sticky;
  top: 0;
  width: 100%;
  background: rgba(18, 18, 18, 0.5);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  padding: 12px 24px;
  z-index: 1001;
  box-shadow: 0 4px 12px var(--shadow-dark);
  border-bottom: 2px solid var(--shadow-light);
  height: 60px;
}

.nav-container {
  display: flex;
  gap: 16px;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.nav-container::-webkit-scrollbar {
  display: none;
}

.nav-link {
  color: var(--primary-white);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.3s ease, transform 0.2s ease, background 0.3s ease;
}

.nav-link:hover {
  color: var(--primary-yellow);
  transform: scale(1.05);
  background: rgba(18, 18, 18, 0.5);
  backdrop-filter: blur(6px);
}

.nav-link.active {
  color: var(--primary-yellow);
  font-weight: 700;
  background: rgba(255, 193, 7, 0.4);
  padding: 8px 12px;
  border-radius: 8px;
  transform: scale(1);
}

.nav-link .nav-icon {
  font-size: 1.2rem;
}

.nav-link .nav-label {
  font-size: 0.9rem;
}

.nav-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-right .nav-link {
  padding: 6px 10px;
}

/* Search Bar - Desktop Scaling */
.search-bar {
  position: relative;
  left: 0;
  transform: none;
  background: rgba(18, 18, 18, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid var(--shadow-light);
  border-radius: 24px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  z-index: 900;
  box-shadow: 0 2px 8px var(--shadow-dark);
  width: 400px; /* Wider for desktop */
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  margin: 20px 0 0 24px;
}

.search-bar:hover {
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
  transform: scale(1.02);
}

.search-bar:focus-within {
  box-shadow: 0 4px 14px rgba(255, 193, 7, 0.5);
  transform: scale(1.02);
  z-index: 1300;
}

.search-icon {
  color: var(--primary-yellow);
  font-size: 16px;
  margin-right: 8px;
}

.search-input {
  background: transparent;
  border: none;
  color: var(--primary-white);
  font-size: 14px;
  width: 100%;
  outline: none;
  font-weight: 400;
  transition: all 0.3s ease;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-input:focus {
  border-bottom: 1px solid var(--primary-yellow);
}

/* Sidebar - Optimized for Desktop */
.sidebar {
  position: fixed;
  top: 60px;
  right: 0;
  width: 300px;
  height: calc(100vh - 60px);
  background: rgba(18, 18, 18, 0.7);
  backdrop-filter: blur(10px);
  padding: 16px;
  z-index: 1000;
  box-shadow: -2px 0 8px var(--shadow-dark);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-header {
  position: sticky;
  top: 0;
  background: rgba(18, 18, 18, 0.7);
  padding: 8px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-yellow);
  border-bottom: 1px solid var(--shadow-light);
  z-index: 1;
}

.sidebar-item {
  color: var(--primary-white);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  transition: color 0.3s ease, background 0.3s ease;
}

.sidebar-item:hover {
  color: var(--primary-yellow);
  background: rgba(255, 193, 7, 0.2);
}

.sidebar-item.active {
  color: var(--primary-yellow);
  background: rgba(255, 193, 7, 0.4);
  font-weight: 600;
}

.sidebar-item .nav-icon {
  font-size: 1.1rem;
}

.live-chat {
  flex-grow: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--primary-white);
  transition: background 0.2s ease;
}

.chat-message:hover {
  background: rgba(255, 193, 7, 0.1);
  border-radius: 6px;
}

.chat-message-username {
  font-weight: 600;
  color: var(--primary-yellow);
}

.chat-message-content {
  flex: 1;
  word-break: break-word;
}

/* Main Content - TikTok Desktop Grid */
.main-content {
  margin-left: 0;
  margin-right: 300px; /* Adjusted for sidebar */
  margin-top: 60px; /* Clear nav bar */
  padding: 0;
  min-height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* TikTok-style grid */
  grid-gap: 10px;
  align-items: start;
  background: var(--background-dark);
  overflow-y: auto;
}

.video-card {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 177.78%; /* 9:16 aspect ratio (100 / (9/16) = 177.78%) */
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow-dark);
  transition: transform 0.3s ease;
}

.video-card:hover {
  transform: scale(1.02);
}

.video-card .video-player {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  transform: scale(1) !important;
}

.video-card .video-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: var(--primary-white);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.video-card .video-username {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-yellow);
  text-decoration: none;
}

.video-card .video-description {
  font-size: 1rem;
  max-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-indicator {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary-red);
  color: var(--primary-white);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 10;
}

/* Bottom Navigation Bar (Hidden on PC) */
.bottom-nav-bar {
  display: none;
}

/* Enhanced Create Button - Desktop Top-Right */
.create-button {
  position: fixed;
  top: 80px;
  right: 24px;
  background: var(--create-button-bg);
  color: var(--primary-white);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px var(--create-button-glow), 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.create-button:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 18px var(--create-button-glow), 0 6px 20px rgba(0, 0, 0, 0.4);
}

.create-button::before {
  content: "🎥"; /* Live camera icon */
}

@media (max-width: 1023px) {
  .nav-bar,
  .sidebar,
  .main-content,
  .create-button {
    display: none;
  }

  .bottom-nav-bar {
    display: grid;
  }

  .main-content {
    margin: 0;
    grid-template-columns: 1fr; /* Single column on mobile */
  }

  .video-card {
    padding-bottom: 177.78%; /* Maintain 9:16 aspect ratio */
  }
}

/* Video Feed and Scroll Styles */
.video-feed {
  position: relative;
  overflow: hidden;
  width: 100%;
}