* {
  box-sizing: border-box;
}

:root {
  --fondo: linear-gradient(to bottom, #f8fafc, #e2e8f0);
  --texto: #1f2937;
  --texto-secundario: #4b5563;
  --titulo: #111827;
  --borde: #cbd5e1;
  --blanco: #ffffff;
  --sombra: 0 8px 22px rgba(0, 0, 0, 0.12);
  --sombra-hover: 0 14px 28px rgba(0, 0, 0, 0.16);
  --favorito: #f59e0b;
  --favorito-hover: #d97706;
  --eliminar: #dc2626;
  --eliminar-hover: #b91c1c;
  --boton: #334155;
  --boton-hover: #1e293b;
  --bloque-favoritas: #fff7ed;
  --borde-favoritas: #fdba74;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
}

.cabecera {
  text-align: center;
  padding: 40px 20px 25px;
}

.cabecera h1 {
  margin: 0;
  font-size: 46px;
  font-weight: 700;
  color: var(--titulo);
}

.intro {
  margin: 14px auto 25px;
  font-size: 20px;
  color: var(--texto-secundario);
  max-width: 850px;
}

.buscador-contenedor {
  display: flex;
  justify-content: center;
}

#buscador {
  width: 100%;
  max-width: 520px;
  padding: 14px 18px;
  font-size: 18px;
  border: 1px solid var(--borde);
  border-radius: 14px;
  outline: none;
  background-color: var(--blanco);
  transition: 0.3s;
}

#buscador:focus {
  border-color: #64748b;
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.15);
}

.contenedor-principal {
  width: 95%;
  max-width: 1500px;
  margin: 0 auto 40px;
}

.bloque {
  margin-bottom: 38px;
  padding: 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
}

.bloque-resultados {
  border: 1px solid #dbe4ee;
}

.bloque-favoritas {
  background: var(--bloque-favoritas);
  border: 2px solid var(--borde-favoritas);
}

.titulo-seccion {
  margin-bottom: 22px;
}

.titulo-seccion h2 {
  margin: 0 0 8px;
  font-size: 30px;
  color: var(--titulo);
}

.titulo-seccion p {
  margin: 0;
  font-size: 17px;
  color: var(--texto-secundario);
}

.contenedor-peliculas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.tarjeta {
  width: 280px;
  background: var(--blanco);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--sombra);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tarjeta:hover {
  transform: translateY(-6px);
  box-shadow: var(--sombra-hover);
}

.imagen-contenedor {
  width: 100%;
  height: 390px;
  background-color: #e5e7eb;
  overflow: hidden;
}

.imagen-contenedor img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.contenido-tarjeta {
  padding: 18px;
}

.contenido-tarjeta h3 {
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.3;
  color: var(--titulo);
  min-height: 52px;
}

.contenido-tarjeta p {
  margin: 10px 0;
  font-size: 16px;
  color: #374151;
}

.acciones {
  display: flex;
  margin-top: 16px;
}

.boton {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--blanco);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.boton:hover {
  transform: scale(1.02);
}

.boton-favorita {
  background-color: var(--favorito);
}

.boton-favorita:hover {
  background-color: var(--favorito-hover);
}

.boton-guardada {
  background-color: var(--boton);
}

.boton-guardada:hover {
  background-color: var(--boton-hover);
}

.boton-eliminar {
  background-color: var(--eliminar);
}

.boton-eliminar:hover {
  background-color: var(--eliminar-hover);
}

.mensaje {
  width: 100%;
  text-align: center;
  font-size: 20px;
  color: var(--texto-secundario);
  margin-top: 20px;
}

.error {
  color: #b91c1c;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  .cabecera h1 {
    font-size: 34px;
  }

  .intro {
    font-size: 18px;
  }

  #buscador {
    font-size: 16px;
  }

  .titulo-seccion h2 {
    font-size: 25px;
  }

  .tarjeta {
    width: 240px;
  }

  .imagen-contenedor {
    height: 340px;
  }

  .contenido-tarjeta h3 {
    font-size: 18px;
    min-height: 46px;
  }

  .contenido-tarjeta p {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .cabecera {
    padding: 30px 15px 20px;
  }

  .cabecera h1 {
    font-size: 28px;
  }

  .intro {
    font-size: 16px;
  }

  .bloque {
    padding: 18px;
  }

  .tarjeta {
    width: 100%;
    max-width: 320px;
  }

  .imagen-contenedor {
    height: 360px;
  }
}