/*
 * Stable compatibility layer for older Smart TV browsers.
 * Use only broadly supported CSS declarations in this file.
 */
html,
body,
#root {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #27262c;
  color: #f4f4f5;
  font-family: system-ui, -apple-system, Inter, Arial, sans-serif;
}

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

button,
input {
  font: inherit;
}

.legacy-fullscreen-state {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #f4f4f5;
}

.legacy-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.legacy-player-page {
  position: relative;
  width: 100%;
  height: 100vh; /* Fixed height for TV/Desktop */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f4f4f5;
  background: #27262c;
}

.legacy-player-header {
  flex: none;
  z-index: 50;
  width: 100%;
  background: #302f35;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.legacy-player-header-inner {
  width: 100%;
  max-width: 1800px;
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legacy-client-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.legacy-client-logo {
  display: flex;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  max-width: 44px;
  max-height: 44px;
  object-fit: contain;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px;
}

.legacy-client-identity h1 {
  margin: 0;
  color: #fafafa;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.legacy-client-identity p {
  margin: 3px 0 0;
  color: #8b8b93;
  font-size: 12px;
}

.legacy-account-button {
  min-height: 42px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #f4f4f5;
  cursor: pointer;
  transition: all 0.2s ease;
}

.legacy-account-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.legacy-player-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.legacy-player-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  gap: 24px;
}

/* Left zone: Now Playing / Brand Panel */
.legacy-now-playing {
  flex: 0 0 400px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top-width: 4px;
  border-radius: 20px;
  background: #37353d;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.legacy-now-playing-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.035);
}

.legacy-brand-hero-logo {
  max-height: 80px;
  max-width: 240px;
  object-fit: contain;
}

.legacy-brand-hero-text {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.legacy-now-playing-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  gap: 24px;
}

.legacy-now-playing-art-wrap {
  display: flex;
  justify-content: center;
}

.legacy-now-playing-art {
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  background: #242329;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.legacy-now-playing-logo {
  width: 100%;
  height: 100%;
  padding: 16px;
  object-fit: contain;
}

.legacy-now-playing-info {
  text-align: center;
}

.legacy-now-playing-info h2 {
  margin: 0;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-now-playing-info p {
  margin: 8px 0 0;
  color: #a1a1aa;
  font-size: 15px;
}

.legacy-now-playing-progress {
  padding: 0 24px 16px;
}

.legacy-progress {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #a1a1aa;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

.legacy-progress > div {
  height: 6px;
  flex: 1 1 auto;
  overflow: hidden;
  border-radius: 999px;
  background: #27272a;
}

.legacy-now-playing-controls {
  padding: 20px 24px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(17, 17, 19, 0.24);
}

.legacy-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legacy-playback-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.legacy-volume {
  display: flex;
  align-items: center;
  width: 130px;
  gap: 12px;
}

[data-testid="button-play-pause"],
[data-testid="button-next-track"],
[data-testid="button-mute"] {
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #fff;
  cursor: pointer;
}

[data-testid="button-play-pause"] {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  transition: transform 0.1s ease;
}

[data-testid="button-play-pause"]:active {
  transform: scale(0.95);
}

[data-testid="button-next-track"] {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #27272a;
  transition: background 0.2s;
}

[data-testid="button-next-track"]:hover {
  background: #3f3f46;
}

[data-testid="button-mute"] {
  width: 36px;
  height: 36px;
  background: transparent;
  color: #a1a1aa;
}
[data-testid="button-mute"]:hover {
  color: #fff;
}


/* Right zone: Channel Area */
.legacy-channel-area {
  flex: 1 1 auto;
  min-width: 0;
  background: #323138;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 24px;
  overflow-y: auto;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
}

.legacy-channel-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 4px;
}

.legacy-channel-area-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.legacy-channel-area-header span {
  font-size: 13px;
  color: #a1a1aa;
  background: #44424a;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

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

.legacy-channel-card {
  position: relative;
  width: 100%;
  min-height: 88px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: #fff;
  text-align: left;
  cursor: pointer;
  appearance: none;
  background: #3b3941;
  transition: all 0.2s ease;
}

.legacy-channel-card:hover {
  background: #45434b;
  border-color: rgba(255, 255, 255, 0.22);
}

.legacy-channel-card[data-active="true"] {
  border-color: rgba(255, 255, 255, 0.5);
  background: #4a4850;
}

.legacy-vinyl-wrap {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  min-width: 56px;
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channel-vinyl {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #09090b;
  border: 1px solid #3f3f46;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.legacy-vinyl-groove {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  pointer-events: none;
}

.legacy-vinyl-label {
  position: relative;
  z-index: 2;
  width: 45%;
  height: 45%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
}

.legacy-vinyl-label svg {
  color: #111;
  opacity: 0.8;
}

.legacy-vinyl-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #09090b;
  border: 1px solid rgba(0,0,0,0.5);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}

.legacy-channel-info {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
}

.legacy-channel-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.4);
}

.legacy-channel-name {
  margin: 6px 0 0;
  overflow: hidden;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-channel-action {
  position: relative;
  z-index: 1;
  width: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.legacy-channel-toggle {
  width: 100%;
  max-width: 320px;
  min-height: 44px;
  margin: 20px auto 0;
  padding: 9px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: #44424a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.legacy-channel-toggle:hover {
  background: #504e56;
  border-color: rgba(255, 255, 255, 0.3);
}

.legacy-channel-toggle svg {
  width: 16px;
  height: 16px;
}

.legacy-channel-extra-desktop {
  display: none;
}
.legacy-channel-toggle-desktop {
  display: flex;
}
.legacy-channel-toggle-tablet,
.legacy-channel-toggle-mobile {
  display: none;
}

.legacy-channel-pager {
  display: none;
}

/* Responsiveness */
@media (max-width: 1280px) {
  .legacy-now-playing {
    flex: 0 0 340px;
  }
  .legacy-now-playing-art {
    width: 200px;
    height: 200px;
  }
}

@media (max-width: 700px) {
  html, body, #root {
    overflow: auto; /* Allow scrolling on mobile */
  }
  
  .legacy-player-page {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .legacy-player-content {
    padding: 12px;
  }

  .legacy-player-view {
    flex-direction: column;
    gap: 16px;
  }

  .legacy-now-playing {
    flex: none;
    border-radius: 16px;
  }

  .legacy-now-playing-brand {
    display: none; /* Hide big logo on mobile, header is enough */
  }

  .legacy-now-playing-body {
    padding: 20px;
    gap: 16px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }

  .legacy-now-playing-art-wrap {
    flex: 0 0 100px;
  }

  .legacy-now-playing-art {
    width: 100px;
    height: 100px;
    border-radius: 12px;
  }

  .legacy-now-playing-info {
    text-align: left;
    flex: 1;
  }

  .legacy-now-playing-info h2 {
    font-size: 22px;
  }

  .legacy-channel-area {
    flex: none;
    overflow: visible;
    padding: 16px;
    border-radius: 16px;
  }
  
  .legacy-channel-grid {
    grid-template-columns: 1fr;
  }

  .legacy-channel-extra-tablet,
  .legacy-channel-extra-desktop {
    display: flex; /* Override desktop hidden logic */
  }
  .legacy-channel-extra-mobile {
    display: none;
  }

  .legacy-channel-toggle-desktop {
    display: none;
  }
  .legacy-channel-toggle-mobile {
    display: flex;
  }
}

/* Compact one-screen console for desktop and Smart TV browsers. */
@media (min-width: 701px) {
  .legacy-player-content {
    padding: 12px 18px;
  }

  .legacy-player-view {
    flex-direction: column;
    gap: 10px;
  }

  .legacy-now-playing {
    width: 100%;
    flex: 0 0 185px;
    flex-direction: row;
    border-radius: 16px;
  }

  .legacy-now-playing-brand {
    display: none;
  }

  .legacy-now-playing-body {
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 16px;
    gap: 14px;
  }

  .legacy-now-playing-art-wrap {
    flex: 0 0 140px;
  }

  .legacy-now-playing-art {
    width: 140px;
    height: 140px;
    border-radius: 12px;
  }

  .legacy-now-playing-logo {
    padding: 7px;
  }

  .legacy-now-playing-info {
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
  }

  .legacy-now-playing-info h2 {
    font-size: 28px;
  }

  .legacy-now-playing-progress {
    width: 25%;
    flex: 0 0 25%;
    padding: 0 18px;
    align-self: center;
  }

  .legacy-now-playing-controls {
    width: 300px;
    flex: 0 0 300px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
  }

  .legacy-channel-area {
    min-height: 0;
    flex: 1 1 auto;
    padding: 12px 14px;
    overflow: hidden;
    border-radius: 16px;
  }

  .legacy-channel-area-header {
    margin-bottom: 8px;
  }

  .legacy-channel-area-header h3 {
    font-size: 15px;
  }

  .legacy-channel-area-header span {
    padding: 3px 8px;
    font-size: 11px;
  }

  .legacy-channel-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .legacy-channel-card {
    min-height: 70px;
    padding: 9px 12px;
    border-radius: 13px;
  }

  .legacy-vinyl-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
    margin-right: 12px;
  }

  .legacy-channel-type {
    padding: 2px 5px;
    font-size: 9px;
  }

  .legacy-channel-name {
    margin-top: 4px;
    font-size: 15px;
  }

  .legacy-channel-action {
    width: 38px;
    min-width: 38px;
  }

  .legacy-channel-action > div {
    width: 34px;
    height: 34px;
  }

  .legacy-channel-extra-mobile,
  .legacy-channel-extra-tablet,
  .legacy-channel-extra-desktop {
    display: flex !important;
  }

  .legacy-channel-page-hidden {
    display: none !important;
  }

  .legacy-channel-toggle,
  .legacy-channel-toggle-mobile,
  .legacy-channel-toggle-tablet,
  .legacy-channel-toggle-desktop,
  .legacy-channel-toggle-collapse {
    display: none !important;
  }

  .legacy-channel-pager {
    min-height: 44px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
  }

  .legacy-channel-pager button {
    min-width: 118px;
    min-height: 42px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: #4a4850;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .legacy-channel-pager button:disabled {
    opacity: 0.32;
    cursor: default;
  }

  .legacy-channel-pager button svg {
    width: 18px;
    height: 18px;
  }

  .legacy-channel-pager span {
    min-width: 96px;
    color: #d4d4d8;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .channel-vinyl, [data-testid="button-play-pause"] {
    animation: none !important;
    transition: none !important;
  }
}
