/* ==========================================================================
   DemiPlay Cinematic iOS Web App Engine — 1:1 Stitch UI Design System
   ========================================================================== */

:root {
  --bg-dark: #121414;
  --bg-black: #0a0a0a;
  --primary-cyan: #00e5cc;
  --primary-cyan-glow: rgba(0, 229, 204, 0.35);
  --secondary-violet: #8b5cf6;
  --secondary-violet-glow: rgba(139, 92, 246, 0.35);
  --accent-gold: #ffc24d;
  --card-bg: #1e2020;
  --text-main: #e2e2e2;
  --text-muted: #b9cac5;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-bg-hover: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.15);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* Reset & Base Setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  overflow-x: hidden;
  position: fixed;
  top: 0;
  left: 0;
}

#app {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(85px + var(--safe-bottom));
}

/* Utility Glassmorphism Classes */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
}

.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
}

.glass-card:active {
  transform: scale(0.96);
}

/* Top App Header Overlay */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 20px 16px 20px;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.9) 0%, rgba(18, 20, 20, 0.4) 70%, transparent 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand-title {
  font-size: 24px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-title span {
  color: var(--primary-cyan);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: #ffffff;
  cursor: pointer;
}

/* Hero Featured Banner */
.hero-container {
  position: relative;
  width: 100%;
  height: 62vh;
  min-height: 440px;
  max-height: 520px;
}

.hero-backdrop {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 20, 20, 0.2) 0%, rgba(18, 20, 20, 0.6) 60%, var(--bg-dark) 100%);
}

.hero-content {
  position: absolute;
  bottom: 24px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-cyan {
  background: var(--primary-cyan);
  color: #000000;
}

.badge-glass {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-gold {
  background: var(--accent-gold);
  color: #000000;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  color: #ffffff;
}

.hero-overview {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.75);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-btns {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.btn-primary {
  height: 44px;
  padding: 0 24px;
  border-radius: 22px;
  background: var(--primary-cyan);
  color: #000000;
  font-size: 15px;
  font-weight: 800;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 20px var(--primary-cyan-glow);
  cursor: pointer;
}

.btn-secondary {
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* Category Sections & Horizontal Scroller */
.section-container {
  padding: 24px 0 8px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 12px 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.see-all {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-cyan);
  cursor: pointer;
}

.horizontal-scroller {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 0 20px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.horizontal-scroller::-webkit-scrollbar {
  display: none;
}

.poster-card {
  flex: 0 0 115px;
  width: 115px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.poster-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
}

.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.progress-bar-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.6);
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-cyan);
  border-radius: 2px;
}

.poster-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Floating Glass Pill Navigation Bar */
.bottom-pill-nav {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 380px;
  height: 64px;
  border-radius: 32px;
  background: rgba(18, 20, 20, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 100;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-item.active {
  color: var(--primary-cyan);
  transform: translateY(-2px);
}

.nav-item .material-symbols-outlined {
  font-size: 24px;
}

/* Fullscreen Custom Video Player Modal */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000000;
  display: none;
  flex-direction: column;
}

.player-modal.active {
  display: flex;
}

.video-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(16px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)) 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.85) 100%);
  opacity: 1;
  transition: opacity 0.3s ease;
}

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

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

.player-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.player-center-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.player-btn-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-cyan);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 30px var(--primary-cyan-glow);
}

.player-bottom-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-text {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
}

.scrubber-bg {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.scrubber-fill {
  height: 100%;
  background: var(--primary-cyan);
  border-radius: 3px;
  width: 0%;
}

.next-episode-toast {
  position: absolute;
  bottom: 90px;
  right: 20px;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(18, 20, 20, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--primary-cyan);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 220;
}
