:root {
  --background: #101010;
  --surface: #1b1b1b;
  --surface-light: #262626;
  --primary: #ff3030;
  --text: #ffffff;
  --muted: #aaaaaa;
}

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

body {
  background: var(--background);
  color: var(--text);
  font-family: Arial, sans-serif;
  min-height: 100vh;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* LOGIN */

.login-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at top, #351515 0%, transparent 55%),
    #101010;
}

.login-card {
  width: 100%;
  max-width: 410px;
  padding: 35px 25px;
  text-align: center;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 17px;
}

.login-logo {
  font-size: 29px;
  font-weight: bold;
  letter-spacing: 1px;
}

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

.login-subtitle {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 4px;
  margin-top: 8px;
}

.login-card h1 {
  font-size: 27px;
  margin-top: 38px;
}

.login-description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0 25px;
}

.login-button {
  width: 100%;
  min-height: 49px;
  border-radius: 8px;
  font-weight: bold;
  margin-bottom: 13px;
  border: 1px solid #444;
}

.guest-button {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.google-button {
  background: white;
  color: #222;
}

.google-icon {
  font-weight: bold;
  color: #4285f4;
  font-size: 18px;
  margin-right: 9px;
}

.login-error {
  color: #ff7777;
  font-size: 12px;
  margin: 8px 0;
}

.login-note {
  color: #888;
  font-size: 11px;
  line-height: 1.6;
  margin-top: 20px;
}

/* NAVBAR */

.navbar {
  height: 65px;
  padding: 0 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #151515;
  border-bottom: 1px solid #292929;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 1px;
}

.brand-icon {
  background: var(--primary);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-name {
  color: var(--muted);
  font-size: 12px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-button {
  background: #292929;
  color: white;
  border: 1px solid #444;
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

/* HERO */

.hero {
  min-height: 280px;
  padding: 55px 7%;
  display: flex;
  align-items: center;
  background:
    linear-gradient(90deg, #101010 0%, rgba(16,16,16,.9) 55%, rgba(16,16,16,.3)),
    linear-gradient(135deg, #391313, #151515 65%);
}

.hero-content {
  max-width: 650px;
  width: 100%;
}

.hero-label {
  color: var(--primary);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 3px;
}

.hero h1 {
  font-size: clamp(32px, 6vw, 55px);
  margin: 15px 0 10px;
}

.hero p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 22px;
}

.search-box {
  display: flex;
  max-width: 500px;
  height: 48px;
  background: #252525;
  border: 1px solid #444;
  border-radius: 8px;
  overflow: hidden;
}

.search-box input {
  flex: 1;
  min-width: 0;
  background: transparent;
  color: white;
  border: none;
  outline: none;
  padding: 0 15px;
}

.search-box button {
  border: none;
  background: var(--primary);
  color: white;
  font-weight: bold;
  padding: 0 22px;
}

/* CATEGORIES AND VIDEOS */

.categories-section,
.videos-section,
.player-section {
  padding: 28px 6%;
}

.categories-section h2,
.section-heading h2 {
  font-size: 21px;
  margin-bottom: 17px;
}

.categories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category {
  flex-shrink: 0;
  padding: 10px 19px;
  background: var(--surface);
  color: #ddd;
  border: 1px solid #333;
  border-radius: 25px;
  font-size: 13px;
}

.category.active,
.category:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.section-heading h2 {
  margin-bottom: 0;
}

#result-count {
  color: var(--muted);
  font-size: 12px;
}

.video-grid,
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.video-card,
.playlist-card {
  min-width: 0;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #292929;
  cursor: pointer;
  transition: transform .2s;
}

.video-card:hover,
.playlist-card:hover {
  transform: translateY(-4px);
}

.thumbnail,
.playlist-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #292929;
}

.video-info {
  padding: 12px;
}

.video-info h3 {
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.video-info p {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message {
  text-align: center;
  padding: 35px 10px;
  color: var(--muted);
}

.error {
  color: #ff7777;
  line-height: 1.6;
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid #444;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.load-more,
.primary-button {
  display: block;
  margin: 25px auto 0;
  padding: 12px 22px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 7px;
  font-weight: bold;
}

.load-more:disabled {
  opacity: .5;
}

/* PLAYER */

.player-section {
  padding-top: 10px;
}

.close-btn {
  border: 1px solid #444;
  color: white;
  background: var(--surface);
  border-radius: 6px;
  padding: 8px 12px;
}

.video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 18px;
  background: black;
  border-radius: 10px;
  overflow: hidden;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* PAGE HEADER */

.page-header {
  padding: 35px 6% 10px;
}

.page-header h1 {
  font-size: 27px;
  margin-bottom: 8px;
}

.page-header p {
  color: var(--muted);
  font-size: 13px;
}

/* PLAYLIST */

.playlist-grid {
  padding: 0 6%;
}

.playlist-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.playlist-info {
  padding: 12px;
}

.playlist-info h3 {
  font-size: 14px;
  margin-bottom: 7px;
  line-height: 1.5;
}

.playlist-info p {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  text-align: center;
  padding: 55px 20px;
}

.empty-icon {
  font-size: 45px;
  margin-bottom: 15px;
}

.empty-state h2 {
  margin-bottom: 10px;
}

.empty-state p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.secondary-button {
  display: block;
  margin: 25px auto;
  padding: 11px 18px;
  background: var(--surface-light);
  border: 1px solid #444;
  color: white;
  border-radius: 7px;
}

#playlist-detail {
  padding: 25px 6%;
}

#playlist-detail h2 {
  margin-top: 25px;
}

#playlist-detail-description {
  color: var(--muted);
  margin-top: 8px;
  font-size: 13px;
}

/* ACCOUNT */

.account-card {
  max-width: 420px;
  margin: 25px auto;
  padding: 30px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 13px;
}

.profile-avatar {
  width: 75px;
  height: 75px;
  border-radius: 50%;
  background: #333;
  display: grid;
  place-items: center;
  font-size: 32px;
  margin: 0 auto 15px;
}

.account-card h2 {
  font-size: 20px;
  margin-bottom: 7px;
}

.account-card p {
  color: var(--muted);
  font-size: 13px;
}

.status-label {
  display: inline-block;
  margin-top: 13px;
  padding: 5px 13px;
  background: #303030;
  color: #ddd;
  border-radius: 20px;
  font-size: 11px;
}

.logout-button {
  display: block;
  width: 100%;
  margin-top: 15px;
  padding: 12px;
  color: white;
  background: #3a2020;
  border: 1px solid #713333;
  border-radius: 7px;
}

/* NAVIGATION */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 65px;
  background: #191919;
  border-top: 1px solid #333;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
}

.nav-item {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  color: #888;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.nav-item span {
  font-size: 21px;
}

.nav-item small {
  font-size: 10px;
}

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

footer {
  margin-top: 40px;
  margin-bottom: 65px;
  padding: 35px 15px;
  text-align: center;
  background: #171717;
  border-top: 1px solid #292929;
  color: var(--muted);
  font-size: 13px;
  line-height: 2;
}

.footer-brand {
  color: white;
  font-weight: bold;
  font-size: 20px;
}

.copyright {
  font-size: 11px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .video-grid,
  .playlist-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 0 18px;
  }

  .hero {
    padding: 42px 20px;
    min-height: 260px;
  }

  .categories-section,
  .videos-section,
  .player-section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .video-grid,
  .playlist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .video-info {
    padding: 9px;
  }

  .video-info h3 {
    font-size: 12px;
  }

  .video-info p {
    font-size: 10px;
  }

  .category {
    padding: 9px 15px;
  }

  .page-header {
    padding-left: 18px;
    padding-right: 18px;
  }

  #playlist-detail {
    padding: 20px 16px;
  }

  .account-card {
    margin: 20px 16px;
  }
}

@media (max-width: 350px) {
  .video-grid,
  .playlist-grid {
    grid-template-columns: 1fr;
  }
}
