/* ===== Base / Reset ===== */
* { box-sizing: border-box; }

html { height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: #ffffff;
  font-family: 'Lato', sans-serif;
  color: #333;
}

/* ===== Layout principal ===== */
.content {
  background: #f5f5f5;
  padding: 40px;
  min-height: 100vh;
}

.container {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-areas:
    "header header"
    "sidebar grid"
    "footer footer";
  gap: 20px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Header ===== */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  margin-bottom: 0;            /* ya hay gap en el grid */
  background: #e0e0e0;
  padding: 20px;
  border-radius: 12px;
}

.header .logo {
  width: 120px;
  height: auto;
  margin: 0;
  flex-shrink: 0;
}

.textos {
  display: flex;
  flex-direction: column;
}

.header .site-title {
  font-size: 2rem;
  margin: 10px 0 5px 0;
  color: #333;
}

.header .site-description {
  font-size: 1rem;
  color: #666;
}

/* ===== Sidebar ===== */
.sidebar {
  grid-area: sidebar;
  background: rgba(240, 240, 240, 0.9);
  color: #333;
  padding: 20px;
  border-radius: 12px;
  overflow: auto;
  align-self: start;
  position: sticky;       /* se queda visible al hacer scroll */
  top: 20px;              /* separada del borde superior */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar h2 { margin-top: 0; }

.sidebar label {
  margin-top: 15px;
  display: block;
  font-weight: bold;
}

.sidebar input,
.sidebar select {
  width: 100%;
  margin-top: 5px;
  padding: 8px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  background: #fff;
}

/* sidebar menu*/
.sidebar-icons {
  position: relative;
}

.sidebar-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 8px 0;
  display: none;
  z-index: 1000;
}

.sidebar-menu-panel.open {
  display: block;
}

.sidebar-menu-panel a {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: #222;
  white-space: nowrap;
}

.sidebar-menu-panel a:hover {
  background: #f4f4f4;
}

/* ===== Grid de productos ===== */
.grid {
  grid-area: grid;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  align-items: start;
}

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

.card:hover { transform: translateY(-5px); }

.card > img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.info { padding: 10px; }

.info h3 {
  margin: 0;
  font-size: 1rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info p {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #666;
}

.icons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.icons img {
  width: 22px;
  height: 22px;
}

.empty {
  text-align: center;
  color: #333;
  margin-top: 40px;
  display: none;
}

.text-small {
  font-size: 0.6rem;
  color: #777;
}

/* ===== Card Favoritos y coleccion ===== */

.card-user-topbar {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.card-fav-btn,
.card-status-wrap {
  pointer-events: auto;
}

.card-fav-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.card-fav-btn.is-favorite {
  color: #d4a017;
}

.card-status-wrap {
  position: relative;
  display: inline-block;
}

.card-status-badge {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
}

.card-more-mark {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d32f2f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ===== Botón subir ===== */
#scrollTopButton {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  background-color: #333;
  color: white;
  border: none;
  outline: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

#scrollTopButton.show {
  opacity: 1;
  visibility: visible;
}



/* ===== Responsive ===== */
@media (max-width: 600px) {
  .content {
    margin: 0;
    padding: 20px;
  }

  .container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "grid"
      "footer";
    gap: 20px;
  }

  .header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .sidebar {
    position: relative;   /* desactiva sticky en móvil */
    top: auto;
    max-height: none;
    background: rgba(240, 240, 240, 0.95);
    width: 100%;
  }
  

}

  
  .card .thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  }



/* Botón principal reutilizable */
.btn-primary{
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.2px;
  line-height: 1;

  padding: 12px 18px;
  border: 0;
  border-radius: 12px;

  background: #333;
  color: #fff;

  cursor: pointer;

  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn-primary:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.btn-primary:active{
  opacity: .9;
}



/* Centrado y estilo del botón 'Cargar más' */
#loadMoreBtn {
  grid-column: 1 / -1;
  justify-self: center;
  margin: 24px 0;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.2px;
  line-height: 1;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: #333;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
#loadMoreBtn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
#loadMoreBtn:active { opacity: .9; }


#scrollTopButton {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  background-color: #333;
  color: white;
  border: none;
  outline: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

#scrollTopButton.show {
  opacity: 1;
  visibility: visible;
}


.sidebar-icons {
  display: flex;
  justify-content: space-between;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.btn-general {
  display: inline-block;
  padding: 12px 18px;
  background: #333;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
}

.btn-general:hover {
  background: #444;
}


.shared-header-wrap {
  position: relative;
}

.shared-user-avatar-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.shared-user-photo-top {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;

  background: #fff;
  padding: 2px;
  border: 2px solid #ddd;

  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.shared-user-photo-top:hover {
  transform: scale(1.05);
  transition: 0.2s;
}

.site-footer {
  grid-area: footer;
  padding: 18px 20px;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: #666;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.site-footer a:hover {
  color: #000;
  text-decoration: underline;
}

@media (max-width: 600px) {

  .shared-user-avatar-wrap {
    margin-left: 0;
    margin-top: 8px;
    justify-content: center;
  }
  .logo {
    width: 120px;
    height: auto;
  }

}