/* ============================================================
   StreamHub — Dark Industrial Aesthetic
   Fuentes: Syne (display) + DM Sans (body)
   ============================================================ */

:root {
  --bg:          #0a0a0a;
  --bg-card:     #111111;
  --bg-hover:    #1a1a1a;
  --bg-sidebar:  #0d0d0d;
  --border:      #222222;
  --border-hover:#333333;

  --text:        #e8e8e8;
  --text-muted:  #666666;
  --text-dim:    #444444;

  --accent:      #ff3c00;
  --accent-dim:  rgba(255, 60, 0, 0.15);
  --accent-glow: rgba(255, 60, 0, 0.3);

  --yt:    #ff0000;
  --od:    #ef5d28;
  --pt:    #f2690d;

  --sidebar-w: 240px;
  --radius:    6px;
  --transition: 0.18s ease;

  font-size: 15px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  line-height: 1.5;
  overflow: hidden;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 18px; height: 18px;
  flex-shrink: 0;
}

.hidden { display: none !important; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-item.active svg { stroke: var(--accent); }

.sidebar-section {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-section-title {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
  font-weight: 600;
}

.platform-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color var(--transition);
  user-select: none;
}

.platform-filter:hover { color: var(--text); }

.platform-filter input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px;
  border: 1px solid var(--border-hover);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
  flex-shrink: 0;
}

.platform-filter input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.platform-filter input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.platform-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-user {
  margin-top: auto;
  padding: 16px 16px 20px;
  border-top: 1px solid var(--border);
}

.btn-auth {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 6px;
  transition: all var(--transition);
}

.btn-auth:hover { opacity: 0.85; }

.btn-auth.secondary {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-hover);
}

.btn-auth.secondary:hover { color: var(--text); border-color: var(--text-muted); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  margin-bottom: 6px;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all var(--transition);
}

.btn-logout:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

.search-wrapper { flex: 1; max-width: 640px; margin: 0 auto; }

.search-form {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 6px 0 16px;
  transition: border-color var(--transition);
}

.search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  width: 16px; height: 16px;
  stroke: var(--text-muted);
  flex-shrink: 0;
}

.search-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
}

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

.search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 7px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}

.search-btn:hover { opacity: 0.85; }

/* ============================================================
   VIEWS
   ============================================================ */
.view {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.view-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.view-header h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.platform-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.platform-stat {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

/* ============================================================
   VIDEO GRID
   ============================================================ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.channel-section {
  margin-bottom: 40px;
}

.channel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.channel-header h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.channel-platform-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============================================================
   VIDEO CARD
   ============================================================ */
.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease both;
}

.video-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #111;
}

.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.video-card:hover .card-thumb img {
  transform: scale(1.04);
}

.card-duration {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}

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

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

.play-icon {
  width: 48px; height: 48px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.play-icon::after {
  content: '';
  border-left: 16px solid #fff;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 4px;
}

.card-platform {
  position: absolute;
  top: 6px; left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  color: #fff;
}

.platform-odysee   { background: var(--od); }
.platform-youtube  { background: var(--yt); }
.platform-peertube { background: var(--pt); }

.card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
}

.card-channel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.card-date { flex-shrink: 0; }

/* ============================================================
   STATES
   ============================================================ */
.loading-state, .empty-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 20px;
  color: var(--text-muted);
  text-align: center;
}

.loading-state svg, .empty-state svg { width: 40px; height: 40px; stroke: var(--text-dim); }
.loading-state p, .empty-state p { font-size: 0.9rem; }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   MODAL PLAYER
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.15s ease;
}

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 960px;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.modal-platform {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  color: #fff;
  flex-shrink: 0;
}

.modal-channel {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-fav-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px; height: 34px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-fav-btn:hover, .modal-fav-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-fav-btn.active svg { fill: var(--accent); }

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px; height: 34px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { border-color: var(--accent); color: var(--accent); }

.modal-player {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
}

.modal-player iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: none;
}

.modal-title {
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  border-top: 1px solid var(--border);
}

/* ============================================================
   MODAL AUTH
   ============================================================ */
.auth-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  position: relative;
  animation: slideUp 0.2s ease;
}

.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.auth-form input:focus { border-color: var(--accent); }
.auth-form input::placeholder { color: var(--text-dim); }

.btn-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
  margin-top: 4px;
}

.btn-submit:hover { opacity: 0.85; }

.auth-error {
  background: rgba(255,60,0,0.1);
  border: 1px solid rgba(255,60,0,0.3);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.82rem;
  padding: 10px 12px;
  margin-bottom: 12px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }

  .main-content { margin-left: 0; }

  .hamburger { display: flex; }

  .view { padding: 20px 16px 32px; }

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

  .modal-container { border-radius: 0; max-width: 100%; }
  .modal-overlay { padding: 0; align-items: flex-end; }
}

@media (max-width: 480px) {
  .video-grid { grid-template-columns: 1fr; }
  .search-form input { font-size: 16px; } /* evita zoom en iOS */
}
