/* StreamVault mobile / native-style shell — only active when html.mobile-app is set */

html.mobile-app {
  --sv-header-h: 52px;
  --sv-tab-bar-h: 62px;
  --sv-safe-top: env(safe-area-inset-top, 0px);
  --sv-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html.mobile-app body {
  min-height: 100dvh;
  padding-top: calc(var(--sv-header-h) + var(--sv-safe-top));
  padding-bottom: calc(var(--sv-tab-bar-h) + var(--sv-safe-bottom));
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

html.mobile-app .desktop-only {
  display: none !important;
}

html.mobile-app .mobile-only {
  display: flex !important;
}

html.mobile-app .mobile-only.hidden {
  display: none !important;
}

/* —— Login —— */
html.mobile-app body.login-page {
  padding-top: 0;
  padding-bottom: var(--sv-safe-bottom);
}

html.mobile-app .login-nav {
  padding: calc(0.85rem + var(--sv-safe-top)) 1.25rem 0.85rem;
}

html.mobile-app .login-card {
  padding: 2rem 1.35rem 1.75rem;
  border-radius: 12px;
}

html.mobile-app .login-card input,
html.mobile-app .login-card button {
  min-height: 48px;
  font-size: 16px;
}

html.mobile-app .login-footer {
  padding-bottom: calc(1rem + var(--sv-safe-bottom));
}

/* —— App header —— */
html.mobile-app .app-header {
  height: calc(var(--sv-header-h) + var(--sv-safe-top));
  padding: var(--sv-safe-top) 0.85rem 0;
  gap: 0.65rem;
  background: rgba(20, 20, 20, 0.98);
  box-shadow: 0 1px 0 var(--sv-border);
}

html.mobile-app .app-header.scrolled {
  background: rgba(20, 20, 20, 0.98);
}

html.mobile-app .app-header .brand {
  font-size: 1.15rem;
}

html.mobile-app .header-right {
  gap: 0.35rem;
  margin-left: auto;
}

html.mobile-app .icon-btn {
  font: inherit;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sv-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

html.mobile-app .icon-btn.active {
  background: rgba(229, 9, 20, 0.25);
  color: #fff;
}

html.mobile-app .search-box {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  top: calc(var(--sv-header-h) + var(--sv-safe-top) + 0.35rem);
  z-index: 120;
  background: #1a1a1a;
  border: 1px solid var(--sv-border);
  box-shadow: var(--sv-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--sv-transition), transform var(--sv-transition), visibility var(--sv-transition);
}

html.mobile-app .search-box.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

html.mobile-app .search-box input {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
}

html.mobile-app .search-box:not(.open) #search-btn {
  display: none;
}

html.mobile-app .search-box.open #search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html.mobile-app .btn-ghost {
  min-height: 36px;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
}

/* —— Bottom tab bar —— */
html.mobile-app .mobile-tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  height: calc(var(--sv-tab-bar-h) + var(--sv-safe-bottom));
  padding: 0.35rem 0.5rem var(--sv-safe-bottom);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 0.25rem;
  background: rgba(12, 12, 12, 0.96);
  border-top: 1px solid var(--sv-border);
  backdrop-filter: blur(12px);
}

html.mobile-app .mobile-tab-bar button {
  flex: 1;
  font: inherit;
  border: none;
  background: transparent;
  color: var(--sv-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 48px;
  border-radius: 10px;
  cursor: pointer;
  padding: 0.25rem;
}

html.mobile-app .mobile-tab-bar button.active {
  color: var(--sv-text);
  background: rgba(255, 255, 255, 0.06);
}

html.mobile-app .mobile-tab-bar .tab-icon {
  font-size: 1.15rem;
  line-height: 1;
}

html.mobile-app .mobile-tab-bar .tab-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* —— Main content —— */
html.mobile-app .app-main {
  padding-top: 0;
}

html.mobile-app .hero {
  min-height: auto;
  padding: 1rem 1rem 0.85rem;
}

html.mobile-app .hero h2 {
  font-size: 1.45rem;
}

html.mobile-app .hero p {
  font-size: 0.9rem;
}

html.mobile-app .content-section {
  padding: 0 0.85rem 1rem;
}

html.mobile-app .section-head h3 {
  font-size: 1.05rem;
}

html.mobile-app .section-head .muted {
  font-size: 0.72rem;
}

html.mobile-app .catalog-grid.movies,
html.mobile-app .catalog-grid.series {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem 0.5rem;
}

html.mobile-app .catalog-grid.live {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.5rem;
}

html.mobile-app .tile.item:hover .tile-poster {
  transform: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

html.mobile-app .tile-overlay {
  opacity: 1;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.55) 0%, transparent 50%);
}

html.mobile-app .play-fab,
html.mobile-app .tile-overlay button[data-play],
html.mobile-app .tile-overlay button[data-series] {
  width: 40px;
  height: 40px;
}

html.mobile-app .tile-info .item-title {
  font-size: 0.78rem;
}

html.mobile-app .tile-info .item-meta {
  font-size: 0.68rem;
}

html.mobile-app .pager-bar {
  margin-top: 1rem;
  padding-top: 0.75rem;
}

html.mobile-app .pager-bar button {
  min-height: 44px;
  flex: 1;
}

html.mobile-app .series-detail {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
}

html.mobile-app .series-detail .item {
  padding: 0.75rem;
}

html.mobile-app button.small {
  min-height: 40px;
  min-width: 72px;
}

/* —— Fullscreen mobile player —— */
html.mobile-app body.mobile-playing {
  padding-bottom: var(--sv-safe-bottom);
  overflow: hidden;
}

html.mobile-app body.mobile-playing .mobile-tab-bar,
html.mobile-app body.mobile-playing .app-header {
  display: none !important;
}

html.mobile-app body.mobile-playing .app-main {
  padding-top: var(--sv-safe-top);
}

html.mobile-app body.mobile-playing .hero,
html.mobile-app body.mobile-playing .content-section {
  display: none;
}

html.mobile-app body.mobile-playing .player-theater {
  position: fixed;
  inset: 0;
  z-index: 200;
  margin: 0;
  padding: calc(0.75rem + var(--sv-safe-top)) 0.75rem calc(0.75rem + var(--sv-safe-bottom));
  border: none;
  border-radius: 0;
  display: flex !important;
  flex-direction: column;
  background: #000;
}

html.mobile-app body.mobile-playing .player-theater video,
html.mobile-app body.mobile-playing #player {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1;
  min-height: 220px;
  object-fit: contain;
  background: #000;
}

html.mobile-app body.mobile-playing .player-theater h2 {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.mobile-app body.mobile-playing .play-status,
html.mobile-app body.mobile-playing #play-status {
  flex-shrink: 0;
  text-align: center;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  color: #7eb8ff;
  min-height: 1.25rem;
}

html.mobile-app body.mobile-playing #player {
  flex: 1;
  max-height: none;
  min-height: 200px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

html.mobile-app body.mobile-playing .plyr {
  flex: 1;
  min-height: 200px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

html.mobile-app body.mobile-playing .plyr__video-wrapper {
  flex: 1;
  min-height: 180px;
}

html.mobile-app body.mobile-playing .plyr__video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

html.mobile-app body.mobile-playing .player-actions {
  margin-top: 0.75rem;
}

html.mobile-app body.mobile-playing .player-actions .btn-ghost {
  width: 100%;
  min-height: 48px;
  font-size: 0.95rem;
}

/* Default: hide mobile-only elements on desktop */
.mobile-only {
  display: none !important;
}

.mobile-tab-bar {
  display: none;
}
