/* CSS for FEMP Documents - Modern Design */

:root {
    --femp-primary: #0056b3;
    --femp-primary-dark: #003d80;
    --femp-accent: #ff6600;
    --femp-accent-dark: #e55a00;
    --femp-bg: #f8f9fa;
    --femp-card-bg: #ffffff;
    --femp-text: #333333;
    --femp-text-light: #666666;
    --femp-border: #e0e0e0;
    --femp-border-light: #f0f0f0;
    --femp-shadow: rgba(0, 0, 0, 0.08);
    --femp-shadow-hover: rgba(0, 0, 0, 0.15);
    --femp-radius: 12px;
    --femp-radius-sm: 8px;
    --femp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE WRAPPER STYLES
   ============================================ */
.femp-docs-wrapper, 
.femp-docs-list-wrapper, 
.femp-docs-search-wrapper,
.femp-docs-latest-wrapper {
    width: 100%;
    margin-bottom: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================
   MODERN SEARCH FORM
   ============================================ */
.femp-docs-search-wrapper {
    width: 100%;
    margin-bottom: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}


/* Update Search Row to Grid for better control with 3 items */
.femp-docs-search-row {
    display: grid;
    /* grid-template-columns: 2fr 1fr minmax(120px, auto); */
    grid-template-columns: 1fr auto; /* Revert to 2 cols while year is hidden */
    gap: 1rem;
    align-items: flex-end;
}

.femp-docs-year {
    display: none !important;
}


/* Mobile responsive for search row */
@media (max-width: 768px) {
    .femp-docs-search-row {
        grid-template-columns: 1fr;
    }
}

.femp-docs-search-row .femp-docs-search-text {
    flex: 1;
}

.femp-docs-search-row .femp-docs-submit {
    flex-shrink: 0;
}

.femp-docs-search-row .femp-btn {
    padding: 0.875rem 2rem;
    white-space: nowrap;
}

/* Fila de filtros (sección, categoría, materia) */
.femp-docs-filters-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .femp-docs-filters-row {
        grid-template-columns: 1fr;
    }
    
    .femp-docs-search-row {
        flex-direction: column;
    }
    
    .femp-docs-search-row .femp-docs-search-text {
        width: 100%;
    }
    
    .femp-docs-search-row .femp-docs-search-text input {
        width: 100%;
        box-sizing: border-box;
    }
    
    .femp-docs-search-row .femp-docs-submit {
        width: 100%;
    }
}

.femp-docs-field {
    display: flex;
    flex-direction: column;
}

.femp-docs-field label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--femp-text);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.femp-docs-field input,
.femp-docs-field select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--femp-border);
    border-radius: var(--femp-radius-sm);
    background: var(--femp-card-bg);
    font-size: 1rem;
    width: 100%;
    transition: var(--femp-transition);
    color: var(--femp-text);
}

.femp-docs-field input:focus,
.femp-docs-field select:focus {
    outline: none;
    border-color: var(--femp-primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.femp-docs-field input::placeholder {
    color: #aaa;
}

.femp-docs-submit {
    display: flex;
    align-items: flex-end;
    margin-bottom: 3px;
}

.femp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--femp-primary) 0%, var(--femp-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--femp-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: var(--femp-transition);
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.3);
}

.femp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.4);
    background: linear-gradient(135deg, var(--femp-primary-dark) 0%, var(--femp-primary) 100%);
}

.femp-btn:active {
    transform: translateY(0);
}

/* ============================================
   LATEST DOCUMENTS - GRID VIEW (Like Search Results Style)
   ============================================ */
.femp-docs-latest-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 992px) {
    .femp-docs-latest-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .femp-docs-latest-list {
        grid-template-columns: 1fr;
    }
}

.femp-latest-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background: var(--femp-card-bg);
    border-radius: var(--femp-radius);
    border: 1px solid var(--femp-border);
    box-shadow: 0 2px 8px var(--femp-shadow);
    transition: var(--femp-transition);
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.femp-latest-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--femp-primary) 0%, var(--femp-accent) 100%);
    opacity: 0;
    transition: var(--femp-transition);
}

.femp-latest-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px var(--femp-shadow-hover);
    border-color: var(--femp-primary);
}

.femp-latest-card:hover::before {
    opacity: 1;
}

/* Primera fila: Título */
.femp-latest-primary-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.femp-latest-title {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--femp-text);
    font-weight: 600;
    flex: 1;
}

.femp-latest-title a {
    text-decoration: none;
    color: inherit;
    transition: var(--femp-transition);
    display: block;
}

.femp-latest-title a:hover {
    color: var(--femp-primary);
}

/* Segunda fila: Taxonomías */
.femp-latest-meta-row {
    display: flex;
    width: 100%;
    flex: 1;
    align-items: flex-start;
}

.femp-latest-taxonomies {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.femp-latest-badge-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 2px;
}

.femp-latest-children-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.femp-latest-section-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: linear-gradient(135deg, var(--femp-primary) 0%, var(--femp-primary-dark) 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    white-space: nowrap;
}

.femp-latest-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--femp-bg);
    color: var(--femp-text);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    border: 1px solid var(--femp-border);
    white-space: nowrap;
}

/* Tercera fila (Footer con fondo) */
.femp-latest-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--femp-bg) 0%, #e8f0fe 100%);
    border-radius: var(--femp-radius-sm);
    flex-wrap: wrap;
    gap: 1rem;
    box-sizing: border-box;
    margin-top: auto;
}

@media (max-width: 640px) {
    .femp-latest-footer-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Acciones en el footer (derecha) */
.femp-latest-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Detalles (Fecha + Tamaño) */
.femp-latest-meta-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .femp-latest-meta-details {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        margin-top: 0.5rem;
        gap: 0.5rem;
    }
}

.femp-latest-date,
.femp-latest-size {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--femp-text-light);
    white-space: nowrap;
}

.femp-latest-date i,
.femp-latest-size i {
    font-size: 14px;
    color: var(--femp-primary);
}

/* Botones de acción */
.femp-latest-actions .femp-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--femp-card-bg);
    border: 1px solid var(--femp-border);
    color: var(--femp-text-light);
    cursor: pointer;
    transition: var(--femp-transition);
    text-decoration: none;
}

.femp-latest-actions .femp-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.femp-latest-actions .femp-btn-copy:hover {
    color: var(--femp-primary);
    border-color: var(--femp-primary);
}

.femp-latest-actions .femp-btn-download:hover {
    color: var(--femp-accent);
    border-color: var(--femp-accent);
}

.femp-latest-actions .femp-action-btn i {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 480px) {
    .femp-latest-card {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .femp-latest-primary-row {
        gap: 0.75rem;
    }
    
    .femp-latest-meta-row {
        gap: 0.375rem;
    }
}

/* ============================================
   DOCUMENT LIST - VERTICAL STACK VIEW
   ============================================ */
.femp-list-view {
    background: var(--femp-card-bg);
    border-radius: var(--femp-radius);
    box-shadow: 0 4px 20px var(--femp-shadow);
    overflow: hidden;
    border: 1px solid var(--femp-border);
}

.femp-doc-list-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--femp-border-light);
    transition: var(--femp-transition);
}

.femp-doc-list-item:last-child {
    border-bottom: none;
}

.femp-doc-list-item:hover {
    background: var(--femp-bg);
}

/* Primera fila: Título */
.femp-doc-primary-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Icono eliminado/oculto */
.femp-doc-list-icon {
    display: none;
}

.femp-doc-title {
    margin: 0;
    font-size: 0.8rem; /* Tamaño reducido más aún */
    line-height: 1.4;
    color: var(--femp-text);
    font-weight: 600;
    flex: 1;
}

/* Toggle Button */
.femp-docs-toggle-opt {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
}

.femp-docs-toggle-btn {
    background: none;
    border: 1px solid var(--femp-border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--femp-text-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

.femp-docs-toggle-btn:hover {
    background: var(--femp-bg);
    color: var(--femp-text);
}

.femp-docs-toggle-btn.active {
    background: var(--femp-primary);
    color: white;
    border-color: var(--femp-primary);
}

.femp-doc-title a {
    text-decoration: none;
    color: inherit;
    transition: var(--femp-transition);
    display: block;
}

.femp-doc-title a:hover {
    color: var(--femp-primary);
}

.femp-doc-filename {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--femp-text-light);
    opacity: 0.75;
    line-height: 1.3;
    word-break: break-all;
    text-decoration: none;
    transition: var(--femp-transition);
}

.femp-doc-filename:hover {
    opacity: 1;
    color: var(--femp-primary);
}

.femp-doc-filename i {
    font-size: 0.65rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .femp-doc-filename {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        display: inline-flex;
        word-break: normal;
    }
}

/* Segunda fila: Taxonomías */
.femp-doc-meta-row {
    display: flex;
    width: 100%;
    padding-left: 0;
}

@media (max-width: 640px) {
    .femp-doc-meta-row {
        padding-left: 0;
    }
}

/* Tercera fila (Footer con fondo) */
.femp-doc-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--femp-bg) 0%, #e8f0fe 100%);
    border-radius: var(--femp-radius-sm);
    flex-wrap: wrap;
    gap: 1rem;
    box-sizing: border-box;
}

/* Mobile: stacked layout with floating actions */
@media (max-width: 640px) {
    .femp-doc-footer-row {
        position: relative;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding-right: 4.5rem; /* space for floating action buttons */
    }
}

/* Acciones en el footer (izquierda) */
.femp-doc-actions-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Grupo de Taxonomías */
.femp-doc-taxonomies {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* Clase para ocultar taxonomías */
.femp-doc-taxonomies.femp-hidden {
    display: none;
}

/* Cada grupo (Sección + Hijas) */
.femp-doc-badge-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 2px;
}

/* Contenedor de hijas para separarlas visualmente */
.femp-doc-children-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.femp-doc-empty {
    color: var(--femp-text-light);
    font-size: 0.75rem;
}

/* Badges Styles */
.femp-doc-materia-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background: #EAEDF0;
    color: var(--femp-text);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
}

.femp-doc-section-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: linear-gradient(135deg, var(--femp-primary) 0%, var(--femp-primary-dark) 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    white-space: nowrap;
}

.femp-doc-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--femp-bg);
    color: var(--femp-text);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    border: 1px solid var(--femp-border);
    white-space: nowrap;
}

/* Detalles (Toggle + Materia + Autor + Fecha + Tamaño) */
.femp-doc-meta-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Sub-group: Toggle button + Materia badge */
.femp-doc-cats-materia {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Sub-group: Date + Size */
.femp-doc-date-size {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Mobile: Stack meta-details vertically, float actions */
@media (max-width: 640px) {
    .femp-doc-meta-details {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.375rem;
    }
    
    .femp-doc-cats-materia {
        order: 1;
    }
    
    .femp-doc-author {
        order: 2;
    }
    
    .femp-doc-date-size {
        order: 3;
        margin-top: 0.125rem;
    }
    
    /* Actions float top-right, side by side */
    .femp-doc-actions-footer {
        position: absolute;
        top: 0.5rem;
        right: 0.75rem;
        flex-direction: row;
        gap: 0.375rem;
    }
}

.femp-doc-author,
.femp-doc-date,
.femp-doc-size {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--femp-text-light);
    white-space: nowrap;
}

/* Author specific ellipsis */
.femp-doc-author {
    max-width: 100%;
    /* Ensure flex context from shared rule applies */
}

/* New wrapper for name truncation */
.femp-author-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0; /* Crucial for flex child truncation */
}

.femp-doc-author i,
.femp-doc-date i,
.femp-doc-size i {
    font-size: 14px;
    color: var(--femp-primary);
    flex-shrink: 0; /* Prevent icon squish */
    line-height: 1; /* Fix vertical alignment */
}

/* Botones de acción pequeños */
.femp-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--femp-bg);
    border: 1px solid var(--femp-border);
    color: var(--femp-text-light);
    cursor: pointer;
    transition: var(--femp-transition);
    text-decoration: none;
}

.femp-action-btn:hover {
    background: var(--femp-card-bg);
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.femp-action-btn.femp-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--femp-bg) !important;
    border-color: var(--femp-border) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Specific styling for item toggle to match size or color if needed */
.femp-toggle-item-categories {
    margin-right: 0;
    width: auto;
    height: auto;
    padding: 0.125rem;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--femp-text-lighter, #999);
}

.femp-toggle-item-categories:hover {
    background: rgba(0,0,0,0.05);
    color: var(--femp-primary);
    transform: none;
    box-shadow: none;
}

.femp-toggle-item-categories.active {
    color: var(--femp-primary);
    background: rgba(var(--femp-primary-rgb), 0.1);
}

.femp-btn-copy:hover {
    color: var(--femp-primary);
    border-color: var(--femp-primary);
}

.femp-btn-force-download:hover {
    color: var(--femp-accent);
    border-color: var(--femp-accent);
}

.femp-action-btn i {
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .femp-doc-list-item {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .femp-doc-primary-row {
        gap: 0.75rem;
    }
    
    .femp-doc-list-icon {
        width: 32px;
        height: 32px;
    }
    
    .femp-doc-meta-row {
        gap: 0.375rem;
    }
}

/* ============================================
   PAGINATION - Botones estilo tema
   ============================================ */
.femp-docs-list-wrapper .femp-docs-pagination .pods-pagination-advanced {
    display: flex !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    padding: 1.5rem !important;
    background: var(--femp-bg) !important;
    border-top: 1px solid var(--femp-border) !important;
    flex-wrap: wrap !important;
    width: 100%;
}

.femp-docs-list-wrapper .pods-pagination-advanced a,
.femp-docs-list-wrapper .pods-pagination-advanced span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 1rem !important;
    border: none !important;
    border-radius: var(--femp-radius-sm) !important;
    color: var(--femp-text) !important;
    text-decoration: none !important;
    background: var(--femp-card-bg) !important;
    font-weight: 600 !important;
    font-size: 0.9375rem !important;
    cursor: pointer !important;
    transition: var(--femp-transition) !important;
    box-shadow: 0 2px 4px var(--femp-shadow) !important;
}

.femp-docs-list-wrapper .pods-pagination-advanced a:hover {
    background: linear-gradient(135deg, var(--femp-primary) 0%, var(--femp-primary-dark) 100%) !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.35) !important;
}

/* Current page */
.femp-docs-list-wrapper .pods-pagination-advanced span.pods-pagination-current {
    background: linear-gradient(135deg, var(--femp-primary) 0%, var(--femp-primary-dark) 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.3) !important;
}

/* Dots (if any, though not shown in example) */
.femp-docs-list-wrapper .pods-pagination-advanced span.dots {
    background: transparent !important;
    box-shadow: none !important;
    cursor: default !important;
    color: var(--femp-text-light) !important;
}

/* Next/Prev/First/Last Labels */
.femp-docs-list-wrapper .pods-pagination-advanced a.pods-pagination-label {
    background: linear-gradient(135deg, var(--femp-bg) 0%, #e8f0fe 100%) !important;
    border: 2px solid var(--femp-primary) !important;
    color: var(--femp-primary) !important;
}

.femp-docs-list-wrapper .pods-pagination-advanced a.pods-pagination-label:hover {
    background: linear-gradient(135deg, var(--femp-primary) 0%, var(--femp-primary-dark) 100%) !important;
    color: white !important;
    border-color: var(--femp-primary) !important;
}

/* Clase para ocultar páginas fuera del rango (usada por JavaScript) */
.femp-docs-list-wrapper .pods-pagination-advanced .pods-pagination-number.femp-hidden-page {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .femp-docs-list-wrapper .femp-docs-pagination .pods-pagination-advanced {
        gap: 0.375rem !important;
        padding: 1rem !important;
    }
    
    .femp-docs-list-wrapper .pods-pagination-advanced a,
    .femp-docs-list-wrapper .pods-pagination-advanced span {
        min-width: 36px !important;
        height: 36px !important;
        padding: 0 0.75rem !important;
        font-size: 0.875rem !important;
    }

    /* Ocultar números de página en móviles, excepto el actual */
    .femp-docs-list-wrapper .pods-pagination-advanced .pods-pagination-number:not(.pods-pagination-current) {
        display: none !important;
    }
}

/* ============================================
   NO RESULTS
   ============================================ */
.femp-docs-no-results {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    color: #856404;
    border: 2px solid #ffeeba;
    border-radius: var(--femp-radius);
    font-size: 1.125rem;
}

.femp-docs-no-results p {
    margin: 0;
}

/* ============================================
   ALERT
   ============================================ */
.femp-alert {
    padding: 1.25rem 1.5rem;
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
    border-radius: var(--femp-radius-sm);
    font-weight: 500;
}

/* ============================================
   SELECT2 CUSTOM STYLES
   ============================================ */
.femp-docs-category .select2-container {
    width: 100% !important;
}

.femp-docs-category .select2-container--default .select2-selection--single {
    height: auto;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    border: 2px solid var(--femp-border);
    border-radius: var(--femp-radius-sm);
    background-color: var(--femp-card-bg);
    font-size: 1rem;
    color: var(--femp-text);
}

.femp-docs-category .select2-container--default .select2-selection--single:focus {
    border-color: var(--femp-primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
    outline: none;
}

.femp-docs-category .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 1.2;
    color: var(--femp-text);
}

.femp-docs-category .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 0.75rem;
    width: 20px;
}

.femp-docs-category .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--femp-text-light) transparent transparent transparent;
    border-width: 5px 5px 0 5px;
}

.femp-docs-category .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--femp-text-light) transparent;
    border-width: 0 5px 5px 5px;
}

/* Dropdown styles */
.femp-docs-category .select2-container--default .select2-dropdown {
    border: 2px solid var(--femp-border);
    border-radius: var(--femp-radius-sm);
    box-shadow: 0 4px 20px var(--femp-shadow);
    margin-top: 4px;
}

.femp-docs-category .select2-container--default .select2-search--dropdown {
    padding: 0.75rem;
    border-bottom: 1px solid var(--femp-border-light);
}

.femp-docs-category .select2-container--default .select2-search--dropdown .select2-search__field {
    padding: 0.5rem;
    border: 2px solid var(--femp-border);
    border-radius: var(--femp-radius-sm);
    font-size: 0.9375rem;
}

.femp-docs-category .select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--femp-primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
    outline: none;
}

.femp-docs-category .select2-container--default .select2-results__option {
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--femp-text);
}

.femp-docs-category .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--femp-primary);
    color: white;
}

.femp-docs-category .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: var(--femp-bg);
    color: var(--femp-primary);
}

.femp-docs-category .select2-container--default .select2-results__message {
    padding: 0.75rem 1rem;
    color: var(--femp-text-light);
    font-style: italic;
}

/* Disabled state */
.femp-docs-category .select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: var(--femp-bg);
    border-color: var(--femp-border);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Asegurar que el dropdown no se corte */
.femp-docs-category {
    position: relative;
}

/* Mejorar el scroll en el dropdown */
.femp-docs-category .select2-container--default .select2-results > .select2-results__options {
    max-height: 300px;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .femp-docs-category .select2-container--default .select2-dropdown {
        width: 100% !important;
        left: 0 !important;
    }
}

/* Fix z-index for select2 to avoid overlap with side menu (z-index 999) */
.select2-container {
    z-index: 900 !important;
}

/* ============================================
   VIEW SWITCHER & CONTROLS
   ============================================ */
.femp-docs-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Reset existing margin on toggle opt when inside controls */
.femp-docs-controls .femp-docs-toggle-opt {
    margin-bottom: 0;
}

.femp-docs-view-switcher {
    display: flex;
    gap: 0.25rem;
    background: var(--femp-bg);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--femp-border);
}

.femp-view-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    color: var(--femp-text-light);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.femp-view-btn:hover {
    color: var(--femp-text);
    background: rgba(0,0,0,0.05);
}

.femp-view-btn.active {
    background: white;
    color: var(--femp-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* ============================================
   CONTENT GROUP WRAPPER (DEFAULT VIEW)
   ============================================ */
.femp-doc-content-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Slightly tighter than item gap */
    flex: 1;
    min-width: 0; 
}

/* ============================================
   COMPACT VIEW STYLES
   ============================================ */
/* Wrapper Layout */
.femp-list-view.femp-view-compact .femp-doc-list-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
}

/* Left Side: Content Group */
.femp-list-view.femp-view-compact .femp-doc-content-group {
    gap: 0.25rem;
}

.femp-list-view.femp-view-compact .femp-doc-primary-row {
    margin-bottom: 0;
}

.femp-list-view.femp-view-compact .femp-doc-title {
    font-size: 0.95rem; /* Make title slightly more prominent in dense list */
}

.femp-list-view.femp-view-compact .femp-doc-filename {
    margin-top: 0;
    font-size: 0.7rem;
}

/* Right Side: Footer Row becomes Side Panel */
.femp-list-view.femp-view-compact .femp-doc-footer-row {
    background: none;
    padding: 0;
    width: auto;
    flex-direction: row;
    gap: 1rem;
    flex-shrink: 0;
    margin-top: 0;
    border-radius: 0;
}

.femp-list-view.femp-view-compact .femp-doc-meta-details {
    gap: 0.5rem;
}

/* Swap Date and Size order */
.femp-list-view.femp-view-compact .femp-doc-date-size {
    gap: 0.5rem;
}

.femp-list-view.femp-view-compact .femp-doc-date {
    order: 2;
}

.femp-list-view.femp-view-compact .femp-doc-size {
    order: 1;
}

/* Simplify badges in compact view - TEXT STYLE */
.femp-list-view.femp-view-compact .femp-doc-taxonomies {
    gap: 0.2rem;
}

.femp-list-view.femp-view-compact .femp-doc-badge-group {
    padding: 0;
    gap: 0;
    display: inline-block;
}

/* Section styling: Primary color, bold text */
.femp-list-view.femp-view-compact .femp-doc-section-badge {
    background: transparent;
    color: var(--femp-primary);
    padding: 0;
    border-radius: 0;
    font-weight: 700;
    box-shadow: none;
    display: inline;
}

/* Children list container */
.femp-list-view.femp-view-compact .femp-doc-children-list {
    display: inline;
    gap: 0;
}

/* Separator before children list (only if it exists) */
.femp-list-view.femp-view-compact .femp-doc-children-list::before {
    content: "/";
    margin: 0 0.15rem;
    color: var(--femp-text-light);
    opacity: 0.4;
    font-weight: 400;
}

/* Category styling: Plain text, lighter color */
.femp-list-view.femp-view-compact .femp-doc-category-badge {
    background: transparent;
    border: none;
    color: var(--femp-text-light);
    padding: 0;
    border-radius: 0;
    display: inline;
    font-weight: 400;
}

/* Comma separator for categories */
.femp-list-view.femp-view-compact .femp-doc-children-list .femp-doc-category-badge:not(:last-child)::after {
    content: ", ";
}

/* Mobile Breakpoint for Compact View - Revert to stack and hide toggle */
@media (max-width: 768px) {
    /* Hide switcher on mobile */
    .femp-docs-view-switcher {
        display: none !important;
    }

    /* Force normal list view layout if class exists */
    .femp-list-view.femp-view-compact .femp-doc-list-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .femp-list-view.femp-view-compact .femp-doc-footer-row {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
        gap: 1rem;
        /* Restore original footer background if needed, or keep transparent but structured */
        background: linear-gradient(135deg, var(--femp-bg) 0%, #e8f0fe 100%);
        padding: 0.5rem 1rem;
        border-radius: var(--femp-radius-sm);
    }
    
    .femp-list-view.femp-view-compact .femp-doc-meta-details {
        gap: 0.75rem;
    }

    /* Undo Order Swap on Mobile */
    .femp-list-view.femp-view-compact .femp-doc-date {
        order: unset;
    }

    .femp-list-view.femp-view-compact .femp-doc-size {
        order: unset;
    }
}

