/* =========================================
   1. LAYOUT PRINCIPAL Y VARIABLES
   ========================================= */
.archive-page-container {
    display: flex;
    gap: 40px;
    max-width: 1400px;
    width: min(90vw);
    margin: 20px auto;
}

.archive-main {
    flex-grow: 1;
    min-width: 0;
}

/* =========================================
   2. SELECTOR DE MODO (SERIES/FANFICS)
   ========================================= */
.mode-switcher {
    display: flex;
    gap: 15px;
}

.mode-btn {
    font-size: 1.1rem;
    font-weight: 700;
    color: #999;
    cursor: pointer;
    padding: 12px 30px;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background-color: #fff;
    border: 1px solid #eaeaea;
    border-radius: 30px;
}

.mode-btn.active {
    color: #fff;
    background-color: #000;
    border-color: #000;
}

.mode-btn:hover:not(.active) {
    border-color: #ccc;
    color: #333;
}

/* Versión Sidebar del Selector */
.mode-switcher.sidebar-mode {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-switcher.sidebar-mode .mode-btn {
    width: 100%;
    text-align: center;
    padding: 10px 15px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

/* =========================================
   3. GÉNEROS (TABS HORIZONTALES)
   ========================================= */
/* Contenedor principal de la franja de géneros */
.archive-categories {
    width: 100%;
    max-width: 100%; 
    overflow: visible; /* Cambiado de hidden a visible para no cortar sombras */
    position: relative;
    margin-bottom: 35px;
}

.category-tabs {
    display: flex;
    overflow-x: auto; /* Habilita el scroll horizontal */
    overflow-y: hidden;
    white-space: nowrap; /* Evita saltos de línea */
    gap: 12px;
    padding: 10px 5px 15px 5px; /* Padding inferior para dar espacio a la barra */
    list-style: none;
    margin: 0;
    -webkit-overflow-scrolling: touch;
    
    /* Scrollbar para Firefox */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

/* Scrollbar sutil para Chrome/Safari/Edge en Desktop */
.category-tabs::-webkit-scrollbar {
    height: 6px;
    display: block; /* La hacemos visible en desktop */
}

.category-tabs::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
    transition: background 0.3s;
}

.category-tabs::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.category-tabs li {
    flex: 0 0 auto; /* Impide que los botones se encojan */
}

.category-tabs {
    cursor: pointer; /* Indica que es interactivo */
    user-select: none; /* Evita que se resalte el texto de los botones al arrastrar */
}

.category-tabs li a {
    display: inline-block;
    padding: 10px 22px;
    background: #fff;
    border: 1px solid #eee;
    color: #555;
    text-decoration: none;
    border-radius: 50px; /* Estilo píldora */
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap; /* Evita que el texto interno salte de línea */
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* Estado activo */
.category-tabs li.active-tab-wrapper a {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* =========================================
   4. SIDEBAR Y FILTROS LATERALES
   ========================================= */
.archive-sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 25px;
    background-color: #f9f9f9;
    border: 1px solid #eaeaea;
    border-radius: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.widget-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 3px solid #000;
    color: #000;
    text-transform: uppercase;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-subtitle {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
}

/* Scrollbar Sidebar */
.filter-list::-webkit-scrollbar { width: 5px; }
.filter-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }

.filter-list li { margin-bottom: 8px; }

.filter-list label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #fff;
    border-radius: 10px;
    border: 1px solid #eee;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.filter-list label:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
}

/* Estilos de Link/Checkbox personalizado */
.filter-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0px;
    text-decoration: none;
    color: #444;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
}

.custom-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    flex-shrink: 0;
}

.filter-link.is-active {
    font-weight: 700;
    color: black;
}

.filter-link.is-active .custom-checkbox {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: contain;
}

/* =========================================
   5. GRID DE POSTS Y CARDS
   ========================================= */
.grid-posts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 35px 20px;
}

.grid-item {
    transition: transform 0.3s ease;
}

.grid-item a { text-decoration: none; color: inherit; }

.grid-image {
    position: relative;
    aspect-ratio: 1 / 1; 
    border-radius: 12px;
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.grid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.grid-item:hover .grid-image {
    transform: translateY(-6px);
}

/* Contenido de la Card */
.grid-content { padding: 12px 5px 0; }

.grid-content h3 {
    font-size: 16px;
    margin: 0 0 5px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chapter-info {
    font-size: 13px;
    color: #888;
    font-weight: 600;
    margin: 8px;
    display: block;
}

/* =========================================
   6. TAGS (PÍLDORAS)
   ========================================= */
.post-tags { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 5px; 
    margin-top: 10px; 
}

.tag {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.tag-status { background: #111; color: #fff; }
.tag-fanfic-serie { background: #000; color: #fff; }
.tag-collection { background: #e8f0fe; color: #1967d2; }
.tag-genre { background: #f0f0f0; color: #333; }
.tag-animal { background: #e6f4ea; color: #137333; }
.tag-kink { background: #fce8e6; color: #c5221f; }

/* =========================================
   7. RESPONSIVO (MÓVIL)
   ========================================= */
@media (max-width: 900px) {
    .archive-page-container {
        flex-direction: column;
        gap: 0px;
        margin: 15px auto;
    }

    /* Cambio de orden para móvil */
    .archive-main { display: contents; }

    .archive-sidebar {
        order: 1; 
        width: 100%;
        padding: 0;
        background: transparent;
        border: none;
        border-bottom: 1px solid #eee;
        position: static;
    }

    .archive-categories { 
        order: 2; 
        margin-bottom: 0px;
        padding-top: 5px;
    }

    #ajax-response-container, .grid-posts {
        order: 3;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px;
    }

    /* Filtros en scroll horizontal para móvil */
    .filter-list {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        max-height: none;
        padding-bottom: 10px;
        scrollbar-width: none;
    }
    
    .filter-section {
        margin-bottom: 10px;
    }

    .archive-categories::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 40px;
        height: 100%;
        background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.9));
        pointer-events: none; /* Permite hacer click a través de la sombra */
    }

    .filter-list li { margin-bottom: 0; }
    .filter-list label {
        white-space: nowrap;
        padding: 8px 16px;
        border-radius: 20px;
    }

    /* Limpieza visual en móvil */
    .archive-sidebar .widget-title, 
    .archive-sidebar .filter-subtitle { 
        display: none; 
    }

    .mode-switcher.sidebar-mode {
        flex-direction: row;
        margin-bottom: 15px;
        justify-content: center;
    }
}

/* =========================================
   8. OTROS (HERO, TAXONOMY, MISC)
   ========================================= */
.archive-header-hero {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    border: 1px solid #eee;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.tax-label {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: 2px;
    display: block;
    margin-bottom: 10px;
}

.no-posts-container {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}