/* Asegurar visibilidad inmediata sin bloqueos de AOS */
[data-aos], .mtg-list-item, .mtg-card-wrapper, .mtg-card-inner {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Sistema de Layout Principal */
.library-container {
    display: grid !important;
    grid-template-columns: 320px 1fr !important;
    gap: 28px !important;
    padding: 20px !important;
    max-width: 100% !important;
    align-items: start !important;
    background: var(--bg-dark);
}

.filter-sidebar {
    grid-column: 1 !important;
    width: 320px !important;
    position: sticky !important;
    top: 90px !important;
    max-height: calc(100vh - 110px) !important;
    overflow-y: auto !important;
    z-index: 10 !important;
    background: rgba(15, 18, 25, 0.88) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 22px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-gold) transparent;
}

.gallery-main {
    grid-column: 2 !important;
    min-width: 0 !important;
}

/* Ajustes Responsivos */
@media (max-width: 1200px) {
    .library-container {
        grid-template-columns: 1fr !important;
        padding: 12px !important;
    }

    .filter-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -340px !important;
        width: 320px !important;
        height: 100vh !important;
        max-height: 100vh !important;
        z-index: 1050 !important;
        border-radius: 0 20px 20px 0 !important;
        transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .filter-sidebar.active {
        left: 0 !important;
    }

    .gallery-main {
        grid-column: 1 !important;
    }
}

/* Modos de Vista */
.mtg-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    gap: 20px;
    width: 100%;
}

.mtg-list-view {
    display: block;
    width: 100%;
}

/* Cabecera y Controles de Ordenación */
.gallery-header {
    background: rgba(20, 24, 34, 0.78);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 20px 24px;
    border: 1px solid rgba(212, 175, 55, 0.22);
}

.sort-control {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.sort-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.sort-control option {
    background: #0f131c;
    color: #fff;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.btn-icon.active {
    background: var(--accent-gold);
    color: #0b0e14;
    border-color: #ffe082;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

/* Selector de Colores con Iconos SVG Oficiales */
.color-checkbox {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.22s ease;
    padding: 6px;
}

.color-checkbox:hover {
    transform: translateY(-2px) scale(1.06);
    border-color: rgba(212, 175, 55, 0.6);
}

.color-checkbox.active {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.22);
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.55);
    transform: scale(1.08);
}

.color-filter-svg {
    width: 24px;
    height: 24px;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

/* Símbolos de Maná */
.mana-v2 {
    width: 18px !important;
    height: 18px !important;
    margin: 0 1px !important;
}

/* Etiquetas y Selector de Expansiones */
.filter-label {
    color: var(--accent-gold);
    font-family: 'Marcellus', serif;
    font-size: 0.98rem;
    margin-bottom: 10px;
    display: block;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding-bottom: 5px;
}

.set-selector-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    margin-bottom: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.22s ease;
    position: relative;
}

.set-selector-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(212, 175, 55, 0.3);
}

.set-selector-item.active {
    background: rgba(212, 175, 55, 0.14);
    border: 1px solid var(--accent-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15);
}

.set-radio-input {
    accent-color: var(--accent-gold);
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.set-icon-box {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    color: var(--accent-gold);
    font-size: 1.35rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.set-selector-item:hover .set-icon-box,
.set-selector-item.active .set-icon-box {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--accent-gold);
    color: #ffffff;
}

.set-name-text {
    font-size: 0.83rem;
    line-height: 1.3;
    font-weight: 500;
    color: #d1d5db;
    flex-grow: 1;
    word-break: break-word;
}

.set-selector-item.active .set-name-text {
    color: #ffffff;
    font-weight: 600;
}

.active-indicator {
    display: none;
    color: var(--accent-gold);
    font-size: 0.85rem;
    margin-left: auto;
    flex-shrink: 0;
}

.set-selector-item.active .active-indicator {
    display: inline-block;
}

.mobile-filter-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: #000;
    border: none;
    display: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

@media (max-width: 1200px) {
    .mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Autocompletado Bilingüe */
.autocomplete-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(13, 17, 26, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85);
}

.autocomplete-item {
    padding: 9px 14px;
    cursor: pointer;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.18s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(212, 175, 55, 0.18);
}

.card-name-text:hover {
    color: var(--accent-gold) !important;
}

/* =====================================================================
   Barra de Progreso y Estado de Carga Fluida (Sin Bloqueos)
   ===================================================================== */
.gallery-progress-bar {
    position: sticky;
    top: 72px;
    left: 0;
    right: 0;
    height: 3px;
    width: 100%;
    z-index: 100;
    border-radius: 999px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: -3px;
}

.gallery-progress-bar.is-active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.gallery-progress-bar.is-active::after {
    content: '';
    display: block;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, transparent, #f6e27a, #d4af37, transparent);
    animation: magic-progress-slide 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: 0 0 10px #d4af37;
}

@keyframes magic-progress-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.gallery-main.is-loading #gridView,
.gallery-main.is-loading #listView {
    opacity: 0.55;
    pointer-events: none;
    filter: saturate(90%);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

/* Mejoras visuales en tarjetas del Grimorio */
.mtg-card-inner {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s, border-color 0.25s;
    background: rgba(18, 22, 34, 0.85);
    overflow: hidden;
}

.mtg-card-inner:hover {
    transform: translateY(-6px);
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.7), 0 0 15px rgba(212, 175, 55, 0.2);
}

.card-image-container {
    position: relative;
    aspect-ratio: 488 / 680;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtg-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.mtg-card-inner:hover .mtg-card-img {
    transform: scale(1.04);
}

