/* =========================
   CATALOGO LAYOUT
   ========================= */

.page-catalogo {
  background-color: #F4F4F4;
  min-height: 100vh;
  /* Padding extra abajo en móvil para que el footer fijo no tape el último producto */
  padding-bottom: 90px; 
}

.catalogo-layout {
  display: flex;
  min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 260px;
  background-color: #CFE2F3;
  padding: 30px 20px;
  flex-shrink: 0;
}

.sidebar__title {
  color: #5B7F9D;
  font-weight: 800;
  font-size: 24px;
  margin-top: 0;
  margin-bottom: 25px;
}

.filtros-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.filtro-btn {
  background-color: #A9C4EB;
  border: none;
  width: 100%;
  padding: 10px 15px;
  text-align: left;
  color: #385975;
  font-weight: 700;
  font-size: 15px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 0 rgba(0,0,0,0.05);
}
.filtro-btn:hover { filter: brightness(1.05); }

/* --- MAIN CONTENT --- */
.main-content {
  flex: 1;
  padding: 30px 40px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 30px;
}

.grid-productos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

/* --- STICKY FOOTER MÓVIL (CATÁLOGO) --- */
.mobile-sticky-footer {
    display: none; /* Oculto en PC por defecto */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    padding: 12px 20px;
    z-index: 900; /* Debajo del modal (9999), encima del contenido */
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-top: 1px solid #eee;
}

.msf-total {
    display: flex;
    flex-direction: column;
}
.msf-total span { font-size: 11px; color: #888; text-transform: uppercase; font-weight: 700; }
.msf-total strong { font-size: 20px; color: #333; font-weight: 800; }

.btn-ver-carrito-mobile {
    background-color: #6AA8D5; /* Azul marca */
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    text-decoration: none;
    flex: 1;
    max-width: 200px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(106, 168, 213, 0.3);
}

/* --- ELEMENTOS MÓVILES (Ocultos en PC) --- */
.sidebar-mobile-header { display: none; }
.mobile-filter-bar { display: none; }
.filtros-backdrop { display: none; }

/* =========================================
   RESPONSIVE: TABLETS Y CELULARES
   ========================================= */
@media (max-width: 900px) {
  .catalogo-layout { flex-direction: column; }
  .main-content { padding: 15px; }
  .page-title { font-size: 22px; margin-bottom: 15px; }
  
  /* 1. GRILLA DE 2 COLUMNAS MÁGICA */
  .grid-productos {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* 2. BARRA DE BOTÓN "FILTRAR" PEGAJOSA */
  .mobile-filter-bar {
    display: flex;
    position: sticky;
    top: 10px; /* Queda pegada arriba al scrollear */
    z-index: 100;
    margin-bottom: 20px;
  }
  
  .btn-open-filtros {
    width: 100%;
    background: #fff;
    border: 1px solid #ddd;
    padding: 12px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    cursor: pointer;
  }

  /* 3. SIDEBAR CONVERTIDO EN MENÚ DESLIZANTE */
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%; /* Oculto a la izquierda */
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    z-index: 10005;
    background: #CFE2F3;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: 5px 0 25px rgba(0,0,0,0.3);
    padding: 20px;
  }
  .sidebar.open { left: 0; } /* Clase que lo hace aparecer */

  .sidebar-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
  }
  .sidebar-mobile-header h3 { margin: 0; font-size: 20px; color: #5B7F9D; font-weight: 800;}
  .sidebar-mobile-header button {
    background: #fff; border: none; width: 32px; height: 32px; border-radius: 50%;
    font-size: 16px; color: #333; cursor: pointer; display: flex; align-items: center; justify-content: center;
  }

  /* 4. FONDO OSCURO */
  .filtros-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 10004;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .filtros-backdrop.open {
    opacity: 1; pointer-events: auto;
  }
}

@media (min-width: 901px) {
    .mobile-sticky-footer { display: none !important; }
    .page-catalogo { padding-bottom: 0; }
}

/* --- FILTROS ACTIVOS (Píldoras y Textos) --- */

.active-filters-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #CFE2F3;
}

.tag-filtro {
    background: #e5f2ff;
    border: 1px solid #6AA8D5;
    color: #385975;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.tag-filtro:hover {
    background: #c01017;
    color: white;
    border-color: #c01017;
}

.btn-limpiar-filtros-small {
    font-size: 12px;
    color: #c01017;
    font-weight: 700;
    text-decoration: underline;
    display: inline-flex;
    align-items: center;
    padding-left: 5px;
}

.filtros-texto {
    font-size: 14px;
    color: #888;
    margin-top: 0;
    margin-bottom: 10px;
    font-style: italic;
}

/* --- FILTROS DINÁMICOS (Accordions Sidebar) --- */

.filtro-group {
    margin-bottom: 10px;
}

.filtro-group summary {
    list-style: none; 
}
.filtro-group summary::-webkit-details-marker {
    display: none;
}

.filtro-btn .arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
}
details[open] .filtro-btn .arrow {
    transform: rotate(-180deg);
}

.filtro-content {
    background: #fff;
    padding: 15px;
    border-radius: 0 0 6px 6px;
    border: 1px solid #CFE2F3;
    border-top: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px; 
    overflow-y: auto;
}

.filtro-content::-webkit-scrollbar { width: 5px; }
.filtro-content::-webkit-scrollbar-thumb { background: #A9C4EB; border-radius: 5px; }

.filtro-label {
    font-size: 13px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.1s;
}

.filtro-label:hover {
    color: #000;
}

.filtro-label input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #6AA8D5;
}

/* --- FILTRO DISPONIBILIDAD (estilo inline restaurado) --- */
.filtro-disponibilidad-box {
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #CFE2F3;
}
.filtro-disponibilidad-title {
    font-size: 13px;
    font-weight: 800;
    color: #5B7F9D;
    margin-bottom: 12px;
    text-transform: uppercase;
}
.filtro-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
}
.filtro-radio-label input[type="radio"] {
    accent-color: #6AA8D5;
    width: 14px; height: 14px; cursor: pointer;
}
.filtro-radio-text { font-size: 13px; color: #444; }
.filtro-radio-label.con-stock .filtro-radio-text { color: #27ae60; font-weight: 700; }

/* --- FILTRO CATEGORÍA (nuevo, estilo coherente con sidebar azul) --- */
.filtro-cat-group {
    background: #fff;
    border-radius: 6px;
    border: 1px solid #CFE2F3;
    overflow: hidden;
}
.filtro-cat-btn {
    width: 100%;
    background: #A9C4EB;
    border: none;
    padding: 10px 15px;
    text-align: left;
    color: #385975;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .3px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.filtro-cat-btn:hover { filter: brightness(1.05); }
.filtro-cat-content {
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.filtro-cat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    font-weight: 500;
}
.filtro-cat-label input[type="radio"] {
    accent-color: #6AA8D5;
    width: 14px; height: 14px; cursor: pointer;
}
.filtro-cat-label.prox-label {
    color: #aaa;
    cursor: default;
}
.filtro-cat-badge-prox {
    font-size: 9px;
    background: #e8b84b;
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 700;
}

/* --- BREADCRUMB CATEGORÍA --- */
.catalogo-breadcrumb {
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.catalogo-breadcrumb a {
    color: var(--tierra-600, #8b5a2b);
    text-decoration: none;
    font-weight: 600;
}
.catalogo-breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: #bbb; font-size: 15px; }
.catalogo-breadcrumb span:last-child { font-weight: 700; color: #555; }