/* =========================================
    ESTILOS ESPECÍFICOS - BIBLIOTECA
   ========================================= */

/* 1. CUERPO Y FONDO GENERAL */
body.body-biblioteca {
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.7)), 
                      url('img/fondo-nuevo-grimorio.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    display: block; 
    min-height: 100vh;
}

/* 2. ESTRUCTURA DE LAYOUT */
.main-layout {
    margin-top: 0 !important; 
    min-height: 100vh;
    display: flex;
    background: transparent; 
    position: relative;
    z-index: 10;
    /* ESPACIO PARA LA SIDEBAR FIJA: evita que la barra tape las cartas */
    margin-left: 280px; 
}

/* 3. SIDEBAR (FILTROS): BLOQUE FIJO QUE SIGUE EL SCROLL */
.sidebar {
    width: 280px;
    /* Altura ajustada para que el scroll interno funcione siempre */
    height: calc(100vh - 100px) !important; 
    
    /* position fixed para seguimiento absoluto en pantalla */
    position: fixed !important;
    top: 90px !important; 
    left: 0;
    
    z-index: 999;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid rgba(212, 175, 55, 0.3);
    padding: 20px 25px; 
    
    /* Scroll interno si los filtros son largos */
    overflow-y: auto !important;
    overflow-x: hidden;
    box-sizing: border-box;
    box-shadow: 5px 0 15px rgba(0,0,0,0.5);
}

/* Estilo de la barra de scroll interna (Estilo MyL Dorado) */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 10px;
}

/* 4. ELEMENTOS DE FILTRADO (Inputs, Radios y Checkboxes) */
.filter-group {
    margin-bottom: 25px;
}

.filter-group.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
    transition: all 0.4s ease;
}

/* UNIFICACIÓN DE BOTONES (ERA, EDICIÓN Y EXPANSIÓN): Todos circulares y dorados */
.filter-list input[type="radio"],
.filter-list input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid #d4af37;
    border-radius: 50%; /* Obligamos a que sean círculos siempre */
    background: transparent;
    cursor: pointer;
    position: relative;
    margin-right: 10px;
    vertical-align: middle;
}

.filter-list input[type="radio"]:checked,
.filter-list input[type="checkbox"]:checked {
    background: #d4af37;
    box-shadow: 0 0 8px #d4af37;
}

/* Selectores Místicos (Raza, Tipo, etc.) */
.sidebar select,
#raza-filter,
#tipo-filter,
.form-control-místico {
    width: 100%;
    background: rgba(18, 18, 18, 0.9) !important;
    border: 1px solid #d4af37 !important;
    color: #d4af37 !important;
    padding: 10px;
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
    outline: none;
    transition: all 0.3s ease;
}

.sidebar select:hover,
#raza-filter:hover {
    border-color: #fff !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4) !important;
}

.sidebar select option {
    background: #121212;
    color: #d4af37;
}

.placeholder-text {
    font-size: 0.75rem;
    color: #888;
    font-style: italic;
    padding: 10px 0;
}

/* 5. COMPONENTES: BOTONES */
/* Botón Limpiar Superior */
.btn-místico-sm {
    display: block;
    width: 100%;
    margin: 0 auto 25px auto;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #d4af37;
    border: 1px solid #d4af37;
    padding: 8px 15px;
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
}

.btn-místico-sm:hover {
    background: linear-gradient(to bottom, #d4af37, #b8860b);
    color: #1a1a1a;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

/* Botón Volver al Grimorio */
.btn-dorado-santuario {
    background: linear-gradient(to bottom, #d4af37, #b8860b) !important;
    color: #000 !important;
    border: 1px solid #fff !important;
    padding: 10px 20px !important;
    font-family: 'Cinzel', serif !important;
    font-weight: bold;
    font-size: 0.8rem !important;
    cursor: pointer;
    border-radius: 4px !important;
    min-width: 220px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    transition: 0.3s;
}

/* 6. BUSCADOR Y RESULTADOS */
#main-search {
    width: 100%;
    padding-right: 45px !important;
    background: white !important;
    color: black !important;
    border: 2px solid #d4af37;
    font-weight: 700;
    border-radius: 4px;
}

/* 7. MODALES Y NOTIFICACIONES */
.detail-panel {
    z-index: 999999 !important;
}

#close-detail {
    all: unset;
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: #d4af37 !important;
    border: 2px solid #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #000 !important;
    font-size: 22px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    z-index: 2100 !important;
}

#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(10, 10, 10, 0.95);
    color: #d4af37;
    border: 1px solid #d4af37;
    padding: 12px 25px;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    pointer-events: auto;
}

/* 8. ADAPTABILIDAD (RESPONSIVE) */
@media (max-width: 900px) {
    .main-layout { 
        flex-direction: column; 
        margin-left: 0; 
    }
    .sidebar { 
        width: 100%; 
        height: auto; 
        position: relative !important; 
        top: 0 !important;
        border-right: none;
        border-bottom: 2px solid #d4af37;
        overflow-y: visible;
        box-shadow: none;
    }
}