/* ======================================================
   XTREAMFLIX - NETFLIX DESIGN SYSTEM (VANILLA CSS PRO)
   ====================================================== */

:root {
  --bg-dark: #0f0f12;
  --bg-card: #18181d;
  --bg-surface: #25252e;
  --red-netflix: #e50914;
  --red-hover: #b81d24;
  --red-glow: rgba(229, 9, 20, 0.4);
  --text-white: #ffffff;
  --text-gray: #aaaaaa;
  --text-dim: #737373;
  --glass-bg: rgba(20, 20, 25, 0.85);
  --glass-border: rgba(255, 255, 255, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition-fast: 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-normal: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-white);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Regla Maestra de Ocultación de Elementos */
.hidden {
  display: none !important;
}

.red-text { color: var(--red-netflix); }
.cursor-pointer { cursor: pointer; }
.text-muted { color: var(--text-gray); font-size: 0.85rem; }
.w-100 { width: 100%; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.p-4 { padding: 16px !important; }
.text-center { text-align: center; }

/* Badges Contador de Contenido */
.counter-badge {
  background: rgba(229, 9, 20, 0.25);
  color: #ff8080;
  border: 1px solid rgba(229, 9, 20, 0.5);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  margin-left: 6px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0f0f12;
}
::-webkit-scrollbar-thumb {
  background: #2a2a35;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #e50914;
}

/* ======================================================
   PANTALLA DE LOGIN NETFLIX
   ====================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-image: linear-gradient(to bottom, rgba(15,15,18,0.7), rgba(15,15,18,0.95)), 
                    url('https://assets.nflxext.com/ffe/siteui/vlv3/5940708f-266a-49c7-8734-2980feb3fc38/d5b583f6-4f4a-4d2c-96b6-89d81d227b68/US-es-20240219-POP_SIGNUP_TWO_WEEKS-perspective_WEB_df2c3e14-2d07-4e6f-a82f-87063d8650df_large.jpg');
  background-size: cover;
  background-position: center;
}

.login-header {
  position: absolute;
  top: 28px;
  left: 48px;
}

.logo-brand {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text-white);
  user-select: none;
  text-shadow: 0 0 20px rgba(229, 9, 20, 0.5);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(18, 18, 22, 0.85);
  backdrop-filter: blur(20px);
  padding: 44px 38px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(229, 9, 20, 0.15);
  border: 1px solid var(--glass-border);
}

.login-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-gray);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.4;
}

.alert-box {
  background: rgba(229, 9, 20, 0.2);
  border: 1px solid var(--red-netflix);
  color: #ff8080;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.input-group {
  position: relative;
  margin-bottom: 18px;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-gray);
}

.input-group input {
  width: 100%;
  background: #25252e;
  border: 1px solid #383845;
  border-radius: var(--radius-sm);
  padding: 14px 14px 14px 44px;
  color: white;
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.input-group input:focus {
  outline: none;
  background: #2a2a35;
  border-color: var(--red-netflix);
  box-shadow: 0 0 12px var(--red-glow);
}

.remember-row {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-gray);
  margin-bottom: 24px;
}

.remember-row label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.remember-row input[type="checkbox"] {
  accent-color: var(--red-netflix);
  width: 16px;
  height: 16px;
}

.btn-netflix {
  width: 100%;
  background: linear-gradient(135deg, #e50914, #b81d24);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.4);
}

.btn-netflix:hover {
  background: linear-gradient(135deg, #f40612, #e50914);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(229, 9, 20, 0.6);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ======================================================
   CABECERA Y NAVEGACIÓN NETFLIX
   ====================================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  z-index: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 48px;
  background: linear-gradient(to bottom, rgba(15,15,18,0.95), transparent);
  transition: background 0.3s ease;
}

.app-header.scrolled {
  background: rgba(15, 15, 18, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 30px rgba(0,0,0,0.8);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 40px;
}

.main-nav {
  display: flex;
  gap: 20px;
}

.nav-btn {
  background: none;
  border: none;
  color: #cccccc;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-btn:hover, .nav-btn.active {
  color: white;
  font-weight: 800;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: #ccc;
  font-size: 0.9rem;
}

.clear-icon {
  position: absolute;
  right: 14px;
  color: #ccc;
  cursor: pointer;
  font-size: 0.9rem;
}

.search-box input {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  padding: 8px 36px;
  border-radius: 20px;
  font-size: 0.88rem;
  width: 240px;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  width: 300px;
  border-color: var(--red-netflix);
  background: black;
  box-shadow: 0 0 15px var(--red-glow);
}

.user-badge {
  position: relative;
  cursor: pointer;
}

.avatar-icon {
  font-size: 2.2rem;
  color: var(--red-netflix);
  transition: transform var(--transition-fast);
}

.user-badge:hover .avatar-icon {
  transform: scale(1.1);
}

.user-info-popup {
  position: absolute;
  top: 45px;
  right: 0;
  width: 220px;
  background: #18181d;
  border: 1px solid #333;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.9);
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 600;
}

.user-badge:hover .user-info-popup {
  display: flex;
}

.info-row {
  font-size: 0.85rem;
}

.status-green {
  color: #2ecc71;
  font-weight: 700;
}

.btn-logout {
  background: #2a2a35;
  color: white;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background var(--transition-fast);
  width: 100%;
  text-align: center;
}

.btn-logout:hover {
  background: var(--red-netflix);
}

/* ======================================================
   HERO BANNER DESTACADO (CINEMATIC)
   ====================================================== */
.app-content {
  padding-top: 84px;
  min-height: calc(100vh - 72px);
  position: relative;
  z-index: 1;
}

.app-content.has-hero {
  padding-top: 0;
}

.hero-banner {
  position: relative;
  height: 75vh;
  min-height: 520px;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: center;
  padding: 0 48px;
  transition: background-image 0.5s ease-in-out;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(15,15,18,0.98) 25%, rgba(15,15,18,0.5) 60%, rgba(15,15,18,0.98)),
              linear-gradient(to top, #0f0f12 10%, transparent 60%);
}

.hero-info {
  position: relative;
  z-index: 10;
  max-width: 650px;
  margin-top: 40px;
}

.badge-featured {
  display: inline-block;
  background: linear-gradient(135deg, #e50914, #b81d24);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px var(--red-glow);
}

.hero-title {
  font-size: 3.4rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 16px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.9);
}

.hero-overview {
  font-size: 1.05rem;
  line-height: 1.5;
  color: #dddddd;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.hero-buttons {
  display: flex;
  gap: 14px;
}

.btn-hero {
  padding: 12px 30px;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition-fast);
}

.btn-play {
  background: white;
  color: black;
  box-shadow: 0 6px 20px rgba(255,255,255,0.2);
}
.btn-play:hover {
  background: rgba(255,255,255,0.85);
  transform: translateY(-2px);
}

.btn-info {
  background: rgba(109, 109, 110, 0.7);
  color: white;
  backdrop-filter: blur(8px);
}
.btn-info:hover {
  background: rgba(109, 109, 110, 0.4);
  transform: translateY(-2px);
}

/* ======================================================
   CATEGORÍAS Y CONTENIDO EN GRID/SLIDER
   ====================================================== */
.category-bar-wrapper {
  padding: 20px 48px 12px;
  position: relative;
  z-index: 100;
  background: var(--bg-dark);
}

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

.category-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.category-section-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.5px;
}

.select-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.category-dropdown {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(32, 32, 40, 0.9);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 36px 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 320px;
  transition: all var(--transition-fast);
}

.category-dropdown:hover, .category-dropdown:focus {
  background: #2a2a38;
  border-color: var(--red-netflix);
  outline: none;
  box-shadow: 0 0 12px var(--red-glow);
}

.dropdown-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-gray);
  pointer-events: none;
  font-size: 0.8rem;
}

.category-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 12px;
  color: var(--text-gray);
  font-size: 0.85rem;
}

.category-search-wrap input {
  background: rgba(24, 24, 29, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: white;
  padding: 7px 16px 7px 34px;
  font-size: 0.85rem;
  width: 220px;
  transition: all var(--transition-fast);
}

.category-search-wrap input:focus {
  outline: none;
  border-color: var(--red-netflix);
  background: #1e1e24;
  width: 260px;
}

.category-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-behavior: smooth;
}

.chip-btn {
  background: #202028;
  color: #e5e5e5;
  border: 1px solid #333342;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-btn:hover {
  background: #333345;
  color: white;
  transform: translateY(-1px);
}

.chip-btn.active {
  background: linear-gradient(135deg, #e50914, #b81d24);
  color: white;
  border-color: #e50914;
  box-shadow: 0 4px 15px var(--red-glow);
}

.rows-container {
  padding: 0 48px 48px;
}

.netflix-row {
  margin-bottom: 44px;
}

.row-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.row-slider {
  overflow-x: auto;
  padding-bottom: 14px;
}

.slider-track {
  display: flex;
  gap: 14px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px;
  margin-top: 16px;
}

.media-card {
  flex: 0 0 180px;
  height: 270px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.media-card:hover {
  transform: translateY(-8px) scale(1.04);
  z-index: 20;
  box-shadow: 0 16px 35px rgba(229, 9, 20, 0.35);
  border-color: var(--red-netflix);
}

.card-image-wrap {
  width: 100%;
  height: 80%;
  position: relative;
  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.media-card:hover .card-image-wrap img {
  transform: scale(1.08);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.2));
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.media-card:hover .card-overlay {
  opacity: 1;
}

.play-icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--red-netflix);
  color: white;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--red-glow);
  transform: scale(0.8);
  transition: transform var(--transition-fast);
}

.media-card:hover .play-icon-btn {
  transform: scale(1);
}

.card-info {
  padding: 10px;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 0.75rem;
  color: #f1c40f;
  margin-top: 2px;
  font-weight: 700;
}

.btn-load-more {
  display: block;
  margin: 36px auto 0;
  background: linear-gradient(135deg, #25252e, #333342);
  color: white;
  border: 1px solid #444;
  padding: 14px 36px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-load-more:hover {
  background: var(--red-netflix);
  border-color: var(--red-netflix);
  box-shadow: 0 6px 20px var(--red-glow);
}

.empty-state {
  text-align: center;
  padding: 60px 0;
  color: var(--text-gray);
  font-size: 1.1rem;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 12px;
  color: var(--red-netflix);
}

/* ======================================================
   MODALES DE LA APLICACIÓN (DETALLES & REPRODUCTOR)
   ====================================================== */
.modal-overlay,
.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-overlay.hidden,
.player-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: #18181d;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 750px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid #333;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 50;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
}

.modal-banner {
  height: 300px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 24px;
}

.modal-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #18181d, transparent 70%);
}

.modal-header-content {
  position: relative;
  z-index: 10;
}

.modal-header-content h2 {
  font-size: 2rem;
  margin-bottom: 12px;
  font-weight: 800;
}

.modal-body {
  padding: 24px;
}

.modal-meta-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.meta-badge {
  background: #2a2a35;
  color: #ccc;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
}

.modal-plot {
  line-height: 1.6;
  color: #ddd;
  margin-bottom: 24px;
}

/* Reproductor Video */
.player-overlay {
  background: black;
}

.player-top-bar {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.player-top-bar button {
  pointer-events: auto;
}

.btn-player-back {
  background: rgba(0, 0, 0, 0.75);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: var(--transition-fast);
}

.btn-player-back:hover {
  background: var(--red-netflix);
  border-color: var(--red-netflix);
}

.btn-player-external {
  background: rgba(30, 30, 40, 0.85);
  color: #e5e5e5;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 10px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition-fast);
  backdrop-filter: blur(8px);
}

.btn-player-external:hover {
  background: var(--red-netflix);
  color: white;
  border-color: var(--red-netflix);
}

.player-audio-tip {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  color: #dddddd;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

.player-title-overlay {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(0,0,0,0.6);
  padding: 6px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-badge {
  background: var(--red-netflix);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
}

#netflixVideo {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
}

.player-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: rgba(10, 10, 14, 0.92);
  z-index: 50;
  color: white;
  pointer-events: none;
}

.player-loader p {
  font-size: 1.1rem;
  font-weight: 600;
  color: #dddddd;
  text-align: center;
  max-width: 80%;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--text-gray);
  gap: 16px;
}

.netflix-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(229, 9, 20, 0.2);
  border-top-color: var(--red-netflix);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 15px var(--red-glow);
}

/* Responsive UI */
@media (max-width: 768px) {
  .app-header { padding: 0 16px; }
  .header-left { gap: 12px; }
  .main-nav { display: none; }
  .hero-banner { padding: 0 16px; height: 60vh; }
  .hero-title { font-size: 2rem; }
  .rows-container, .category-bar-wrapper { padding-left: 16px; padding-right: 16px; }
  .media-card { flex: 0 0 140px; height: 210px; }
  .category-controls { flex-direction: column; align-items: stretch; }
}
