:root {
  --color-primario: #0F0E0E;
  --color-secundario: #1F1F1F;
  --color-buttonAgregar: #2b96ff;
  --color-buttonAgregar-hover: #00D4FF;
  --color-texto-claro: #FFFFFF;
  --color-texto-oscuro: #E4F1FE;
  --color-product-bg: #2E2E2E;
  --color-border-claro: #00F5FF;
  --color-border-verde: #00FF7F;
  --color-button-marcado: #00FF7F;
  --color-button-borrado: #FF073A;
  --color-button-borrado-hover: #FF0033;
  --shadow-default: 0 4px 15px rgba(0, 245, 255, 0.3);
  --shadow-buttonAgregar: 0 0 10px rgba(0, 245, 255, 0.7);
  --shadow-borrado: 0 0 8px rgba(255, 7, 58, 0.6);
  --border-radius-default: 12px;
  --border-radius-small: 8px;
  --border-radius-xsmall: 4px;
  --transition-default: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

body {
  background-color: var(--color-primario);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Merriweather', sans-serif;
  padding-top: 3rem;
  color: var(--color-texto-claro);
}

.contenedorPrimario, .contenedorListas {
  width: 90%;
  max-width: 37.5rem;
}

.contenedorPrimario {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--color-secundario);
  padding: 0.625rem 1.25rem;
  border-radius: var(--border-radius-default);
  box-shadow: var(--shadow-default);
}

.contenedorTotal, .cabeceraLista, .controlesLista, .productoCreado div {
  display: flex;
  align-items: center;
}

.contenedorTotal, .cabeceraLista {
  justify-content: space-between;
}

.sumaTotal, .sumaLista {
  font-weight: bold;
  color: var(--color-texto-claro);
}

.sumaTotal {
  font-size: 1.5rem;
}

#botonNuevaLista, .botonAgregarProducto {
  background-color: var(--color-buttonAgregar);
  color: var(--color-texto-claro);
  font-weight: 700;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: var(--transition-default);
}

#botonNuevaLista {
  font-size: 1rem;
  padding: 0.625rem 1.25rem;
}

#botonNuevaLista:hover, .botonAgregarProducto:hover {
  background-color: var(--color-buttonAgregar-hover);
}

.contenedorListas {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.listaCompras {
  background: var(--color-secundario);
  padding: 1.25rem;
  border-radius: var(--border-radius-default);
  box-shadow: var(--shadow-default);
}

.tituloLista {
  margin: 0;
  color: var(--color-texto-oscuro);
  outline: none;
}

.controlesLista {
  gap: 1rem;
}

.botonEliminarLista, .botonEliminar {
  background-color: var(--color-button-borrado);
  color: var(--color-texto-claro);
  border: none;
  padding: 0.3125rem 0.625rem;
  border-radius: var(--border-radius-xsmall);
  cursor: pointer;
  transition: var(--transition-default);
}

.botonEliminarLista:hover, .botonEliminar:hover {
  background-color: var(--color-button-borrado-hover);
}

.botonIncluir {
  border: none;
  padding: 0.3125rem 0.625rem;
  border-radius: var(--border-radius-xsmall);
  cursor: pointer;
  transition: var(--transition-default);
}

.botonIncluir.incluido {
  background-color: var(--color-button-marcado);
}

.botonIncluir.excluido {
  background-color: var(--color-button-borrado);
}

.contenedorInputBoton {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.inputProducto {
  flex-grow: 1;
  padding: 0.625rem;
  border-radius: var(--border-radius-small);
  border: 0.125rem solid var(--color-border-claro);
}

.botonAgregarProducto {
  font-size: 1.2rem;
  padding: 0 1rem;
}

.listaProductos {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.lista-cerrada {
  max-height: 3.75rem;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.lista-abierta {
  max-height: 50rem;
  transition: max-height 0.3s ease;
}

.cabeceraLista {
  cursor: pointer;
}

.lista-cerrada .contenedorInputBoton,
.lista-cerrada .listaProductos {
  pointer-events: none;
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
}

.lista-abierta .contenedorInputBoton,
.lista-abierta .listaProductos {
  pointer-events: all;
  opacity: 1;
  height: auto;
  transition: opacity 0.3s ease;
}

.productoCreado {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem;
  border-radius: var(--border-radius-small);
  border: 0.0625rem solid var(--color-border-verde);
  background: var(--color-product-bg);
  animation: slideIn 0.5s ease-out forwards;
}

.productoCreado span {
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  margin-right: 0.625rem;
  line-height: 1.25rem;
}

.productoCreado div {
  gap: 0.625rem;
  flex-shrink: 0;
}

.inputPrecio, .inputCantidad {
  padding: 0.3125rem;
  border-radius: var(--border-radius-xsmall);
  border: 0.0625rem solid var(--color-border-claro);
}

.inputPrecio {
  width: 6.25rem;
}

.inputCantidad {
  width: 3.125rem;
}

.botonMarcado, .botonDesmarcado {
  border: none;
  padding: 0.3125rem 0.625rem;
  border-radius: var(--border-radius-xsmall);
  cursor: pointer;
  transition: var(--transition-default);
}

.botonMarcado {
  background-color: var(--color-button-marcado);
  color: var(--color-texto-claro);
}

.botonDesmarcado {
  background-color: var(--color-texto-claro);
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-1.25rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  body {
    width: 100%;
  }

  .contenedorPrimario, .contenedorListas {
    width: 95%;
    max-width: 95%;
  }

  .productoCreado {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }

  .productoCreado div {
    width: 100%;
    justify-content: space-between;
  }
  
  .tituloLista {
    max-width: 40%;
  }
  
  .inputPrecio {
    width: 5.625rem;
  }

  .inputCantidad {
    width: 2.1875rem;
  }
}