/* --- RESET & GLOBALES --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Josefin Sans', sans-serif;
  background-color: #121212;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- HEADER --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #1b1b1b;
  height: 60px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.titulo {
  font-size: 2rem;
  color: #d00f0f;
}

.boton-carrito {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
}

.contador-carrito {
  background-color: #d00f0f;
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
  border-radius: 50%;
  padding: 2px 7px;
}

/* --- BANNER / HERO --- */
.hero {
  width: 100%;
}

.fondo {
  width: 100%;
  height: auto; 
  display: block;
}

/* --- CATÁLOGO DE PRODUCTOS --- */
.contenedor-discografia {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 25px;
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* --- TARJETA DE PRODUCTO (Flexbox sin posicionamiento absoluto rígido) --- */
.tarjetaDisco {
  background: #2a2a2a;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tarjetaDisco:hover {
  transform: translateY(-5px);
  box-shadow: 0px 6px 15px rgba(208, 15, 15, 0.3);
}

.tarjeta-imagen {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #111;
}

/* Contenido interno de la tarjeta */
.tarjeta-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
  gap: 10px;
}

.tituloDisco {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
}

.precio-tarjeta {
  font-size: 1.2rem;
  font-weight: bold;
  color: #d00f0f;
}

/* Botón de compra dentro de la tarjeta (siempre visible o integrado dentro del flujo) */
.boton-agregar {
  width: 100%;
  padding: 10px;
  background-color: #e71717;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s;
}

.boton-agregar:hover {
  background-color: #b00f0f;
}

/* --- MODAL DEL CARRITO --- */
.modal-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background-color: #1b1b1b;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
  z-index: 100;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: #0a0909;
  border-bottom: 1px solid #333;
}

.modal-header-button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.total-content {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* --- MODAL CONTENEDOR REVISADO --- */
.modal-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 720px;
  max-height: 90vh; 
  background-color: #1b1b1b;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
  z-index: 100;
  flex-direction: column;
  overflow: hidden;
}


/* 1. CROLLBAR PERSONALIZADOS (Firefox) */
.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-color: #d00f0f #121212; 
  scrollbar-width: thin; 
}

/* 2. Motores WebKit (Chrome, Safari, Edge, Brave) */
.modal-body::-webkit-scrollbar {
  width: 8px; 
}

/* Canal por donde se mueve la barra (Background) */
.modal-body::-webkit-scrollbar-track {
  background: #121212;
  border-radius: 4px;
}

/* El "cursor" o barrita deslicable */
.modal-body::-webkit-scrollbar-thumb {
  background-color: #d00f0f;
  border-radius: 4px;
  border: 2px solid #121212;
}

/* Estado hover sobre la barrita */
.modal-body::-webkit-scrollbar-thumb:hover {
  background-color: #ff1e1e;
}

/* --- FILA DEL PRODUCTO EN GRILLA (6 Columnas Alineadas) --- */
.modal-content {
  display: grid;
  grid-template-columns: 40px 1fr 70px 90px 80px 30px;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  background-color: #2a2a2a;
  border-radius: 6px;
}

/* Título con control para que no rompa la estructura */
.modal-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  text-align: left;
}

.modal-subtotal {
  font-weight: bold;
  color: #fff !important;
}

/* Precios y subtotales */
.modal-content p {
  font-size: 0.9rem;
  color: #ccc;
  margin: 0;
  text-align: center;
}

/* Contenedor de botones - y + */
.modal-cantidades {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #1b1b1b;
  padding: 4px 6px;
  border-radius: 4px;
}

.restar, .sumar {
  cursor: pointer;
  font-weight: bold;
  user-select: none;
  color: #d00f0f;
  transition: transform 0.1s;
}

.restar:hover, .sumar:hover {
  transform: scale(1.2);
}

.eliminar-unidad {
  cursor: pointer;
  text-align: center;
  user-select: none;
}

.eliminar-unidad:hover {
  opacity: 1;
}

.restar, .sumar, .eliminar-unidad {
  cursor: pointer;
  padding: 2px 8px;
  user-select: none;
}

/* --- ESTILOS DE LA MINIATURA --- */
.modal-img-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}


.modal-footer {
  padding: 15px 20px;
  background-color: #0a0909;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #333;
}

.finalizar-compra {
  background-color: #d00f0f;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.finalizar-compra:hover {
  background-color: #a00b0b;
}

/* --- FOOTER --- */
.pie {
  height: 50px;
  background-color: #1b1b1b;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: auto;
}

.youtube img {
  display: block;
  transition: transform 0.2s;
}

.youtube img:hover {
  transform: scale(1.1);
}


/* --- RESPONSIVE MOBILE (Hasta 600px) --- */
@media (max-width: 600px) {
 .modal-container {
    width: 95%;
  }

  .modal-body {
    padding: 10px 6px;
    gap: 8px;
  }

  /* 5 Columnas en Mobile (Ocultamos precio unitario) */
  .modal-content {
    grid-template-columns: 35px 1fr 75px 65px 25px;
    gap: 6px;
    padding: 8px 10px;
  }

  .modal-img-thumb {
    width: 35px;
    height: 35px;
  }

  .modal-content h3 {
    font-size: 0.8rem;
  }

  /* Ocultar columna de precio unitario solo en mobile */
  .modal-content p:nth-of-type(1) {
    display: none;
  }

  .modal-cantidades {
    padding: 2px 4px;
    gap: 4px;
    font-size: 0.75rem;
  }

  .modal-subtotal {
    font-size: 0.8rem;
  }

  /* La X centrada */
  .eliminar-unidad {
    font-size: 0.85rem;
    text-align: center;
  }
}

/* --- ENCUADRE SOLO PARA DESKTOP (Desde 768px en adelante) --- */
@media (min-width: 768px) {
  .hero {
    height: 380px; 
    overflow: hidden;
  }

  .fondo {
    height: 100%;
    object-fit: cover;
    object-position: center 25%; 
  }
}