/* ===============================
   Estilos para Detalles de Películas - Responsive y Moderno
   =============================== */

/* Ocultar el header en la página de detalles */
.movie-detail-page ~ header,
body:has(.movie-detail-page) header {
  display: none;
}

/* Reset para la página de detalles */
.movie-detail-page * {
  box-sizing: border-box;
}

/* Movie Detail Page Container */
.movie-detail-page {
  min-height: 100vh;
  background: var(--bg-color, #0f0f23);
  color: var(--text-color, #ffffff);
  margin: 0;
  padding: 0;
  position: relative;
  width: 100vw;
  overflow-x: hidden;
  max-width: 100%;
}

/* Hero Section */
.movie-hero {
  position: relative;
  width: 100%;
  height: 90vh;
  min-height: 70vh;
  background-color: #1a1a2e;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  align-items: flex-end;
  padding: 0;
  overflow: hidden;
}

/* Fallback para cuando no hay imagen */
.movie-hero:not([style*="background-image"]) {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Overlay para mejorar legibilidad del texto */
.movie-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.5) 50%,
    rgba(0, 0, 0, 0.8) 100%
  );
  z-index: 1;
}

.hero-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 3;
  padding: 0 2rem 2rem 2rem;
}

/* Back Button */
.back-button {
  position: absolute;
  top: 2rem;
  left: 2rem;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(15px);
  z-index: 4;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.back-button i {
  font-size: 1.1rem;
}

/* Hero Info Layout */
.hero-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: end;
}

.movie-poster {
  position: relative;
}

.poster-image {
  width: 300px;
  height: auto;
  border-radius: 15px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
}

.poster-image:hover {
  transform: scale(1.05);
}

/* Movie Main Info */
.movie-main-info {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.movie-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin: 0 0 1rem 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  line-height: 1.1;
}

.movie-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 500;
}

.rating {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 193, 7, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.rating i {
  color: #ffc107;
}

/* Genres */
.genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.genre-tag {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.movie-overview {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 600px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.director-info {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
}

/* Movie Details Content */
.movie-details-content {
  background: var(--bg-color, #0f0f23);
  padding: 4rem 0;
  position: relative;
  z-index: 2;
  border-radius: 2rem 2rem 0 0;
  margin-top: -1rem;
}

.details-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  box-sizing: border-box;
}

/* Sections */
.cast-section, .production-section, .similar-section {
  margin-bottom: 4rem;
}

.cast-section h2, .production-section h2, .similar-section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--accent-color, #4fc3f7);
}

/* Cast Grid */
.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.cast-member {
  text-align: center;
  transition: transform 0.3s ease;
}

.cast-member:hover {
  transform: translateY(-5px);
}

.cast-member img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.cast-member h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.5rem 0 0.3rem 0;
}

.cast-member p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

/* Production Grid */
.production-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.production-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.production-item strong {
  display: block;
  color: var(--accent-color, #4fc3f7);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.production-item span {
  font-size: 1.1rem;
  font-weight: 500;
}

/* Similar Movies Grid */
.similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.similar-movie {
  transition: transform 0.3s ease;
}

.similar-movie:hover {
  transform: translateY(-5px);
}

.similar-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.similar-movie img {
  width: 100%;
  height: 225px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.similar-movie:hover img {
  transform: scale(1.05);
}

.similar-movie h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.5rem 0 0.3rem 0;
  line-height: 1.3;
}

.similar-rating {
  font-size: 0.8rem;
  color: #ffc107;
  font-weight: 500;
}

/* Loading and Error States */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 1rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--accent-color, #4fc3f7);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  gap: 1rem;
  padding: 2rem;
}

.error-icon {
  font-size: 3rem;
  color: #f44336;
  margin-bottom: 1rem;
}

.error h3 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--text-color, #ffffff);
}

.error p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.retry-button {
  background: var(--accent-color, #4fc3f7);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.retry-button:hover {
  background: var(--accent-hover, #29b6f6);
  transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .movie-hero {
    height: 70vh;
    min-height: 60vh;
    background-attachment: scroll;
  }
  
  .hero-content {
    padding: 0 1rem 2rem 1rem;
  }

  .back-button {
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .hero-info {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .poster-image {
    width: 200px;
    margin: 0 auto;
  }

  .movie-title {
    font-size: 2.5rem;
  }

  .movie-meta {
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
  }

  .cast-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .production-grid {
    grid-template-columns: 1fr;
  }

  .similar-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .details-container {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .movie-hero {
    height: 65vh;
  }
  
  .hero-content {
    padding: 0 1rem 1.5rem 1rem;
  }

  .movie-title {
    font-size: 2rem;
  }

  .movie-overview {
    font-size: 1rem;
  }

  .poster-image {
    width: 150px;
  }

  .cast-grid, .similar-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
  
  .back-button {
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Ajustes para diferentes ratios de pantalla */
@media (max-aspect-ratio: 4/3) {
  .movie-hero {
    height: 80vh;
  }
}

@media (max-aspect-ratio: 1/1) {
  .movie-hero {
    height: 70vh;
  }
}

/* Ajustes para pantallas muy anchas */
@media (min-aspect-ratio: 21/9) {
  .movie-hero {
    height: 90vh;
  }
}

/* Dark Mode Support */
.modo-oscuro .movie-detail-page {
  background: #0a0a0a;
  color: #ffffff;
}

.modo-oscuro .production-item {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.modo-oscuro .genre-tag {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}
