/* ==== VARIABLES ==== */
:root {
  --color-primary: #ff504d;
  --color-secondary: #00c9b7;
  --color-terciary: #ff8e43;
  --color-bg: #fffdf6;
  --color-dark: #333;
  --font-main: 'Poppins', sans-serif;
}

/* ==== RESETEO ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-dark);
  overflow-x: hidden;
}

/* ==== PRELOADER ==== */
#preloader {
  position: fixed;
  inset: 0;
  background: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid #ddd;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#preloader p {
  margin-top: 20px;
  font-weight: 600;
  color: var(--color-dark);
  text-align: center;
  line-height: 1.5;
}

/* ==== HEADER ==== */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 60px;
  background: linear-gradient(to right, var(--color-terciary), var(--color-primary));
  color: white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 999;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-container img {
  width: 75px;
  border-radius: 0;
}

.logo-container h1 {
  font-size: 32px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* ==== NAVEGACIÓN ==== */
.main-nav {
  display: flex;
  gap: 30px;
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  position: relative;
}

.main-nav a::after {
  content: "";
  position: absolute;
  width: 0%;
  height: 2px;
  background: white;
  bottom: -5px;
  left: 0;
  transition: width 0.3s;
}

.main-nav a:hover::after,
.main-nav a.active::after {
  width: 100%;
}

/* ==== USER AREA ==== */
.user-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

#loginLink {
  color: white;
  font-weight: 600;
  text-decoration: none;
}

#welcomeContainer {
  display: flex;
  align-items: center;
  justify-content: center;
}

#welcomeContainer p {
  font-size: 18px;
  font-weight: 600;
  color: white;
}

#logoutButton {
  background: none;
  border: 2px solid white;
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  margin-left: 15px;
  text-decoration: none;
}

#logoutButton:hover {
  background: white;
  color: var(--color-primary);
}

/* ==== CATÁLOGO ==== */
.catalogo {
  padding: 80px 20px;
  text-align: center;
}

.catalogo h2 {
  font-size: 42px;
  color: var(--color-primary);
  margin-bottom: 50px;
}

/* ==== CONTENEDOR DE PRODUCTOS ==== */
.productos-container {
  display: flex;
  flex-direction: column;
  gap: 80px;
  align-items: center;
  justify-content: center;
}

.categoria {
  width: 100%;
}

.categoria h2 {
  font-size: 42px;
  color: var(--color-terciary);
  margin-bottom: 40px;
}

.grid {
    padding: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 90px;
  justify-content: center;
  align-items: stretch;
}

/* ==== CARD DE PRODUCTO ==== */
.card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  text-align: center;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card a {
  text-decoration: none;
  color: var(--color-dark);
  display: block;
  height: 100%;
}

.card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.card h3 {
  font-size: 22px;
  color: var(--color-dark);
  margin-top: 10px;
  font-weight: 600;
}

.card p.price {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 18px;
  margin-top: 8px;
}

.card p.talle {
  color: #555;
  font-size: 16px;
  margin-bottom: 15px;
}

/* ==== FOOTER ==== */
.footer {
  background: #333;
  color: white;
  text-align: center;
  padding: 20px 10px;
  font-size: 14px;
}

/* ==== RESPONSIVE ==== */
@media (max-width: 768px) {
  .main-header {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 15px 20px;
  }

  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }

  .catalogo h2 {
    font-size: 32px;
  }

  .categoria h2 {
    font-size: 28px;
  }
}
