:root {
  --primary: #ff6b35;
  --primary-dark: #ff6b35;
  --text: #1f2937;
  --light: #f8fafc;
  --gray: #e2e8f0;
  --success: #10b981;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

header {
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  background: black;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 15px;
}

header h1 {
  color: var(--primary);
}

.header-left{
  width: fit-content;
  display: flex;
  align-items: content;
  gap: 15px;
}

.header-left img{
  width: 50px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

#search {
  padding: 10px 15px;
  border: 1px solid var(--gray);
  border-radius: 8px;
  width: 280px;
  font-size: 1rem;
}

.cart-button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .search-toggle {
    display: none;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--gray);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
  }

  .back-link {
    display: inline-flex;
    background: transparent;
    color: white;
    border: 1px solid var(--gray);
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
  }

  .main-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    margin-top: 2rem;
  }

  @media (max-width: 480px) {
    header .container {
      flex-wrap: wrap;
      gap: 10px;
      justify-content: space-between;
    }

    .header-right {
      width: 100%;
      justify-content: flex-end;
      flex-wrap: wrap;
      gap: 10px;
    }

    .search-toggle {
      display: inline-flex;
    }

    #search {
      display: none;
      width: 100%;
      max-width: 100%;
      order: 3;
    }

    .header-right.search-open {
      flex-direction: column;
      align-items: stretch;
    }

    .header-right.search-open #search {
      display: block;
      margin-top: 10px;
    }

    .cart-button {
      flex-shrink: 0;
      padding: 10px 12px;
    }
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filters ul {
  list-style: none;
}

.filters li {
  padding: 10px 8px;
  cursor: pointer;
  border-radius: 6px;
  margin-bottom: 5px;
}

.filters li:hover, .filters li.active {
  background: var(--primary);
  color: white;
}

/* Productos */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.3s;
}

.product-card:hover {
  transform: translateY(-8px);
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-info {
  padding: 1rem;
}

.product-info h3 {
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.product-info .category {
  color: var(--primary);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.product-info p {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

.add-to-cart {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

/* Paginación */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 2rem 0;
}

.pagination button {
  padding: 10px 15px;
  border: 1px solid var(--gray);
  background: white;
  border-radius: 6px;
  cursor: pointer;
}

.pagination button.active {
  background: var(--primary);
  color: white;
}

/* Modal Carrito */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.checkout-form {
  margin: 1.5rem 0;
  display: grid;
  gap: 1rem;
}

.checkout-form h3 {
  margin-bottom: 0.5rem;
}

.checkout-form label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: #334155;
}

.checkout-form input {
  padding: 10px 12px;
  border: 1px solid var(--gray);
  border-radius: 8px;
  width: 100%;
  font-size: 1rem;
}

.field-error {
  color: #dc2626;
  font-size: 0.85rem;
  min-height: 1.1em;
}

#buy-btn:disabled,
.buy-btn.disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

#cart-items {
  max-height: 400px;
  overflow-y: auto;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray);
}

.buy-btn {
  width: 100%;
  padding: 15px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  margin: 15px 0;
  cursor: pointer;
}

.close-btn{
  width: 100%;
  padding: 15px;
  background: #7e7978;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  margin: 15px 0;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 320px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}