/* Estilos generales */
body {
  font-family: "Roboto", sans-serif; /* Usando la fuente de Google Fonts si la añades */
  margin: 0;
  background-color: #f8f9fa; /* Fondo más claro */
  color: #343a40;
  line-height: 1.6;
}

header {
  background-color: #333;
  color: white;
  padding: 15px 20px;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

header h1 {
  margin: 0;
  flex-grow: 1;
  text-align: left;
}

header nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

header nav ul li a {
  color: white;
  text-decoration: none;
  padding: 10px 15px;
  border-radius: 5px;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

header nav ul li a:hover {
  background-color: #555;
  transform: translateY(-2px);
}

/* New: Cart counter style */
.cart-counter {
  background-color: #dc3545; /* Red background */
  color: white;
  border-radius: 50%; /* Circular shape */
  padding: 2px 7px;
  font-size: 0.8em;
  vertical-align: super; /* Aligns it slightly higher */
  margin-left: 5px; /* Space from "Carrito" text */
  display: none; /* Hidden by default when 0 items */
}

/* Styles for secondary button, if not already defined */
.btn-secondary {
  background-color: #6c757d; /* A neutral color */
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
  text-decoration: none; /* In case it's an <a> tag */
  display: inline-block; /* Allows padding and margin */
  text-align: center;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

/* Add some margin to the clear cart button in the cart page */
#cart-section #clear-cart-btn {
  margin-top: 10px; /* Add margin for better spacing on smaller screens */
}

/* Adjustments for filter in header of tienda.html */
header .filter-controls {
  margin-left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

header .filter-controls label {
  color: white;
}

header .filter-controls select {
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid #ddd;
  background-color: white;
  font-size: 0.9em;
  cursor: pointer;
}

header .filter-controls select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Main content styling */
main {
  padding: 20px;
  max-width: 1200px;
  margin: 20px auto;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h2 {
  color: #007bff;
  text-align: center;
  margin-bottom: 30px;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
}

/* Hero Section (Homepage) */
#hero-section {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, #007bff, #00c6ff);
  color: white;
  border-radius: 8px;
  margin-bottom: 30px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.hero-content h2 {
  color: white;
  font-size: 2.5em;
  margin-bottom: 15px;
}

.hero-content p {
  font-size: 1.2em;
  max-width: 700px;
  margin: 0 auto 30px;
}

.btn-primary {
  display: inline-block;
  background-color: #ffc107;
  color: #343a40;
  padding: 12px 25px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-primary:hover {
  background-color: #e0a800;
  transform: translateY(-2px);
}

/* About Us Section (Homepage) */
.content-section {
  padding: 40px 0;
}

.about-us-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.about-us-item {
  background-color: #f0f8ff; /* Light blue background */
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease;
}

.about-us-item:hover {
  transform: translateY(-5px);
}

.about-us-item h3 {
  color: #007bff;
  margin-top: 15px;
  margin-bottom: 10px;
}

/* Category Cards (Homepage) */
#category-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.category-card {
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.category-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.category-card h3 {
  color: #333;
  padding: 15px 10px 5px;
  margin: 0;
}

.category-card p {
  padding: 0 15px 15px;
  color: #666;
  font-size: 0.9em;
}

.category-card .btn-secondary {
  margin-bottom: 15px;
  padding: 8px 18px;
  font-size: 0.9em;
}

/* Features Section (Homepage) */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.feature-item {
  background-color: #e6f7ff; /* Lighter blue */
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
}

.feature-item:hover {
  background-color: #d0eeff;
}

.feature-item img {
  width: 50px;
  height: 50px;
  margin-bottom: 15px;
}

.feature-item h3 {
  color: #007bff;
  margin-bottom: 10px;
}

.feature-item p {
  color: #555;
  font-size: 0.9em;
}

/* Product List (Shop Page) */
#products-container {
  padding: 20px 0;
}

#product-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.product-card {
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.product-card h3 {
  color: #333;
  margin-top: 0;
  margin-bottom: 10px;
}

.product-category {
  color: #6c757d;
  font-size: 0.9em;
  margin-bottom: 15px;
}

.product-presentations {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.presentation-select,
.product-quantity {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1em;
  box-sizing: border-box; /* Include padding in width */
}

.product-quantity {
  text-align: center;
  appearance: textfield; /* Standard property for compatibility */
  -moz-appearance: textfield; /* Hide arrows in Firefox */
}

/* Hide arrows in Chrome, Safari, Edge */
.product-quantity::-webkit-outer-spin-button,
.product-quantity::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.add-to-cart-btn {
  background-color: #28a745; /* Green button */
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
  width: 100%; /* Make button full width */
}

.add-to-cart-btn:hover {
  background-color: #218838;
}

/* Cart Page Styling */
#cart-section {
  padding: 20px 0;
}

#cart-items {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  min-height: 100px; /* Ensure some height even if empty */
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
  font-size: 1.1em;
  flex-wrap: wrap; /* Allow items to wrap on small screens */
  gap: 10px; /* Space between elements */
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item span {
  flex-grow: 1;
}

.cart-item .quantity-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cart-item .quantity-controls button {
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.2s ease;
}

.cart-item .quantity-controls button:hover {
  background-color: #0056b3;
}

.cart-item .item-quantity {
  min-width: 25px; /* Ensure quantity display has enough space */
  text-align: center;
}

.cart-item .remove-from-cart-btn {
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s ease;
  margin-left: 10px; /* Space from quantity controls */
}

.cart-item .remove-from-cart-btn:hover {
  background-color: #c82333;
}

#cart-total {
  font-size: 1.5em;
  font-weight: bold;
  display: block;
  text-align: right;
  margin-top: 20px;
  color: #333;
}

#whatsapp-order-btn,
#clear-cart-btn,
#continue-shopping-btn {
  margin-top: 15px;
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: bold;
  transition: background-color 0.3s ease;
  display: inline-block;
  width: auto;
  text-align: center;
  margin-right: 10px; /* Space between buttons */
}

#whatsapp-order-btn {
  background-color: #25d366; /* WhatsApp green */
  color: white;
  border: none;
}

#whatsapp-order-btn:hover {
  background-color: #1da851;
}

#clear-cart-btn {
  background-color: #6c757d; /* Grey */
  color: white;
  border: none;
}

#clear-cart-btn:hover {
  background-color: #5a6268;
}

#continue-shopping-btn {
  background-color: #007bff;
  color: white;
  border: none;
  text-decoration: none; /* In case it's an anchor */
}

#continue-shopping-btn:hover {
  background-color: #0056b3;
}

/* Footer */
footer {
  background-color: #333;
  color: white;
  text-align: center;
  padding: 15px 20px;
  margin-top: 30px;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  header nav ul {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-top: 10px;
    gap: 5px;
  }

  header nav ul li a {
    width: calc(100% - 30px); /* Adjust for padding */
    text-align: left;
  }

  header .filter-controls {
    margin-left: 0;
    margin-top: 15px;
    width: 100%;
    justify-content: center;
  }

  #product-list,
  .about-us-grid,
  #category-cards-container,
  .features-grid {
    grid-template-columns: 1fr; /* Single column layout on small screens */
  }

  .cart-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .cart-item span,
  .cart-item .quantity-controls,
  .cart-item .item-total,
  .cart-item .remove-from-cart-btn {
    width: 100%;
    text-align: left;
  }

  .cart-item .quantity-controls {
    justify-content: flex-start;
    margin-top: 5px;
  }

  #whatsapp-order-btn,
  #clear-cart-btn,
  #continue-shopping-btn {
    width: calc(100% - 20px); /* Full width minus padding */
    margin-right: 0;
    margin-bottom: 10px; /* Space between stacked buttons */
  }
}
