/* DIRxHUB - Minimalistic Black-Purple Theme */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0f;
  --bg2: #12121e;
  --bg3: #1a1a2e;
  --card: #16162a;
  --card-hover: #1f1f3a;
  --purple: #7c3aed;
  --purple-light: #a855f7;
  --purple-glow: #8b5cf6;
  --text: #e2e8f0;
  --text-dim: #8b8fa3;
  --text-muted: #5c5f73;
  --border: #2a2a45;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(124, 58, 237, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* Header */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}


.video-quality {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, var(--purple), #5b21b6);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--purple-light), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}

.logo-x {
  background: none;
  -webkit-text-fill-color: var(--purple-light);
}

/* Search */
.search-wrap {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 42px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border .2s, box-shadow .2s;
}

.search-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.search-input::placeholder { color: var(--text-muted); }

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.btn {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg3);
  color: var(--text);
}

/* Main content */
.main {
  margin-top: 64px;
  padding: 24px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* Categories */
.categories {
  margin-bottom: 32px;
}

.categories-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.categories-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .25s;
  user-select: none;
}

.category-chip:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--purple);
  color: var(--purple-light);
}

.category-chip.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* Video grid */
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title span { color: var(--purple-light); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .3s;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple);
  box-shadow: var(--shadow);
  background: var(--card-hover);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--bg3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb .gradient-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 800;
  color: rgba(255,255,255,0.1);
}

.video-thumb .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s;
  background: rgba(0,0,0,0.3);
}

.video-card:hover .play-overlay { opacity: 1; }

.play-btn-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: transform .2s;
}

.video-card:hover .play-btn-circle { transform: scale(1.1); }

.play-btn-circle svg {
  width: 24px;
  height: 24px;
  color: #fff;
  margin-left: 2px;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.video-info {
  padding: 12px 14px 14px;
}

.video-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.video-meta span { display: flex; align-items: center; gap: 4px; }

/* Player Overlay */
.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: none;
  flex-direction: column;
}

.player-overlay.active { display: flex; }

.player-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.player-close:hover { background: rgba(255,255,255,0.2); }

.player-video-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.player-placeholder {
  text-align: center;
  color: var(--text-dim);
}

.player-placeholder svg {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.player-placeholder h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text);
}

.player-placeholder p { font-size: 14px; }

.player-info {
  padding: 16px 24px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}

.player-info h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.player-info .meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg { width: 64px; height: 64px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--text-dim); margin-bottom: 6px; }

/* Load more */
.load-more-wrap {
  text-align: center;
  padding: 32px 0;
}

.load-more {
  padding: 10px 40px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.load-more:hover {
  border-color: var(--purple);
  color: var(--purple-light);
  background: rgba(124, 58, 237, 0.1);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 0 12px; gap: 12px; }
  .main { padding: 16px; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .player-info { padding: 12px 16px; }
  .player-info h2 { font-size: 15px; }
  .header-actions .btn { display: none; }
}

@media (max-width: 480px) {
  .video-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .video-info { padding: 8px 10px 10px; }
  .video-title { font-size: 12px; }
}

/* Auth Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  max-width: 380px;
  width: 100%;
  position: relative;
  animation: fadeIn .25s ease;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--bg3);
  border-radius: 10px;
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.auth-tab.active {
  background: var(--purple);
  color: #fff;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border .2s;
}

.auth-input:focus {
  border-color: var(--purple);
}

.auth-error {
  color: #ef4444;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 0;
}

.auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 4px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

/* Stats Panel */
.stats-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  animation: fadeIn .3s ease;
}

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

.stats-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.stats-summary {
  font-size: 14px;
  color: var(--purple-light);
  font-weight: 600;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  transition: background .2s;
}

.stats-item:hover {
  background: var(--bg3);
}

.stats-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stats-rank.gold { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stats-rank.silver { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.stats-rank.bronze { background: linear-gradient(135deg, #cd7f32, #a0522d); }

.stats-item .title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-item .meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.stats-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.stats-empty svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
  margin-bottom: 8px;
}

/* Stats Modal wide card */
.modal-card-wide {
  max-width: 480px;
}
.modal-card-wide h2 {
  font-size: 18px;
  margin-bottom: 12px;
}
