/* Sidebar styling for the blog list page */

.blog-sidebar {
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-width: 250px;
    /* Cumple con el requisito de ancho del sidebar */
}

/* Versión absoluta del sidebar para que no se quede fijo al hacer scroll */
/* Sidebar absoluto en pantallas de escritorio */
/* Sidebar fixed on the left, overlaying the content without affecting layout */
/* Sidebar se vuelve sticky para que ocupe todo el alto disponible sin solapar el footer */
/* ------------------------------------------------------------------
   Sidebar fijo (sticky) para pantallas de escritorio
   ------------------------------------------------------------------ */
/* Sidebar sticky on the left, using flexbox layout to avoid overlay */
/* Sidebar container (sticky) */
.absolute-sidebar {
    position: sticky;
    top: 0;
    flex: 0 0 auto;
    border: 1px solid rgba(1, 1, 1, 0.075);
    /* fixed width */
    /* Allow height to shrink/expand with content; remove fixed overflow */
    overflow: visible;
    background: #f8f9fa;
    padding: 1rem;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    z-index: 1000;
    align-self: auto;
}

/* Ajuste del contenedor principal cuando el sidebar está fijado */
/* Contenedor principal del blog. Dejamos espacio para el sidebar en escritorio */
/* Main content area – flex item that takes remaining space */
.blog-main {
    flex: 1 1 0;
    padding: 1rem;
    /* No left margin needed when using flex layout */
}

/* Flex container that holds the sidebar and main content */
.blog-wrapper {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 1rem;
}

/* Cuando no hay sidebar (usuarios no superadmin), el wrapper ajusta el contenido al ancho completo */
.blog-wrapper--no-sidebar {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0;
}

/* Cuando el blog-wrapper no tiene sidebar, el contenido ocupa todo el ancho */
.blog-wrapper:not(:has(.blog-sidebar)) .blog-main,
.blog-wrapper:not(:has(.absolute-sidebar)) .blog-main {
    flex: 1 1 100%;
    max-width: 100%;
}

/* Para navegadores que no soportan :has(), usamos clase utility */
.no-sidebar .blog-main {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    padding-left: 0;
    padding-right: 0;
}


/* Responsividad: en pantallas pequeñas el sidebar deja de ser fijo y el contenido vuelve a ocupar todo el ancho */
@media (max-width: 767px) {
    .absolute-sidebar {
        /* On mobile we want the sidebar to behave like a normal block element */
        position: static;
        width: 100%;
        height: auto;
        box-shadow: none;
        display: none;
        /* hidden by default, will be shown when .open is added */
    }

    /* Ensure the open state overrides the default hidden state on mobile */
    .absolute-sidebar.open {
        display: block !important;
        /* show when toggled */
    }

    .blog-main {
        flex: 1 1 100%;
        padding: 1rem;
    }

    /* Stack sidebar above main content on mobile */
    .blog-wrapper {
        flex-direction: column;
    }

    /* Allow sidebar to shrink to full width on mobile */
    .blog-sidebar {
        min-width: 0;
    }

    /* Floating hamburger button for mobile */
    .sidebar-float-toggle {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        z-index: 1100;
        /* Ensure the button is visible above other content */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 3rem;
        height: 3rem;
        padding: 0;
        border-radius: 50%;
        font-size: 1.5rem;
    }
}

.blog-sidebar .sidebar-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #212529;
    text-decoration: underline;
    border-radius: 5px;
    padding: 0.25rem 0.25rem;
    /* Layout flex para alinear icono + texto + chevron en una sola línea */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Icono FontAwesome del título del grupo (sustituye a los emojis) */
.sidebar-title__icon {
    color: #5d25d5;
    /* tono morado de la paleta del blog */
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    transition: color 0.2s ease;
}

.sidebar-title:hover .sidebar-title__icon {
    color: #2575fc;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-link {
    text-decoration: none;
    color: #495057;
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Arrow icon for collapsible menus */
.arrow {
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
    line-height: 1;
    font-size: 1rem;
    color: #555;
    margin-left: 0.25rem;
}

/* Rotate class applied by Alpine when menu is open */
.rotate-180 {
    transform: rotate(180deg);
    /* Change color when menu is open for better visual cue */
    color: #5d25d5;
}

/* Hover effect for better UX */
.sidebar-title:hover .arrow {
    color: #007bff;
    /* primary accent */
}

/* Focus style for keyboard navigation */
.sidebar-title:focus {
    outline: 2px solid #c8d0ff;
    outline-offset: 2px;

}

/* Ensure each collapsible menu has spacing */
.sidebar-menu {
    margin-bottom: 1rem;
}

.category-item.active .category-link,
.category-link:hover {
    background-color: #e9ecef;
    color: #212529;
}

/* Icono FontAwesome dentro de cada enlace de categoría */
.category-link__icon {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #6c757d;
    width: 1rem;
    text-align: center;
    margin-right: 0.4rem;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.category-item.active .category-link__icon,
.category-link:hover .category-link__icon {
    color: #5d25d5;
}

/* Aseguramos que el flex layout del sidebar-title permita que el chevron
   siga alineado a la derecha incluso cuando hay icono + texto a la izquierda. */
.blog-sidebar .sidebar-title {
    flex-wrap: nowrap;
}

.blog-sidebar .sidebar-title .arrow {
    margin-left: auto;
    /* empuja el chevron al extremo derecho */
}

/* ==========================================================
   ORDENAR POR – estilos del bloque "Ordenar por" del sidebar
   ========================================================== */
.order-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.order-item {
    margin-bottom: 0.25rem;
}

.order-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.35rem;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.18s ease, color 0.18s ease,
        box-shadow 0.18s ease, transform 0.18s ease;
    border: 1px solid transparent;
}

.order-link:hover {
    background-color: #eef0f4;
    color: #212529;
    transform: translateX(2px);
}

.order-link-content {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.order-icon {
    width: 1rem;
    text-align: center;
    color: #6c757d;
    transition: color 0.18s ease;
}

.order-link:hover .order-icon {
    color: #5d25d5;
}

.order-check {
    color: #b06a17;
    /* tono ámbar oscuro para máximo contraste sobre fondo amarillo tenue */
    font-size: 0.85rem;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

/* Estado activo: marca siempre visible y fondo destacado.
   Usamos la paleta cálida del blog (degradado del botón "Escribir artículo"
   que va de #ff7e5f a #feb47b), aplicada en versión tenue para no saturar. */
.order-item.active .order-link {
    background: linear-gradient(90deg, #fff4e6 0%, #ffe8d4 100%);
    color: #8a4a18;
    font-weight: 600;
    border-color: #f5c794;
    box-shadow: 0 1px 2px rgba(255, 126, 95, 0.18);
}

.order-item.active .order-icon {
    color: #d97706;
    /* naranja-ámbar que coincide con la paleta */
}

.order-item.active .order-check {
    opacity: 1;
    transform: scale(1);
    color: #d97706;
}

.order-item.active .order-link:hover {
    background: linear-gradient(90deg, #ffe9d1 0%, #ffd9b8 100%);
    border-color: #ed9c4f;
    box-shadow: 0 2px 6px rgba(255, 126, 95, 0.22);
}

.order-item.active .order-link:hover .order-check {
    color: #b45309;
}