/* Streamo Classic Dark Cinema Theme — TV-First CSS3 (Legacy WebOS / Tizen compatible) */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: #121316;
  color: #f4f4f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.view-screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #121316;
}

/* Focus Ring — unmistakably visible on TV D-Pad */
[data-focusable="true"] {
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease, background-color 0.14s ease;
}

[data-focusable="true"]:focus,
[data-focusable="true"].tv-focused {
  border-color: #cf9346 !important;
  box-shadow: 0 0 0 3px rgba(207, 147, 70, 0.55), 0 6px 20px rgba(0, 0, 0, 0.55) !important;
  transform: scale(1.025);
  z-index: 4;
}

/* Buttons & Inputs */
.btn {
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #f4f4f5;
  background-color: #23252b;
  text-align: center;
  white-space: nowrap;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-primary {
  background-color: #cf9346;
  border-color: #dfa659;
  color: #121316;
}

.btn-secondary {
  background-color: #23252b;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f4f4f5;
}

.btn-ghost {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  color: #9ca3af;
}

.btn-danger {
  background-color: rgba(224, 82, 96, 0.18);
  border-color: #e05260;
  color: #ff9ca6;
}

.tv-input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background-color: #121316;
  color: #f4f4f5;
  font-size: 15px;
}

.field-label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
}

.field-row-2 {
  display: flex;
  flex-direction: row;
  width: 100%;
}

.field-col {
  flex: 1;
  min-width: 0;
}

.field-col + .field-col {
  margin-left: 12px;
}

.error-box {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background-color: rgba(224, 82, 96, 0.15);
  border: 1px solid #e05260;
  color: #ffb3ba;
  font-size: 13px;
  line-height: 1.4;
}

/* Auth / Servers Screen */
#servers-view {
  overflow-y: auto;
  padding: 28px 36px;
}

.auth-shell {
  max-width: 1220px;
  margin: 0 auto;
}

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

.brand-row {
  display: flex;
  align-items: center;
}

.brand-mark-img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  margin-right: 16px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark-img-sm {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  margin-right: 10px;
}

.login-mode-tabs {
  display: flex;
  flex-direction: row;
  margin-bottom: 14px;
}

.mode-tab {
  margin-right: 8px;
  background-color: #23252b;
  color: #9ca3af;
}

.mode-tab.active {
  background-color: #cf9346;
  border-color: #dfa659;
  color: #121316;
}

.brand-title {
  margin: 0;
  font-size: 24px;
  letter-spacing: 2px;
  color: #f4f4f5;
}

.brand-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  letter-spacing: 1px;
  background-color: rgba(207, 147, 70, 0.18);
  color: #dfa659;
  border: 1px solid rgba(207, 147, 70, 0.4);
}

.brand-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #9ca3af;
}

.auth-columns {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.panel-box {
  background-color: #1a1c20;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
}

.servers-list-panel {
  width: 40%;
  margin-right: 22px;
  min-height: 440px;
}

.server-form-panel {
  width: 60%;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  color: #f4f4f5;
}

.count-pill {
  padding: 3px 10px;
  border-radius: 999px;
  background-color: #23252b;
  color: #dfa659;
  font-size: 13px;
  font-weight: 700;
}

.saved-servers-list {
  max-height: 460px;
  overflow-y: auto;
  padding: 4px;
}

.server-item-card {
  background-color: #23252b;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.server-item-card.active-server {
  border-color: rgba(207, 147, 70, 0.65);
}

.server-item-title {
  font-size: 16px;
  font-weight: 700;
  color: #f4f4f5;
  margin-bottom: 4px;
}

.server-item-sub {
  font-size: 12px;
  color: #9ca3af;
  word-break: break-all;
  margin-bottom: 10px;
}

.server-item-actions {
  display: flex;
  flex-direction: row;
}

.server-item-actions .btn {
  margin-right: 8px;
}

.form-actions {
  display: flex;
  flex-direction: row;
  margin-top: 8px;
}

.form-actions .btn {
  margin-right: 12px;
}

/* Main Workspace Top Bar */
#main-view {
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 22px;
  background-color: #15161a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.topbar-brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #f4f4f5;
}

.server-pill {
  margin-left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: #23252b;
  color: #dfa659;
  font-size: 12px;
  font-weight: 600;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tabs {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.nav-tab {
  border: 2px solid transparent;
  background-color: transparent;
  color: #9ca3af;
  padding: 9px 15px;
  margin: 0 3px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.nav-tab.active {
  background-color: #cf9346;
  color: #121316;
}

.topbar-right {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.search-input {
  width: 190px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background-color: #121316;
  color: #f4f4f5;
  font-size: 14px;
  margin-right: 8px;
}

.topbar-right .btn {
  margin-left: 6px;
}

/* Split Workspace */
.workspace {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.categories-panel {
  width: 260px;
  background-color: #15161a;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.categories-title {
  padding: 14px 18px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #71717a;
}

.categories-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 20px;
}

.category-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 2px solid transparent;
  background-color: transparent;
  color: #d4d4d8;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.category-btn.active {
  background-color: #23252b;
  border-color: rgba(207, 147, 70, 0.55);
  color: #dfa659;
  font-weight: 700;
}

.category-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.category-count {
  font-size: 12px;
  color: #71717a;
  flex-shrink: 0;
}

.catalog-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 36px;
  background-color: #121316;
}

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

.catalog-header h2 {
  margin: 0;
  font-size: 22px;
  color: #f4f4f5;
}

.catalog-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: #9ca3af;
}

.pagination-controls {
  display: flex;
  align-items: center;
}

.page-indicator {
  margin: 0 12px;
  font-size: 14px;
  color: #9ca3af;
}

/* Catalog Grid — Flexbox safe rows */
.catalog-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin: -8px;
}

.media-card {
  position: relative;
  width: 185px;
  margin: 8px;
  background-color: #1a1c20;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  color: #f4f4f5;
  display: flex;
  flex-direction: column;
}

.media-card.live-card {
  width: 215px;
}

.media-thumb-box {
  position: relative;
  width: 100%;
  height: 245px;
  background-color: #23252b;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-card.live-card .media-thumb-box {
  height: 126px;
  padding: 12px;
}

.media-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-card.live-card .media-thumb-img {
  object-fit: contain;
}

.media-thumb-fallback {
  font-size: 28px;
  font-weight: 800;
  color: #71717a;
}

.card-badge-top {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background-color: rgba(18, 19, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #dfa659;
  font-size: 11px;
  font-weight: 700;
}

.card-fav-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background-color: rgba(207, 147, 70, 0.92);
  color: #121316;
  font-size: 11px;
  font-weight: 800;
}

.card-progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.18);
}

.card-progress-fill {
  height: 100%;
  background-color: #cf9346;
}

.media-card-body {
  padding: 10px 11px 12px;
}

.media-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #f4f4f5;
  line-height: 1.3;
  height: 36px;
  overflow: hidden;
}

.media-card-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Loading & Empty States */
.loading-state, .empty-state {
  padding: 48px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 16px;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: #cf9346;
  animation: tv-spin 0.8s linear infinite;
}

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

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(8, 9, 12, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  z-index: 50;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  overflow-y: auto;
  background-color: #1a1c20;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.details-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 230px;
  background-size: cover;
  background-position: center;
  opacity: 0.22;
  pointer-events: none;
}

.details-body {
  position: relative;
  padding: 26px;
}

.details-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.details-poster-wrap {
  width: 195px;
  height: 285px;
  border-radius: 12px;
  overflow: hidden;
  background-color: #23252b;
  margin-right: 24px;
  flex-shrink: 0;
}

.details-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.details-info {
  flex: 1;
  min-width: 0;
}

.details-badges {
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}

.badge-gold {
  background-color: #cf9346;
  color: #121316;
}

.badge-dark {
  background-color: #2a2c33;
  color: #f4f4f5;
}

.badge-success {
  background-color: rgba(104, 182, 132, 0.22);
  color: #68b684;
  border: 1px solid rgba(104, 182, 132, 0.5);
}

.details-title {
  margin: 0 0 8px;
  font-size: 26px;
  color: #f4f4f5;
}

.details-genre {
  margin: 0 0 10px;
  font-size: 13px;
  color: #dfa659;
}

.details-plot {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.5;
  color: #d4d4d8;
}

.details-cast {
  margin: 0 0 18px;
  font-size: 13px;
  color: #9ca3af;
}

.details-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.details-actions .btn {
  margin-right: 10px;
  margin-bottom: 8px;
}

.series-seasons-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.section-subtitle {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #f4f4f5;
}

.seasons-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.season-pill {
  margin-right: 8px;
  margin-bottom: 8px;
}

.season-pill.active {
  background-color: #cf9346;
  border-color: #dfa659;
  color: #121316;
}

.episodes-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}

.episode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background-color: #23252b;
  color: #f4f4f5;
  text-align: left;
  cursor: pointer;
}

.episode-row-title {
  font-size: 14px;
  font-weight: 600;
}

.episode-row-meta {
  font-size: 12px;
  color: #dfa659;
  margin-left: 12px;
  flex-shrink: 0;
}

/* Parental Modal */
.parental-card {
  max-width: 520px;
  padding: 24px;
}

.parental-status-text {
  margin: 0 0 14px;
  font-size: 14px;
  color: #9ca3af;
}

.pin-input {
  text-align: center;
  font-size: 22px;
  letter-spacing: 8px;
}

.pin-keypad {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -4px 14px;
}

.pin-key {
  width: calc(33.333% - 8px);
  margin: 4px;
  padding: 12px 0;
  font-size: 17px;
}

.parental-options {
  margin-bottom: 14px;
}

.keyword-row {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.keyword-row .tv-input {
  margin-bottom: 0;
  margin-right: 8px;
}

.parental-keywords-list {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
}

.keyword-chip {
  margin: 4px 6px 0 0;
  padding: 5px 10px;
  font-size: 12px;
}

/* Fullscreen Player */
.player-view {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #000000;
  z-index: 90;
}

.tv-video {
  width: 100%;
  height: 100%;
  background-color: #000000;
  object-fit: contain;
}

.player-buffering {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 24px;
  border-radius: 12px;
  background-color: rgba(18, 19, 22, 0.85);
  text-align: center;
  z-index: 92;
}

.player-osd {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 34px;
  background: linear-gradient(
    to bottom,
    rgba(12, 13, 16, 0.88) 0%,
    rgba(12, 13, 16, 0.08) 32%,
    rgba(12, 13, 16, 0.08) 66%,
    rgba(12, 13, 16, 0.94) 100%
  );
  transition: opacity 0.2s ease;
  z-index: 95;
}

.player-osd.osd-hidden {
  opacity: 0;
  pointer-events: none;
}

.player-osd-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.player-badges {
  margin-bottom: 8px;
}

.player-title {
  margin: 0;
  font-size: 24px;
  color: #f4f4f5;
}

.player-subtitle {
  margin: 5px 0 0;
  font-size: 14px;
  color: #9ca3af;
}

.player-timeline-row {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.time-label {
  width: 68px;
  font-size: 14px;
  font-weight: 600;
  color: #f4f4f5;
  text-align: center;
}

.progress-track {
  flex: 1;
  height: 8px;
  margin: 0 12px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background-color: #cf9346;
}

.player-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.player-controls-row .btn {
  margin-right: 10px;
  margin-bottom: 6px;
}

/* Toast */
.tv-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 20px;
  border-radius: 10px;
  background-color: #1a1c20;
  border: 2px solid #cf9346;
  color: #f4f4f5;
  font-size: 14px;
  font-weight: 600;
  z-index: 120;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
}

/* Scrollbar polish */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #121316;
}

::-webkit-scrollbar-thumb {
  background: #2a2c33;
  border-radius: 4px;
}
