/* ============================================
   Sidebar – component styles
   ============================================ */

/* Scrollbars for sidebar and lang list */
.sidebar,
.lang-dropdown-wrap .lang-list {
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  scrollbar-color: #555555 #252525;
}

.sidebar::-webkit-scrollbar,
.lang-dropdown-wrap .lang-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.sidebar::-webkit-scrollbar-track,
.lang-dropdown-wrap .lang-list::-webkit-scrollbar-track {
  background: #252525 !important;
  border-radius: 0;
}

.sidebar::-webkit-scrollbar-thumb,
.lang-dropdown-wrap .lang-list::-webkit-scrollbar-thumb {
  background: #555555 !important;
  border-radius: 5px;
  border: 2px solid #252525;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.lang-dropdown-wrap .lang-list::-webkit-scrollbar-thumb:hover {
  background: #e63946 !important;
}

/* Sidebar: dropdown below trigger, in flow so theme & logout stay underneath */
.sidebar-lang-dropdown .lang-dropdown-panel {
  position: static;
  left: auto;
  right: auto;
  min-width: 100%;
  margin: 0.25rem 0 0 0;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  box-shadow: none;
  border-radius: 6px;
}

/* ============================================
   Sidebar
   ============================================ */
/* Base (before move into page-wrap or fallback) */
.sidebar-wrapper {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: auto;
  margin: 0;
  padding: 0;
  width: 400px;
  max-width: 90vw;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
  z-index: 200;
  pointer-events: none;
}

.sidebar-wrapper .sidebar {
  pointer-events: auto;
}

@media (min-width: 1921px) {
  .sidebar-wrapper,
  .page-wrap > .sidebar-wrapper {
    left: calc((100vw - 1920px - var(--scrollbar-w, 0px)) / 2);
    max-width: none;
  }
}

/* Sidebar inside page-wrap: fixed so it stays visible when scrolling.
   Left edge aligns with page-wrap: 0 when viewport ≤1920px, calc((100vw - 1920px) / 2) when wider (see media query). */
.page-wrap > .sidebar-wrapper {
  position: fixed;
  top: var(--header-h, 56px);
  margin: 0;
  padding: 0;
  height: calc(100vh - var(--header-h, 56px));
  min-height: 0;
  z-index: 200;
  flex: 0 0 0;
  min-width: 0;
}

.page-wrap > .sidebar-wrapper .sidebar {
  pointer-events: auto;
  min-height: 0;
}

/* Sidebar: slides -100% to 0 inside wrapper (no white space, transition starts at container edge) */
.sidebar {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  background: #111111;
  border-top: 1px solid #2a2a2a;
  padding: 1.25rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  --sidebar-padding-x: 1rem;
}

.sidebar[aria-hidden="false"] {
  transform: translateX(0);
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-backdrop {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

@media (min-width: 1921px) {
  .sidebar-backdrop {
    left: calc((100vw - 1920px - var(--scrollbar-w, 0px)) / 2);
    width: 1920px;
    right: auto;
  }
}

/* Backdrop inside page-wrap: fixed so it covers viewport when open. Take no space in flex layout. */
.page-wrap > .sidebar-backdrop {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 199;
  flex: 0 0 0;
  min-height: 0;
}

/* Wide viewport: extend backdrop left and right of 1920 container so both margins are greyed and click-to-close */
@media (min-width: 1921px) {
  .page-wrap > .sidebar-backdrop {
    width: 100vw;
    right: auto;
  }
}

.sidebar-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  margin-left: calc(-1 * var(--sidebar-padding-x));
  margin-right: calc(-1 * var(--sidebar-padding-x));
  padding-bottom: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.75rem var(--sidebar-padding-x);
  color: #ffffff;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 20px;
  line-height: 100%;
  letter-spacing: 0;
  vertical-align: middle;
  leading-trim: none;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.sidebar-link-signin {
  flex: 0 0 auto;
  justify-content: flex-start;
}

.sidebar-link.live-link {
  flex: 0 0 auto;
  margin-left: auto;
}

.sidebar .live-logo-sidebar,
.sidebar .live-link .live-logo {
  height: 32px;
  width: auto;
  display: block;
}

.sidebar-link:hover {
  color: #EA0029;
  transform: scale(1.15);
}

.sidebar-link.live-link {
  color: var(--accent);
}

.sidebar-link.live-link:hover {
  color: #EA0029;
  transform: scale(1.15);
}

.sidebar-link:hover .live-logo {
  filter: brightness(1.1);
}

/* Sidebar search – underneath Sign in / Live row, with side margins */
.sidebar-search-wrap {
  width: 100%;
  margin-bottom: 1.25rem;
}

.sidebar-search-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 37px;
  padding: 7.67px 11.67px;
  box-sizing: border-box;
  border: none;
  border-radius: 4px;
  background: #282828;
  color: #ffffff;
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-search-trigger:hover {
  background: #333333;
  color: #ffffff;
}

.sidebar-search-icon {
  flex-shrink: 0;
  display: block;
  width: 20px;
  height: auto;
  opacity: 0.9;
}

.sidebar-search-text {
  flex: 1;
  line-height: 1;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.25rem;
  margin-left: calc(-1 * var(--sidebar-padding-x));
  margin-right: calc(-1 * var(--sidebar-padding-x));
  width: calc(100% + 2 * var(--sidebar-padding-x));
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px calc(20px + var(--sidebar-padding-x));
  color: #ffffff;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 18px;
  line-height: 100%;
  letter-spacing: 0;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  box-sizing: border-box;
}

.sidebar-nav-item:hover:not(.active) {
  color: #ffffff;
  background: #EA0029;
  border-bottom-color: transparent;
}

.sidebar-nav-item:hover:not(.active) .arrow,
.sidebar-nav-item.active .arrow {
  opacity: 1;
}

.sidebar-nav-item:hover:not(.active) .arrow svg path,
.sidebar-nav-item.active .arrow svg path {
  fill: #191919;
}

.sidebar-nav-item.active {
  color: #fff;
  background: #EA0029;
  border-bottom-color: transparent;
}

.sidebar-nav-item.active:hover {
  color: #fff;
  background: #EA0029;
}

.sidebar-nav-item .arrow,
.sidebar-studios-title .arrow,
.sidebar-legal-link .arrow {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.sidebar-nav-item .arrow svg path,
.sidebar-studios-title .arrow svg path,
.sidebar-legal-link .arrow svg path {
  transition: fill 0.3s ease;
}

.sidebar-nav-item .arrow {
  font-size: 0.9em;
}

.sidebar-studios {
  margin-bottom: 1.25rem;
  padding: 0;
  box-sizing: border-box;
}

.sidebar-studios-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% + 2 * var(--sidebar-padding-x));
  margin-left: calc(-1 * var(--sidebar-padding-x));
  margin-right: calc(-1 * var(--sidebar-padding-x));
  padding: 12px calc(20px + var(--sidebar-padding-x));
  color: #ffffff;
  margin-bottom: 0.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  box-sizing: border-box;
}

.sidebar-studios-logo {
  display: block;
  height: 22px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.studios-text-red {
  color: #EA0029;
}

.studios-text-white {
  color: #ffffff;
}

.sidebar-studios-title:hover {
  background: #252525;
}

.sidebar-studios-title.active {
  background: #EA0029;
  color: #fff;
}

.sidebar-studios-title.active:hover {
  background: #EA0029;
  color: #fff;
}

.sidebar-studios-title:hover .sidebar-studios-logo {
  opacity: 0.9;
  filter: brightness(1.08);
}

.sidebar-studios-title:hover .arrow {
  opacity: 1;
}

.sidebar-studios-title:hover .arrow svg path {
  fill: #191919;
}

.sidebar-studios-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.studio-placeholder {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 78/44;
  border-radius: 0;
  background: #191919;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  text-align: center;
  padding: 6px 4px;
  color: #fff;
  line-height: 1.2;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  transition: background 0.3s ease;
}

.studio-placeholder:hover {
  background: #252525;
}

.studio-placeholder.studio-goats,
.studio-placeholder.studio-maximo,
.studio-placeholder.studio-dods {
  background: #191919;
}

.studio-placeholder.studio-goats:hover,
.studio-placeholder.studio-maximo:hover,
.studio-placeholder.studio-dods:hover {
  background: #252525;
}

.studio-placeholder .studio-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-legal {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  margin-left: calc(-1 * var(--sidebar-padding-x));
  margin-right: calc(-1 * var(--sidebar-padding-x));
  width: calc(100% + 2 * var(--sidebar-padding-x));
}

.sidebar-legal-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px calc(20px + var(--sidebar-padding-x));
  border: none;
  background: none;
  color: #ffffff;
  font-family: 'Open Sans', sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 100%;
  letter-spacing: 0;
  vertical-align: middle;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  box-sizing: border-box;
  text-decoration: none;
}

.sidebar-legal-link:hover {
  color: #ffffff;
  background: #EA0029;
}

.sidebar-legal-link:hover .arrow {
  opacity: 1;
}

.sidebar-legal-link:hover .arrow svg path {
  fill: #191919;
}

.sidebar-lang-dropdown {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.sidebar-lang-dropdown .sidebar-legal-link,
.sidebar-lang-dropdown button.sidebar-legal-link {
  font-family: 'Open Sans', sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 100%;
  letter-spacing: 0;
  vertical-align: middle;
  background: transparent !important;
  background-color: transparent !important;
}

/* Language list entries: same horizontal padding as nav/legal so text aligns with sidebar, flag with arrows */
.sidebar-lang-dropdown .lang-list li {
  padding: 12px calc(20px + var(--sidebar-padding-x));
  min-height: 48px;
  box-sizing: border-box;
}

.sidebar-lang-dropdown .lang-option-name {
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 12px;
  line-height: 100%;
  letter-spacing: 0%;
  vertical-align: middle;
}

.sidebar-lang-dropdown .sidebar-legal-link:hover,
.sidebar-lang-dropdown button.sidebar-legal-link:hover {
  background: #EA0029 !important;
  background-color: #EA0029 !important;
}

.sidebar-footer {
  padding-top: 1rem;
  padding-left: var(--sidebar-padding-x);
  padding-right: var(--sidebar-padding-x);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-left: calc(-1 * var(--sidebar-padding-x));
  margin-right: calc(-1 * var(--sidebar-padding-x));
  width: calc(100% + 2 * var(--sidebar-padding-x));
  box-sizing: border-box;
}

/* Theme toggle – pill with two options (two buttons side by side) */
.theme-toggle {
  display: flex;
  width: 100%;
  max-width: 220px;
  background: #282828;
  border-radius: 10px;
  padding: 4px;
  gap: 0;
  margin-bottom: 1rem;
}

.sidebar-theme-option {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 34px;
  line-height: 0;
}

.sidebar-theme-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Dark theme button only: darker background on hover (same as selected) */
.sidebar-theme-option[data-theme="dark"]:hover {
  background: #191919;
}

.sidebar-theme-option.active {
  background: #191919;
}

/* Light mode: brighter selection so active pill stands out */
html.theme-light .sidebar .sidebar-theme-option.active,
html[data-theme="light"] .sidebar .sidebar-theme-option.active {
  background: #3a3a3a;
}

.sidebar-theme-option-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-theme-light-svg svg {
  display: block;
  height: 20px;
  width: auto;
}

.sidebar-theme-dark-svg svg {
  display: block;
  height: 20px;
  width: auto;
}

.sidebar-theme-option-img {
  display: block;
  height: 18px;
  width: auto;
  object-fit: contain;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: #191919;
  border: none;
  border-radius: 8px;
  color: #FAFAFA;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 20px;
  line-height: 100%;
  letter-spacing: 0;
  leading-trim: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-logout:hover {
  color: #FAFAFA;
  background: #252525;
}

.btn-logout-icon {
  flex-shrink: 0;
  display: block;
}

/* ============================================
   Sidebar – responsive
   ============================================ */
@media (max-width: 768px) {
  .sidebar-wrapper,
  .page-wrap > .sidebar-wrapper {
    width: 100%;
    max-width: 100%;
    left: 0;
  }

  .sidebar {
    width: 100%;
    max-width: 100%;
  }

  /* Opaque backdrop so when open you only see the sidebar (no page content) */
  body.sidebar-open .sidebar-backdrop {
    background: #111111;
  }
}
