/* Ajustes para evitar superposición */
body {
    padding-top: 109px;
    /* Altura del navbar */
}

/* Sidebar Container */
.sidebar-container {
    position: fixed;
    top: 109px;
    /* Ajusta según la altura de tu navbar */
    left: 0;
    bottom: 0;
    z-index: 990;
    transition: transform 0.3s ease;
    overflow: hidden;
    background-color: white;
    box-shadow: 2px 0 10px rgba(107, 46, 46, 0.08);
    border-radius: 0 !important;
}

.sidebar-container.collapsed {
    transform: translateX(-100%);
}

.sidebar-container.expanded {
    transform: translateX(0);
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 0;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(107, 46, 46, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    color: var(--soft-wine);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-title i {
    font-size: 1.1rem;
}

.collapse-sidebar-btn {
    background: none;
    border: none;
    color: var(--soft-wine);
    font-size: 1rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
    transition: background-color 0.2s ease;
}

.collapse-sidebar-btn:hover {
    background-color: rgba(107, 46, 46, 0.1);
}

.sidebar-content {
    padding: 1.5rem 0;
}

/* Category Styles */
.category-item {
    padding: 0;
    border-bottom: 1px solid rgba(214, 214, 214, 0.5);
    transition: all 0.2s ease;
}

.category-item:last-child {
    border-bottom: none;
}

.category-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background-color: white;
    transition: background-color 0.2s ease;
}

.category-header:hover {
    background-color: rgba(232, 232, 232, 0.3);
}

.category-header.active {
    background-color: rgba(107, 46, 46, 0.05);
    border-left: 4px solid var(--soft-wine);
}

.category-title {
    font-weight: 600;
    color: var(--contrast);
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-icon {
    color: var(--soft-wine);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.category-count {
    background-color: var(--blush-pink);
    color: var(--contrast);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 0 !important;
    flex-shrink: 0;
}

.toggle-btn {
    color: var(--soft-wine);
    background: none;
    border: none;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0 !important;
    margin-left: 10px;
}

.toggle-btn.rotated {
    transform: rotate(180deg);
}

/* Subcategories Styles */
.subcategory-list {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(250, 250, 250, 0.8);
}

.subcategory-list.expanded {
    max-height: 500px;
}

.subcategory-item {
    padding: 0.75rem 1.5rem 0.75rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(214, 214, 214, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
}

.subcategory-item:hover {
    background-color: rgba(107, 46, 46, 0.03);
}

.subcategory-item.active {
    background-color: rgba(107, 46, 46, 0.08);
    font-weight: 600;
    color: var(--soft-wine);
    border-left: 3px solid var(--soft-wine);
}

.subcategory-name {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.subcategory-dot {
    width: 6px;
    height: 6px;
    background-color: var(--nude-rose);
    flex-shrink: 0;
    border-radius: 0 !important;
    transition: background-color 0.2s ease;
}

.subcategory-item.active .subcategory-dot {
    background-color: var(--soft-wine);
}

.subcategory-count {
    font-size: 0.75rem;
    color: #777;
    background-color: rgba(107, 46, 46, 0.05);
    padding: 1px 6px;
    border-radius: 0 !important;
    flex-shrink: 0;
}

/* Botón flotante para abrir sidebar */
.floating-sidebar-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background-color: var(--soft-wine);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 100px;
    z-index: 991;
    box-shadow: 0 4px 12px rgba(107, 46, 46, 0.3);
    opacity: 0;
    visibility: hidden;
}

.floating-sidebar-toggle.visible {
    opacity: 1;
    visibility: visible;
}

.floating-sidebar-toggle:hover {
    background-color: #5a2626;
    transform: scale(1.1);
}

.floating-sidebar-toggle i {
    font-size: 1.2rem;
}

/* Botón fijo en la página (no flotante) */
.page-sidebar-toggle {
    background-color: var(--soft-wine);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.page-sidebar-toggle:hover {
    background-color: #5a2626;
}

/* Ajuste para el contenido principal */
.main-content {
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - 70px);
    padding-top: 20px;
}

.main-content-with-sidebar {
    margin-left: 280px;
}

.main-content-full {
    margin-left: 0;
}

/* Para móviles */
@media (max-width: 768px) {
    .sidebar-container {
        width: 280px;
        transform: translateX(-100%);
    }

    .sidebar-container.expanded {
        transform: translateX(0);
    }

    .main-content-with-sidebar {
        margin-left: 0;
    }

    .collapse-sidebar-btn {
        display: none;
    }

    .floating-sidebar-toggle {
        right: 15px;
        bottom: 15px;
        width: 45px;
        height: 45px;
    }
}

/* Scrollbar personalizado */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--nude-rose);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--soft-wine);
}

/* Overlay para móviles */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 989;
    display: none;
}

#sidebar-overlay.active {
    display: block;
}

/* Asegurar que el contenido no se superponga */
.container {
    position: relative;
    z-index: 1;
}

.selected-category {
    background-color: white;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 0 !important;
    border-left: 4px solid var(--soft-wine);
    position: relative;
    z-index: 1;
}

.selected-category h2 {
    color: var(--soft-wine);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.selected-category p {
    color: #666;
    margin-bottom: 0;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-tag {
    background-color: white;
    border: 1px solid rgba(107, 46, 46, 0.2);
    color: var(--soft-wine);
    padding: 5px 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 0 !important;
    transition: all 0.2s ease;
}

.filter-tag:hover {
    background-color: rgba(107, 46, 46, 0.05);
}

.close-tag {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.clear-filters {
    color: var(--soft-wine);
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}