/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f9f9f9;
  color: #333;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Barra superior */
.top-bar {
  background-color: #e6e6fa;
  color: #333;
  text-align: center;
  padding: 12px 0;
  font-size: 1rem;
  height: auto;
  overflow: hidden;
  position: relative;
  width: 100%;
  min-height: 40px; /* fuerza una altura mínima */
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-bar p {
  white-space: nowrap;
  animation: scrollText 15s ease-in-out infinite;
  position: relative;
  margin: 0;
}

@keyframes scrollText {
  0% {
    transform: translateX(100%);
  }
  40% {
    transform: translateX(0%);
  }
  60% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-100%);
  }
}

.top-link {
  color: #6a5acd;
  font-weight: bold;
  text-decoration: underline;
}

.top-link:hover {
  color: #483d8b;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #2c3e50;
}

.search-bar {
  flex: 1;
  margin: 0 20px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
}

.icons a {
  margin-left: 15px;
  font-size: 1.2rem;
  text-decoration: none;
  color: #2c3e50;
}

/* Navegación */
nav {
  background-color: #fff;
  border-bottom: 1px solid #ddd;
}

nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
}

nav ul li {
  margin: 0 15px;
  position: relative;
}

nav ul li a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 10px;
  display: block;
}

nav ul li a:hover {
  color: #6a5acd;
}

/* Submenús */
nav ul li.has-submenu {
  position: relative;
}

nav ul li.has-submenu .submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-width: 140px;
  z-index: 10;
}

nav ul li.has-submenu:hover .submenu {
  display: block;
}

nav ul li.has-submenu .submenu li {
  margin: 0;
}

nav ul li.has-submenu .submenu a {
  display: block;
  padding: 8px 12px;
  color: #333;
  text-decoration: none;
  font-weight: 400;
}

nav ul li.has-submenu .submenu a:hover {
  background-color: #f2f2f2;
}

/* Estilo especial para Rebajas */
nav ul li.rebajas > a {
  color: red;
  font-weight: bold;
}

/* Sección promocional */
.promo-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background-color: #fff;
  flex-wrap: wrap;
}

.promo-box {
  width: 180px;
  background-color: #fff;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.9rem;
}

.promo-box.right {
  background-color: #ffe5b4;
}

.promo-box.right h3,
.promo-box.right p {
  font-family: 'Georgia', serif;
  font-weight: bold;
  font-style: italic;
}

.promo-box.left {
  background-color: #f2f2f2;
}

.cta-button {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 15px;
  background-color: #6a5acd;
  color: #fff;
  border: none;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
}

.cta-button:hover {
  background-color: #483d8b;
}

/* Carrusel */
.carousel-container {
  position: relative;
  width: 400px;
  height: 250px;
  overflow: hidden;
  border-radius: 8px;
}

.carousel-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.carousel-image.active {
  opacity: 1;
  z-index: 1;
}

/* Productos */
main h2 {
  text-align: center;
  margin: 30px 0 20px;
  color: #2c3e50;
}
h2 {
  text-align: center;
  font-size: 1.4rem;
  margin: 40px 0 20px;
  color: #2c3e50;
}


.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  padding: 0 30px 30px;
}

.product-card {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  transition: transform 0.2s ease;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.product-card img {
  max-width: 100%;
  border-radius: 5px;
}

.product-card h3 {
  margin: 10px 0;
  font-size: 1.1rem;
}

.product-card p {
  color: #6a5acd;
  font-weight: bold;
}

.product-card button {
  background-color: #6a5acd;
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  margin-top: 10px;
}

.product-card button:hover {
  background-color: #483d8b;
}

/* Footer */
footer {
  background-color: #2c3e50;
  color: #fff;
  text-align: center;
  padding: 20px;
  margin-top: auto;
}

.footer-links {
  margin-bottom: 10px;
}

.footer-links a {
  color: #fff;
  margin: 0 10px;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Responsive para pantallas menores a 768px */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }

  .search-bar {
    width: 100%;
    margin: 10px 0;
  }

  .icons {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
  }

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

  .product-card h3 {
    font-size: 1rem;
  }

  .product-card p {
    font-size: 0.9rem;
  }

  footer {
    font-size: 0.9rem;
    padding: 15px;
  }

  .footer-links a {
    display: block;
    margin: 5px 0;
  }

  .carousel-container {
    width: 100%;
    height: 200px;
  }

  .promo-box {
    width: 100%;
    margin-bottom: 10px;
  }
}

/* Responsive para pantallas menores a 480px */
@media (max-width: 480px) {
  .cta-button {
    font-size: 0.8rem;
    padding: 6px 12px;
  }

  .product-card button {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}
