/* Reset y configuración base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f6fa;
}

/* Barra superior */
header {
  position: fixed;
  top: 0;
  left: 230px;
  right: 0;
  height: 80px;
  background: #1E2945;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
}

/* Botón hamburguesa */
.menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 1100;
}

/* Sidebar */
.sidebar {
  width: 230px;
  background: #1E2945;
  color: #fff;
  padding: 30px 20px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 101;
  transition: left 0.3s ease;
}

.sidebar h2 {
  font-size: 1.1rem;
  margin-bottom: 5px;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}

.sidebar input,
.sidebar select {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 5px;
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: #2d3436;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.sidebar input:focus,
.sidebar select:focus {
  outline: none;
  border-color: #0984e3;
}

.sidebar .logo {
  margin-top: auto;
  text-align: center;
}

.sidebar .logo img {
  width: 180px;
  opacity: 0.9;
  border-radius: 20px;
}

/* Contenido principal */
.content-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 230px;
}

.main {
  flex: 1;
  padding: 120px 30px 30px;
}

/* Grid de productos */
.catalogo {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 25px;
  max-width: 1400px;
  margin: auto;
}

.card {
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.card img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
}

.card-body {
  padding: 1rem;
  text-align: center;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
  color: #2d3436;
}

.card .precio {
  font-size: 1.1rem;
  font-weight: bold;
  color: #27ae60;
  margin: 0.5rem 0;
}

.card .boton {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #0984e3;
  color: #fff;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.card .boton:hover {
  background: #74b9ff;
}

/* Footer */
.footer {
  background: #1E2945;
  color: #fff;
  text-align: center;
  padding: 15px 10px;
  font-size: 0.85rem;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.15);
}

/* Precios con descuento */
.precio {
  margin: 0.5rem 0;
}

.precio-antes {
  text-decoration: line-through;
  color: #991f1fff;
  margin-right: 8px;
  font-size: 0.9rem;
}

.precio-ahora {
  font-weight: bold;
  color: #268fafff;
  font-size: 1.1rem;
}

/* Mensajes de estado */
.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
  grid-column: 1 / -1;
}

.error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: #c53030;
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1rem;
  text-align: center;
}

.results-message {
  text-align: center;
  padding: 2rem;
  color: #666;
  grid-column: 1 / -1;
  font-style: italic;
}

.error-message {
  position: relative;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsivo */
@media (max-width: 900px) {
  .menu-toggle {
    display: block;
  }

  header {
    left: 0;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .sidebar {
    left: -230px;
  }

  .sidebar.activa {
    left: 0;
  }

  .content-wrapper {
    margin-left: 0;
  }

  .catalogo {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
  }

  .sidebar .logo img {
    width: 120px;
  }

  .main {
    padding: 120px 15px 30px;
  }
}

@media (max-width: 600px) {
  .catalogo {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  
  header h1 {
    font-size: 1.2rem;
  }
}