body {
    overflow-x: hidden;
}
.body {
    background: linear-gradient(85deg, #243A62 0%, #2b4a75 55%, #376692 100%);
}
.glosario-container {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    height: auto;
    position: relative;
    z-index: 1;
}
#bg-words {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    mix-blend-mode: normal;
}
.bg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12,34,56,0.06);
    z-index: 0;
    pointer-events: none;
}
.glosario-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffffff;
}
.glosario-text {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffffff;
}
.alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 18px auto 28px;
    padding: 12px 14px;
    border-radius: 14px;
    max-width: 900px;
}

/* Botones del abecedario */
.filter-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.12);
    background: #f0f0f0;
    color: #243A62;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
    box-shadow: 0 2px 8px rgba(36,58,98,0.12);
}
.filter-btn:hover {
    transform: translateY(-3px) scale(1.03);
}
.filter-btn.active {
    background: #243A62;
    color: #ffffff;
    border-color: #000000;
    transform: scale(1.06);
}
.category-filter {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 18px 0 10px;
}
.category-btn {
    padding: 8px 18px;
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,0.12);
    background: #f0f0f0;
    color: #222;
    font-weight: 600;
    cursor: pointer;
    transition: all .22s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.category-btn:hover { 
    transform: translateY(-2px); 
}
.category-btn.active {
    background: #243A62;
    color: #fff;
    border-color: #000000;
}
.glosario-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 24px; 
}
.glosario-item { 
    background:#111; 
    color: #eee; 
    border-radius: 10px; 
    box-shadow: 0 8px 26px rgba(0,0,0,.35); 
    overflow: hidden; 
    transition: transform .2s ease; 
}
.glosario-item:hover { 
    transform: translateY(-6px); 
}
.glosario-item > summary { 
    padding: 18px 22px; 
    font-weight: 700; 
    cursor: pointer; 
    list-style: none; 
    position: relative; 
}
.glosario-item > summary::-webkit-details-marker { 
    display: none; 
}
.glosario-item > summary::after { 
    content: '›';
    position: absolute; 
    right: 18px; 
    top: 50%; 
    transform: translateY(-50%) rotate(90deg); 
    transition: transform .22s ease; 
    color: #bbb; 
}
.glosario-item[open] > summary::after { 
    transform: translateY(-50%) rotate(270deg); 
    color: #fff; 
}
.glosario-item > p { 
    padding: 0 22px 20px; 
    color: #cfcfcf; 
    line-height: 1.6; 
}

@media (max-width:640px) {
    .alphabet-filter { 
        padding: 10px; 
        gap: 8px; 
        border-radius: 10px; 
    }
    .filter-btn { 
        width: 38px; 
        height: 38px; 
        font-weight: 700; 
    }
    .filter-btn.active { 
        transform: scale(1.03); 
    }
    .category-filter { 
        gap:8px; 
        flex-wrap:wrap; 
    }
}

.glosario-item summary {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    font-weight: 600;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 8px;
    transition: background-color 0.3s ease;
}
.glosario-item summary:hover {
    background: rgba(255, 255, 255, 0.15);
}
.english-term {
    font-weight: 400;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
    font-style: italic;
}
.term-content {
    padding: 0 12px 12px 12px;
}
.glosario-item[open] summary {
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.search-wrapper{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: .25rem 0;
}
.search-input{
    flex: 1;
    min-width: 220px;
    padding: .6rem .8rem;
    border: 1px solid #c9d4ea;
    border-radius: .6rem;
}
#glossary-search-clear{
    display: none;
    padding: .5rem .7rem;
    border: 1px solid #c9d4ea;
    border-radius: .6rem;
    background: #fff;
    cursor: pointer;
}

@media (max-width: 900px){
    .search-input{ flex-basis: 100%; }
}


/* Spinner CSS */

/* Loader */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .8rem 1rem;
    margin: 12px auto;
    width: fit-content;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: saturate(120%) blur(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,.08) inset;
}
.loader[hidden] { 
    display: none; 
}
.loader .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loader .loader-text {
    font-weight: 600;
    color: #fff;
    letter-spacing: .3px;
}

/* Animación */
@keyframes spin {
    to { transform: rotate(360deg); }
}
