/* ============================================================
   Kuro Stream — Web App Specific Styles
   ============================================================ */

/* Shimmer / Skeleton Loader */
.shimmer {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes loading-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Home Hero Banner */
.hero-banner {
  position: relative;
  min-height: 450px;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 40px;
  box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
  transition: opacity 0.5s;
}

.hero-banner-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
  padding: 0;
}

.hero-banner-title {
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-banner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.hero-banner-score {
  background: rgba(229, 9, 20, 0.2);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  border: 1px solid rgba(229, 9, 20, 0.4);
}

.hero-banner-genres {
  font-size: 13px;
}

.hero-banner-synopsis {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.hero-banner-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Hero Carousel */
.hero-carousel {
  position: relative;
  margin-bottom: 40px;
}

.hero-carousel .hero-banner {
  margin-bottom: 0;
}

.hero-carousel-slide {
  display: none;
}

.hero-carousel-slide.active {
  display: flex;
}

.hero-banner-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--surface-3) 0%, var(--black) 70%);
}

.hero-banner-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 40px 24px;
}

.hero-banner-poster {
  flex-shrink: 0;
  width: 260px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

.hero-banner-poster img {
  width: 100%;
  display: block;
  aspect-ratio: 1/1.42;
  object-fit: cover;
}

.carousel-dots {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 5;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: none;
  cursor: pointer;
  padding: 0;
}

.carousel-dot.active {
  background: #fff;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
}

.carousel-arrow:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.carousel-arrow.prev {
  left: 16px;
}

.carousel-arrow.next {
  right: 16px;
}

/* Horizontal Scroll Sections */
.section-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 20px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ver-todo {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.ver-todo:hover {
  color: #fff;
}

.ver-todo::after {
  content: '→';
}

.ver-todo.clear-continue::after {
  content: none;
}

.scroll-container {
  position: relative;
  margin-bottom: 40px;
}

.horizontal-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 0 24px 16px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar {
  display: none;
  height: 0;
  width: 0;
}

/* Anime Card */
.anime-card {
  flex: 0 0 180px;
  width: 180px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.anime-card:hover {
  transform: translateY(-6px);
}

.anime-card-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 142%; /* 1:1.42 aspect ratio */
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.anime-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.anime-card-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 48px;
  font-weight: 800;
  text-transform: uppercase;
}

.anime-card-score {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  color: #ffc107;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}

.anime-card-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: var(--primary);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.anime-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

/* Recent Episode Card (Episodios recientes) */
.recent-card {
  flex: 0 0 190px;
  width: 190px;
  height: 115px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
  cursor: pointer;
}

.recent-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-thumb-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
}

.recent-time {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.recent-ep-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: var(--primary);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

.recent-title {
  position: absolute;
  bottom: 8px;
  right: 8px;
  left: 64px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

/* Continue Watching Card (Continuar viendo) */
.continue-card {
  flex: 0 0 160px;
  width: 160px;
  cursor: pointer;
}

.continue-thumb {
  position: relative;
  width: 100%;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-3);
}

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

.continue-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}

.continue-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.3);
}

.continue-progress-fill {
  height: 100%;
  background: var(--primary);
}

.continue-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search Page */
.search-section {
  padding: 40px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.search-bar-container {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
}

.search-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 14px 20px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2);
}

.genre-chips-container {
  margin-bottom: 35px;
}

.genre-chips-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.genre-chip:hover {
  border-color: var(--text-secondary);
  color: var(--text);
}

.genre-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

/* Grid Layout */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

@media (min-width: 576px) {
  .grid-layout {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

@media (min-width: 768px) {
  .grid-layout {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* Detail Page */
.detail-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
}

.detail-banner-bg {
  position: relative;
  height: 300px;
  background-size: cover;
  background-position: center;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  margin-bottom: -120px;
  filter: blur(18px);
  transform: scale(1.15);
}

.detail-banner-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.95) 100%);
}

.detail-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .detail-header {
    flex-direction: row;
    align-items: flex-end;
  }
}

.detail-poster-wrapper {
  flex-shrink: 0;
  width: 220px;
  align-self: center;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  border: 2px solid var(--border);
  background: var(--surface-2);
}

.detail-poster {
  width: 100%;
  display: block;
  aspect-ratio: 1/1.42;
  object-fit: cover;
}

.detail-info {
  flex: 1;
}

.detail-title {
  font-size: clamp(24px, 5vw, 38px);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 16px;
}

.detail-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.detail-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.detail-badge.score {
  background: rgba(229, 9, 20, 0.15);
  color: var(--primary);
  border-color: rgba(229, 9, 20, 0.3);
}

.detail-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.detail-genre-tag {
  background: var(--surface-3);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.detail-synopsis-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 30px;
}

.detail-synopsis-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.detail-synopsis-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.detail-extra-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
  font-size: 14px;
}

.detail-extra-item strong {
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

/* Trailer Section */
.trailer-section {
  margin-bottom: 40px;
}

.trailer-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.trailer-video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.trailer-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Trailer Modal */
.trailer-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.trailer-modal-content {
  position: relative;
  width: 100%;
  max-width: 900px;
}

.trailer-modal-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.trailer-modal-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

.trailer-modal-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Episodes Section */
.episodes-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.episodes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.episodes-title {
  font-size: 18px;
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-secondary);
}

.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.episode-btn {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.episode-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

/* Player Page */
.player-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.player-header {
  margin-bottom: 20px;
}

.player-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  cursor: pointer;
  transition: color 0.2s;
}

.player-back-btn:hover {
  color: var(--text);
}

.player-title {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
  line-height: 1.3;
}

.player-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.video-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  margin-bottom: 24px;
  aspect-ratio: 16/9;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
}

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

/* Error / Empty States */
.error-container {
  text-align: center;
  padding: 60px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 500px;
  margin: 40px auto;
}

.error-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.error-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Shimmer Skeletons for Home */
.skeleton-banner {
  height: 400px;
  border-radius: var(--radius);
  margin-bottom: 40px;
}

.skeleton-row {
  display: flex;
  gap: 16px;
  padding: 0 24px;
  overflow: hidden;
  margin-bottom: 40px;
}

.skeleton-card {
  flex: 0 0 180px;
  width: 180px;
  height: 256px;
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .hero-banner-inner {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }
  .hero-banner-poster {
    width: 180px;
  }
  .hero-banner-actions {
    justify-content: center;
  }
  .hero-banner-synopsis {
    -webkit-line-clamp: 2;
  }
}
