:root {
  --site-header-height: 64px;
  --site-content-width: 1280px;
  --site-border-light: rgba(148, 163, 184, 0.24);
  --site-border-dark: rgba(71, 85, 105, 0.55);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-block: 0;
  border-bottom: 1px solid var(--site-border-light);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background-color 180ms ease, border-color 180ms ease;
}

body .site-header {
  padding-block: 0;
}

html.dark .site-header {
  border-color: var(--site-border-dark);
  background: rgba(15, 23, 42, 0.92);
}

.site-header-inner {
  width: min(100%, var(--site-content-width));
  min-height: var(--site-header-height);
  margin-inline: auto;
  padding: 0.5rem clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header .site-header-inner {
  min-height: var(--site-header-height);
  padding-block: 0.5rem;
}

/* Soporte fluido para vistas extendidas (como el reproductor en index.html) */
.site-header.site-header--fluid .site-header-inner,
.site-header--fluid .site-header-inner,
.site-header-inner.site-header-inner--fluid {
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
  padding-inline: 0.75rem !important;
}

@media (min-width: 640px) {
  .site-header.site-header--fluid .site-header-inner,
  .site-header--fluid .site-header-inner,
  .site-header-inner.site-header-inner--fluid {
    padding-inline: 1.5rem !important;
  }
}

@media (min-width: 1024px) {
  .site-header.site-header--fluid .site-header-inner,
  .site-header--fluid .site-header-inner,
  .site-header-inner.site-header-inner--fluid {
    padding-inline: 2rem !important;
  }
}

@media (min-width: 1280px) {
  .site-header.site-header--fluid .site-header-inner,
  .site-header--fluid .site-header-inner,
  .site-header-inner.site-header-inner--fluid {
    padding-inline: 2.5rem !important;
  }
}

.site-footer.site-footer--fluid .site-footer-inner,
.site-footer--fluid .site-footer-inner,
.site-footer-inner.site-footer-inner--fluid {
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
  padding-inline: 0.75rem !important;
}

@media (min-width: 640px) {
  .site-footer.site-footer--fluid .site-footer-inner,
  .site-footer--fluid .site-footer-inner,
  .site-footer-inner.site-footer-inner--fluid {
    padding-inline: 1.5rem !important;
  }
}

@media (min-width: 1024px) {
  .site-footer.site-footer--fluid .site-footer-inner,
  .site-footer--fluid .site-footer-inner,
  .site-footer-inner.site-footer-inner--fluid {
    padding-inline: 2rem !important;
  }
}

@media (min-width: 1280px) {
  .site-footer.site-footer--fluid .site-footer-inner,
  .site-footer--fluid .site-footer-inner,
  .site-footer-inner.site-footer-inner--fluid {
    padding-inline: 2.5rem !important;
  }
}


.site-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  flex: none;
  text-decoration: none;
}

.site-brand-logo {
  width: 40px;
  height: 40px;
  display: block;
  flex: none;
  object-fit: contain;
}

.site-brand-name {
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

html.dark .site-brand-name {
  color: #f8fafc;
}

.site-brand-accent {
  color: #059669;
}

html.dark .site-brand-accent {
  color: #34d399;
}

@media (min-width: 701px) {
  .site-header .site-header-inner {
    height: var(--site-header-height);
    min-height: var(--site-header-height);
    padding-block: 0.25rem;
  }
}

.site-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(0.125rem, 1vw, 0.625rem);
}

.site-nav-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.625rem;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.site-nav-link:hover,
.site-nav-link.active {
  color: #047857;
  background: #ecfdf5;
}

html.dark .site-nav-link {
  color: #cbd5e1;
}

html.dark .site-nav-link:hover,
html.dark .site-nav-link.active {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12);
}

.site-footer {
  border-top: 1px solid var(--site-border-light);
  background: rgba(248, 250, 252, 0.94);
  color: #475569;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

body .site-footer {
  padding-block: 0;
}

html.dark .site-footer {
  border-color: var(--site-border-dark);
  background: rgba(15, 23, 42, 0.94);
  color: #94a3b8;
}

.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #020617;
  overflow: hidden;
}

.player-frame > video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #020617;
  object-fit: cover;
  transition: object-fit 180ms ease;
}

.player-frame > video.fit-contain {
  object-fit: contain !important;
}

.player-frame > video.fit-cover {
  object-fit: cover !important;
}

/* YouTube-style channel details bar below video player */
#channel-details-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: 1rem;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: background-color 180ms ease, border-color 180ms ease;
  flex-shrink: 0;
}

html.dark #channel-details-bar {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(30, 41, 59, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#player-logo-box {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid rgba(51, 65, 85, 0.6);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

@media (min-width: 640px) {
  #player-logo-box {
    width: 52px;
    height: 52px;
    min-width: 52px;
  }
}

#player-channel-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

#btnguardar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.player-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid rgba(203, 213, 225, 0.8);
  background: rgba(241, 245, 249, 0.9);
  color: #1e293b;
  transition: all 160ms ease;
  user-select: none;
}

.player-action-btn:hover {
  background: rgba(226, 232, 240, 0.95);
  transform: translateY(-1px);
}

.player-action-btn:active {
  transform: scale(0.96);
}

html.dark .player-action-btn {
  border-color: rgba(51, 65, 85, 0.8);
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
}

html.dark .player-action-btn:hover {
  background: rgba(51, 65, 85, 0.95);
}

.player-action-btn svg#huotline,
.player-action-btn svg#hsolid {
  width: 20px;
  height: 20px;
  min-width: 20px;
  cursor: pointer;
  margin: 0;
  padding: 0;
  background: transparent;
}

.site-footer-inner {
  width: min(100%, var(--site-content-width));
  margin-inline: auto;
  padding: 2.5rem clamp(1rem, 3vw, 2rem);
}

.site-footer .site-footer-inner {
  padding: 2.5rem clamp(1rem, 3vw, 2rem);
}

.site-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
}

.site-footer .site-footer-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.site-footer-heading {
  margin-bottom: 0.75rem;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 700;
}

html.dark .site-footer-heading {
  color: #f1f5f9;
}

.site-footer-link {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease;
}

.site-footer-link:hover {
  color: #059669;
}

html.dark .site-footer-link:hover {
  color: #34d399;
}

@media (min-width: 701px) and (max-width: 900px) {
  .site-header .header-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-content: initial;
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .site-header .header-content > .site-nav {
    min-width: 0;
    width: 100%;
    grid-column: 2;
    flex: none;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.2rem;
  }

  .site-header .site-nav-link {
    flex: none;
    padding-inline: 0.4rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .site-header .site-nav--player {
    flex: 0 0 auto;
  }

  .site-header #theme-toggle {
    flex: none;
  }

  .site-header .site-brand-name {
    font-size: 1.05rem;
  }
}

@media (max-width: 700px) {
  .site-header-inner {
    gap: 0.5rem;
    padding-inline: 0.75rem;
  }

  .site-brand-logo {
    width: 36px;
    height: 36px;
  }

  .site-brand-name {
    font-size: 1.05rem;
  }

  .site-nav {
    gap: 0.125rem;
  }

  .site-nav-link {
    min-height: 40px;
    padding-inline: 0.45rem;
    font-size: 0.78rem;
  }

  .site-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1rem;
  }

  .site-footer .site-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1rem;
  }

  .player-channel-title {
    max-width: none;
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .site-header-inner {
    flex-wrap: wrap;
    padding-block: 0.5rem;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-footer-grid {
    grid-template-columns: 1fr;
  }

  .site-footer .site-footer-grid {
    grid-template-columns: 1fr;
  }

  .player-action-btn {
    padding: 0.5rem;
  }
}

@media (min-width: 1280px) {
  .player-frame {
    flex: 1 1 0%;
    min-height: 0;
    height: auto;
    aspect-ratio: auto;
    width: 100%;
  }
}

/* Ocultar barra de scroll en contenedores horizontales */
.no-scrollbar::-webkit-scrollbar,
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.no-scrollbar,
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@media (max-width: 1023px) {
  .player-frame.sticky {
    top: var(--site-header-height, 64px);
  }
}

/* Scrollbars personalizados y comportamiento fluido de canales y categorías */
#channels-scroll-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

html.dark #channels-scroll-container {
  scrollbar-color: rgba(71, 85, 105, 0.5) transparent;
}

#channels-scroll-container::-webkit-scrollbar {
  width: 6px;
}

#channels-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

#channels-scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.4);
  border-radius: 9999px;
}

html.dark #channels-scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(71, 85, 105, 0.5);
}

#channels-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: rgba(16, 185, 129, 0.7);
}

#category-pills-bar {
  cursor: grab;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}

#category-pills-bar.cursor-grabbing {
  cursor: grabbing !important;
  user-select: none;
}
