/* ============================================================
   SEMBRIS — sidebar_styles.css
   ============================================================ */

/* ── Sidebar desktop ────────────────────────────────────────── */
#sidebar-categorias {
    width: 260px;
    min-width: 260px;
    background: #ffffff;
    border-right: 1px solid #e8e8e8;
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 120px);
    padding-bottom: 2rem;
    margin-top: 0;
}

.sidebar-title { display: none !important; }

/* ── Nivel 1: Categoría ─────────────────────────────────────── */
.sidebar-cat-header {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 1.1rem;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #222;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    transition: background 0.15s;
    line-height: 1.3;
}
.sidebar-cat-header:hover { background: #f5f5f5; }
.sidebar-cat-header[aria-expanded="true"] { background: #f5f5f5; font-weight: 500; color: #444; }
.sidebar-cat-header[aria-expanded="true"] .sidebar-cat-arrow { transform: rotate(90deg); color: #444; }

.sidebar-cat-arrow {
    font-size: 0.55rem;
    color: #bbb;
    transition: transform 0.2s;
    flex-shrink: 0;
    order: -1;
    overflow: hidden;
}

.sidebar-cat-img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: transparent;
}

/* ── Nivel 2: Subcategoría ──────────────────────────────────── */
.sidebar-subcat-header {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    background: none;
    border: none;
    font-size: 0.855rem;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    border-bottom: 1px solid #f5f5f5;
    overflow: hidden;
}
.sidebar-subcat-header:hover { background: #f5f5f5; color: #111; }
.sidebar-subcat-header[aria-expanded="true"] { color: #444; background: #efefef; font-weight: 500; }
.sidebar-subcat-header[aria-expanded="true"] .sidebar-subcat-arrow { transform: rotate(90deg); color: #555; }

/* ✅ FIX — .sidebar-subcat-header ahora también puede ser un <a>
   (antes solo era <button>, ver sidebar_categorias.html v2, el header
   de subcategoría con subsubs pasó a link directo). Los <a> traen
   text-decoration/color propios del navegador que el bloque de arriba
   no cubre porque fue pensado solo para <button>. Reset explícito: */
a.sidebar-subcat-header,
a.sidebar-subcat-header:hover,
a.sidebar-subcat-header:visited,
a.sidebar-subcat-header:active {
    text-decoration: none;
    color: #444;
}
a.sidebar-subcat-header:hover { color: #111; }
a.sidebar-subcat-header.active,
a.sidebar-subcat-header[aria-expanded="true"] {
    color: #444;
    background: #efefef;
    font-weight: 500;
}
a.sidebar-subcat-header.active .sidebar-subcat-arrow,
a.sidebar-subcat-header[aria-expanded="true"] .sidebar-subcat-arrow {
    transform: rotate(90deg);
    color: #555;
}

.sidebar-subcat-arrow {
    font-size: 0.5rem;
    color: #ccc;
    transition: transform 0.2s;
    flex-shrink: 0;
    order: -1;
    overflow: hidden;
}

.sidebar-subcat-link {
    display: block;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    font-size: 0.855rem;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-subcat-link:hover { background: #f5f5f5; color: #111; }
.sidebar-subcat-link.active { background: #f0f0f0; color: #444; font-weight: 500; border-left-color: #249F5F; }

/* ── Nivel 3: SubSubcategoría ───────────────────────────────── */
.sidebar-subsub-link {
    display: block;
    padding: 0.48rem 1rem 0.48rem 3.5rem;
    font-size: 0.83rem;
    font-weight: 400;
    color: #555;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    border-bottom: 1px solid #f8f8f8;
    line-height: 1.4;
}
.sidebar-subsub-link:hover { background: #f5f5f5; color: #111; }
.sidebar-subsub-link.active { background: #edf7f2; color: #1a7a46; font-weight: 500; border-left-color: #249F5F; }

/* ── Offcanvas móvil ────────────────────────────────────────── */
#offcanvasSidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    z-index: 1055 !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    width: 290px !important;
    background: #fff !important;
    border-right: 1px solid #e8e8e8;
}
#offcanvasSidebar.show { transform: translateX(0) !important; }
.offcanvas-backdrop { z-index: 1054 !important; }
#offcanvasSidebar .offcanvas-header { min-height: 44px; border-bottom: 1px solid #f0f0f0 !important; }