/* style.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Roboto', sans-serif;
  overflow-x: hidden;
  padding-bottom: 70px;
  transition: background 0.3s, color 0.3s;
  background: #000000;
  color: #ffffff;
}
body.light-mode {
  background: #f5f5f5;
  color: #1a1a1a;
}

:root {
  --primary: #D100FF;
  --primary-dark: #A700CC;
  --card-bg: #12141e;
  --border-subtle: #252a3a;
  --text-muted: #a7b0ca;
}
body.light-mode {
  --card-bg: #ffffff;
  --border-subtle: black;
  --text-muted: black;
}

/* ===== HEADER ===== */
.header-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 500;
  background: rgba(8, 10, 18, 0.97);
  backdrop-filter: blur(14px);
  padding: 0.8rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
body.light-mode .header-bar { background: rgba(255,255,255,0.97); }

.hamburger {
  background: #1e2130;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 46px;
  height: 46px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
body.light-mode .hamburger { background: #ddd; color: #222; }
.hamburger:hover { background: var(--primary); box-shadow: 0 0 12px rgba(209,0,255,0.5); color: white; }

.logo-area h1 {
  font-size: 1.6rem;
  background: #D100FF;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

/* ===== SEARCH ===== */
.search-row {
  max-width: 1400px;
  margin: 80px auto 0.5rem;
  padding: 0.5rem 2rem 0;
}
.search-bar-inner {
  display: flex;
  align-items: center;
  background: #1a1d2b;
  border-radius: 60px;
  padding: 0.3rem 0.3rem 0.3rem 1.2rem;
  border: 1px solid white;
  transition: border 0.2s;
  max-width: 800px;
  margin: 0 auto;
}
body.light-mode .search-bar-inner { background: #eaeaea; border-color: #bbb; }
.search-bar-inner:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(209,0,255,0.3); }

.search-icon { color: #ffffff; font-size: 0.9rem; }
body.light-mode .search-icon { color: #1a1a1a; }

.search-bar-inner input {
  background: transparent;
  border: none;
  padding: 10px 10px;
  width: 100%;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
}
body.light-mode .search-bar-inner input { color: #1a1a1a; }
.search-bar-inner input::placeholder { color: #a0a0b0; }
body.light-mode .search-bar-inner input::placeholder { color: #777; }

.search-bar-inner button {
  background: var(--primary);
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}
.search-bar-inner button:hover { background: var(--primary-dark); transform: scale(0.96); }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  height: 100%;
  background: rgba(8,10,18,0.98);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-subtle);
  z-index: 1000;
  transition: left 0.3s, background 0.3s;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-shadow: 4px 0 25px rgba(0,0,0,0.6);
}
body.light-mode .sidebar { background: rgba(255,255,255,0.98); }
.sidebar.open { left: 0; }

.sidebar .logo-side {
  font-size: 1.7rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff, var(--primary));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  border-bottom: 1px solid #2d3246;
  padding-bottom: 1rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.sidebar nav a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  padding: 0.6rem 0;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 8px;
  padding-left: 8px;
}
body.light-mode .sidebar nav a { color: #1a1a1a; }
.sidebar nav a i { width: 28px; font-size: 1.1rem; color: var(--primary); }
.sidebar nav a:hover { color: var(--primary); background: rgba(209,0,255,0.1); transform: translateX(4px); }

.sidebar .close-sidebar {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  text-align: right;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 30px;
  transition: 0.2s;
}
body.light-mode .sidebar .close-sidebar { color: #1a1a1a; }
.sidebar .close-sidebar:hover { background: rgba(209,0,255,0.15); }

.theme-toggle-wrapper {
  margin-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s;
  width: fit-content;
}
body.light-mode .theme-toggle-btn { color: #1a1a1a; }
.theme-toggle-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

.overlay-blur {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  z-index: 999;
  display: none;
}
.overlay-blur.active { display: block; }

/* ===== CONTAINER ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 1rem 2rem 2rem; }

/* ===== HERO ===== */
.hero-welcome {
  background: radial-gradient(circle at 20% 30%, rgba(124,92,255,0.15), transparent 70%);
  border-radius: 2rem;
  padding: 1.5rem 2rem;
  margin: 1rem 0 1.5rem;
  border: 1px solid rgba(124,92,255,0.2);
  text-align: center;
}
body.light-mode .hero-welcome { background: radial-gradient(circle at 20% 30%, rgba(124,92,255,0.08), transparent 70%); border-color: #ccc; }
.hero-welcome h2 { font-size: 2rem; font-weight: 700; color: #ffffff; }
body.light-mode .hero-welcome h2 { color: #1a1a1a; }
.hero-welcome p { font-size: 1rem; color: #ffffff; max-width: 600px; margin: 0 auto; }
body.light-mode .hero-welcome p { color: #555; }

/* ===== LEVEL TABS ===== */
.level-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0 2.5rem;
}
.level-tab {
  background: transparent;
  color: #ffffff;
  padding: 1rem 2.5rem;
  border-radius: 60px;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid #ffffff;
  transition: all 0.25s;
  flex: 1 1 auto;
  min-width: 160px;
  text-align: center;
}
.level-tab i { margin-right: 8px; }
body.light-mode .level-tab { color: #1a1a1a; border-color: #1a1a1a; }
.level-tab:hover { background: #ffffff; color: #1a1a1a; transform: translateY(-4px); box-shadow: 0 8px 20px rgba(255,255,255,0.15); }
body.light-mode .level-tab:hover { background: #1a1a1a; color: #ffffff; box-shadow: 0 8px 20px rgba(0,0,0,0.15); }

/* ===== SECTION TITLES ===== */
.section-title-white {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
  color: #ffffff;
}
body.light-mode .section-title-white { color: #1a1a1a; }

/* ===== TRENDING (no border on items) ===== */
.trending-section { margin: 2rem 0 2.5rem; }
.trending-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background: var(--card-bg);
  padding: 1rem 0;
}
.trending-scroll {
  display: flex;
  gap: 1.2rem;
  padding: 0.5rem 1.5rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
.trending-scroll::-webkit-scrollbar { height: 4px; }
.trending-scroll::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
.trending-scroll:active { cursor: grabbing; }

.trending-item {
  flex: 0 0 180px;
  background: #1a1d2b;
  border-radius: 1rem;
  overflow: hidden;
  transition: 0.2s;
  cursor: pointer;
  min-width: 160px;
  position: relative;
  border: none; /* removed */
}
body.light-mode .trending-item { background: #f0f0f0; }
.trending-item:hover { transform: scale(1.04); box-shadow: 0 8px 20px rgba(209,0,255,0.2); }

.trending-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #0b0d14;
}
.trending-item .trending-title {
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.light-mode .trending-item .trending-title { color: #1a1a1a; }
.trending-item .trending-badge {
  display: inline-block;
  background: var(--primary);
  font-size: 0.55rem;
  padding: 2px 10px;
  border-radius: 30px;
  margin: 0 10px 8px 10px;
  color: white;
  font-weight: 600;
}
.trending-item .download-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  transition: 0.2s;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.trending-item .download-icon:hover { background: var(--primary); transform: scale(1.1); }

/* ===== DISCOVER (no borders) ===== */
.discover-section { margin: 2rem 0; }
.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.discover-card {
  background: var(--card-bg);
  border-radius: 1.5rem;
  overflow: hidden;
  transition: 0.3s;
  border: none; /* removed */
}
.discover-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px rgba(209,0,255,0.15); }
.discover-img { width: 100%; height: 180px; object-fit: cover; }
.discover-content { padding: 1.2rem; }
.discover-content h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: #ffffff; }
body.light-mode .discover-content h3 { color: #1a1a1a; }
.discover-content p { color: #ffffff; font-size: 0.9rem; margin-bottom: 0.8rem; }
body.light-mode .discover-content p { color: #555; }

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 10px;
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ===== FOOTER ===== */
footer {
  margin-top: 2.5rem;
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  color: #6f7893;
  font-size: 0.85rem;
}
footer a { color: var(--primary); text-decoration: none; }

/* ===== BOTTOM BAR ===== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 65px;
  background: rgba(8,10,18,0.97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 600;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}
body.light-mode .bottom-bar { background: rgba(255,255,255,0.97); }
.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 24px;
  border-radius: 30px;
  cursor: pointer;
  transition: 0.2s;
  color: #6f7893;
  font-size: 0.7rem;
  font-weight: 500;
  border: none;
  background: transparent;
  min-width: 80px;
}
.bottom-tab i { font-size: 1.4rem; transition: 0.2s; }
.bottom-tab.active { color: var(--primary); }
.bottom-tab.active i { transform: translateY(-2px); text-shadow: 0 0 20px rgba(209,0,255,0.3); }
.bottom-tab:hover { color: #b0b8d0; }

/* ===== FULL-PAGE DOWNLOAD OVERLAY ===== */
.download-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.download-overlay.open { display: flex; }

.download-overlay-content {
  background: var(--card-bg);
  border-radius: 2rem;
  padding: 2rem;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.close-overlay {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 28px;
  cursor: pointer;
  position: absolute;
  top: 12px;
  right: 16px;
  transition: 0.2s;
}
body.light-mode .close-overlay { color: #1a1a1a; }
.close-overlay:hover { transform: rotate(90deg); }

.download-overlay-content h2 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: #ffffff;
}
body.light-mode .download-overlay-content h2 { color: #1a1a1a; }

.download-tabs {
  display: flex;
  gap: 0.8rem;
  margin: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}
.download-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  font-weight: 500;
  border-radius: 30px;
  transition: 0.2s;
}
.download-tab.active { background: var(--primary); color: white; }
.download-tab:hover:not(.active) { background: rgba(209,0,255,0.1); }

.download-panels { margin-top: 0.5rem; }
.download-panel { display: none; }
.download-panel.active { display: block; }

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
}
.download-item .info { flex: 1; }
.download-item .info .title { font-weight: 500; color: #ffffff; }
body.light-mode .download-item .info .title { color: #1a1a1a; }
.download-item .info .meta { font-size: 0.75rem; color: var(--text-muted); }
.download-item .actions button {
  background: var(--primary);
  border: none;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.7rem;
  transition: 0.2s;
  margin-left: 4px;
}
.download-item .actions button:hover { background: var(--primary-dark); }
.download-item .progress-bar {
  width: 100%;
  height: 4px;
  background: #2d3246;
  border-radius: 4px;
  margin-top: 4px;
}
.download-item .progress-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}
#downloadedList, #downloadingList { min-height: 80px; color: #ffffff; }
body.light-mode #downloadedList, body.light-mode #downloadingList { color: #1a1a1a; }

/* ===== RESPONSIVE ===== */
@media (max-width: 750px) {
  .header-bar { padding: 0.6rem 1rem; }
  .search-row { padding: 0.5rem 1rem 0; margin-top: 70px; }
  .container { padding: 1rem; }
  .hero-welcome { padding: 1rem; }
  .level-tab { font-size: 1rem; padding: 0.7rem 1.2rem; min-width: 120px; }
  .trending-item { flex: 0 0 140px; min-width: 120px; }
  .trending-item img { height: 80px; }
  .download-overlay { padding: 1rem; }
  .download-overlay-content { padding: 1.2rem; }
  .discover-grid { grid-template-columns: 1fr; }
}
/* style.css (add spinner styles) */
/* ... existing styles ... */

/* ===== LOADING SPINNER ===== */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
#loadingOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== OFFLINE NOTICE ===== */
#offlineNotice {
  display: none;
  background: #cc0000;
  color: white;
  text-align: center;
  padding: 0.6rem;
  font-weight: 500;
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  z-index: 400;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
#offlineNotice.show {
  display: block;
}

/* offline mode: hide dynamic sections */
body.offline-mode #trending,
body.offline-mode #discover {
  display: none !important;
}
body.offline-mode .trending-section,
body.offline-mode .discover-section {
  display: none !important;
}

/* ===== existing styles continue... ===== */
