/* ==========================================================================
   MODAL PREMIUM FONDITOS - MANUAL DE PRODUCCIÓN UNIFICADO
   ========================================================================== */

/* ==========================================================================
   1. CONTROL DEL BODY (Bloqueo de Precisión Anti-Baile)
   ========================================================================== */
body.modal-open {
    overflow: hidden !important;
    touch-action: none; 
    -webkit-overflow-scrolling: none;
    position: fixed;
    width: 100%;
}

/* ==========================================================================
   2. CONTENEDOR BASE (Glassmorphism Inmersivo)
   ========================================================================== */
#imgModal {
    display: none;
    position: fixed !important;
    inset: 0 !important; 
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    z-index: 3000000;
    background-color: rgba(0, 0, 0, 0.35) !important; /* 🌟 Retoque: Fondo exterior un pelo más traslúcido */
    backdrop-filter: blur(40px) saturate(180%);        /* 🌟 Mantiene el blur intenso AFUERA */
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow-x: hidden !important; 
    overflow-y: auto !important;
    scrollbar-width: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#imgModal::-webkit-scrollbar { 
    display: none; 
}

#imgModal.active { 
    opacity: 1; 
}

/* ==========================================================================
   3. ESTRUCTURA Y ENFOQUE CUBIC-BEZIER (Optimización de Espacio Móvil)
   ========================================================================== */
.modal-content-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 40px 20px; 
    box-sizing: border-box;
    align-items: center;
}

.modal-container-focus {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    transform: translateY(30px) scale(0.98);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.active .modal-container-focus {
    transform: translateY(0) scale(1);
}

/* Por defecto, la galería de abajo de la imagen está APAGADA */
.wide-only-gallery {
    display: none !important;
}

/* La galería interna del panel está ENCENDIDA */
.standard-panel-gallery {
    display: block !important;
    margin-top: 30px;
    margin-bottom: 10px;
}

/* --- ADAPTACIÓN ULTRA-ANSON DE MÓVIL --- */
@media (max-width: 768px) {
    .modal-content-wrapper {
        padding: 16px 10px !important; 
        align-items: flex-start !important;
    }
    .modal-details-panel {
        padding: 20px 16px !important; 
        border-radius: 24px !important; 
    }
    .modal-container-focus {
        gap: 24px !important;
    }
}

/* ==========================================================================
   4. ESCENARIO DE LA IMAGEN (Optimización Rendimiento Puro)
   ========================================================================== */
.image-wrapper {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    /* Esqueleto de Carga Apple: Fondo ultra-ligero mientras descarga */
    background: rgba(255, 255, 255, 0.03);
    border-radius: 28px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.main-view-img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: 28px;
    object-fit: contain;
    position: relative;
    z-index: 2;
    /* Transición limpia por hardware nativo (cero consumo de CPU) */
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    display: block;
}

/* Clase inyectada por JS al completar la carga instantánea */
.main-view-img.loaded {
    opacity: 1;
}

/* Deja el wrapper preparado para el cross-fade sin romper la CPU */
.image-wrapper {
    position: relative;
    overflow: hidden; /* Crucial para que el blur no se desborde */
    background: rgba(255, 255, 255, 0.03);
    border-radius: 28px;
}

/* El placeholder ligero que revivimos para sostener la visualización */
#modalPlaceholder {
    width: 100%;
    height: auto;
    display: block;
    filter: blur(10px); /* Un blur sutil (10px en vez de 40px) no cuesta nada de rendimiento */
    transform: scale(1.03); 
    transition: opacity 0.4s ease;
}

/* ==========================================================================
   5. BOTÓN DE CIERRE (X Circular iOS)
   ========================================================================== */
.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    background: #ff2d55;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(255, 45, 85, 0.4);
    transition: all 0.2s ease;
    border: 2px solid #fff;
}

.close-btn:hover { 
    transform: scale(1.1) rotate(90deg); 
}

/* ==========================================================================
   6. PANEL INFORMATIVO PRINCIPAL
   ========================================================================== */
.modal-details-panel {
    background: rgba(255, 255, 255, 0.02); /* 🌟 Súper fino y cristalino */
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 32px;
    padding: 35px;
    backdrop-filter: blur(6px);         /* 🌟 CORREGIDO: Blur muy suave e imperceptible en el frame */
    -webkit-backdrop-filter: blur(6px); /* 🌟 CORREGIDO: Para Safari en Mac/iPhone */
    display: flex;
    flex-direction: column;
}

.view-info {
    margin-top: 20px;
    text-align: left;
}

.view-title {
    font-size: 1.55rem; /* 🌟 Ajuste Fino: Reducido para evitar gigantismo del tester */
    font-weight: 600;    /* 🌟 Ajuste Fino: Peso tipográfico premium semibold (no tosco bold) */
    margin-bottom: 20px;
    color: #ffffff;
    line-height: 1.25;
    letter-spacing: -0.2px;
}

.view-author {
    font-size: 0.85rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

/* ==========================================================================
   7. SECCIÓN CATEGORÍAS Y ETIQUETAS (TAGS)
   ========================================================================== */
.view-tags-title {
    font-size: 0.68rem; /* 🌟 Ajuste Fino: Un toque más chico */
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.view-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.view-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px; /* 🌟 Ajuste Fino: Más compacto y elegante */
    background: rgba(255, 255, 255, 0.06); 
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.85); /* 🌟 Letras más suaves */
    text-decoration: none;
    font-size: 0.85rem; /* 🌟 Fuente refinada */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-tag i { 
    font-size: 0.95rem;
    color: #ff0055; /* Rosa Fonditos */
}

.view-tag:hover {
    background: #ff0055;
    border-color: #ff0055;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 85, 0.3);
}

.view-tag:hover i {
    color: #ffffff;
}

/* ==========================================================================
   8. SISTEMA DE COMPARTIDO HÍBRIDO (Share Premium + Dropdown)
   ========================================================================== */
.view-category-container {
    width: 100% !important;
    margin-bottom: 15px !important;
    display: block !important;
}

.view-tags-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    margin-top: 5px !important;
}

.share-wrapper {
    position: relative !important;
    display: inline-block !important;
}

.share-btn-hybrid {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 0 14px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    height: 34px !important;
    box-sizing: border-box !important;
}

.share-btn-hybrid i {
    color: #ffffff !important;
    font-size: 15px !important;
}

.share-btn-text {
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
}

.share-btn-hybrid:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Menú Desplegable Flotante */
.share-dropdown {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    right: 0 !important;
    background: rgba(20, 20, 20, 0.75) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    width: 160px !important;
    padding: 6px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-8px) !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
}

.share-dropdown.active {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

.share-dropdown button {
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    padding: 8px 12px !important;
    text-align: left !important;
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.share-dropdown button i {
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

.share-dropdown button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

/* ==========================================================================
   9. GRID DE RESOLUCIONES (Soporte Nativo inyectado por JS/PHP)
   ========================================================================== */
#resolutionMenu, .resolutions-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 10px !important;
    margin-top: 20px !important;
    width: 100% !important;
}

#resolutionMenu > a, .resolutions-grid > a {
    background: rgba(255, 255, 255, 0.04) !important; /* Un pelo más translúcido */
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 10px 8px !important; 
    border-radius: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    color: #ffffff !important;
    box-sizing: border-box !important;
}

#resolutionMenu a:hover, .resolutions-grid a:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-2px) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* 🌟 SUAVIZADO: Texto de resolución más fino y elegante */
#resolutionMenu strong, .resolutions-grid strong {
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 0.82rem !important;  /* Un pelín más pequeño */
    font-weight: 400 !important;   /* Peso fino (estilo Apple de producción) */
    letter-spacing: -0.1px !important;
    margin-bottom: 3px !important;
    display: block !important;
}

/* 🌟 SUAVIZADO: Subtexto más sutil y menos brillante */
#resolutionMenu small, .resolutions-grid small {
    color: rgba(255, 255, 255, 0.35) !important; /* Gris translúcido suave */
    font-size: 0.62rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    font-weight: 500 !important;
    display: block !important;
}

/* Toque Rosa Exclusivo Resolución Teléfono */
#resolutionMenu > .phone-btn, .resolutions-grid > .phone-btn {
    background: rgba(255, 0, 85, 0.08) !important; 
    border-color: rgba(255, 0, 85, 0.15) !important;
}

#resolutionMenu > .phone-btn strong, .resolutions-grid > .phone-btn strong {
    color: #ff0055 !important;
    font-weight: 500 !important; /* Fino pero destacado por el color */
}

#resolutionMenu > .phone-btn small, .resolutions-grid > .phone-btn small {
    color: rgba(255, 0, 85, 0.5) !important;
}

#resolutionMenu > .phone-btn:hover, .resolutions-grid > .phone-btn:hover {
    background: #ff0055 !important;
    border-color: #ff0055 !important;
    box-shadow: 0 4px 12px rgba(255, 0, 85, 0.25) !important;
}

#resolutionMenu > .phone-btn:hover strong, .resolutions-grid > .phone-btn:hover strong,
#resolutionMenu > .phone-btn:hover small, .resolutions-grid > .phone-btn:hover small {
    color: #ffffff !important;
}
/* ==========================================================================
   10. GRID DE COMPONENTES RELACIONADOS (Efecto Enfoque Lumínico Premium)
   ========================================================================== */
#modalRelatedGrid {
    display: grid !important;
    gap: 12px !important;
    margin-top: 20px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.related-item {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    position: relative;
    outline: 1px solid rgba(255, 255, 255, 0.08);
    outline-offset: -1px;
    transition: outline 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.related-item:hover {
    outline: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.1);
}

.related-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    opacity: 0.75;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.related-item:hover img {
    opacity: 1;
    filter: brightness(1.05);
}

.related-item.is-vertical { aspect-ratio: 9 / 16 !important; }
.related-item.is-horizontal { aspect-ratio: 16 / 9 !important; }

/* ==========================================================================
   11. COMPORTAMIENTO MODO CLARO GLOBAL (Apple Style Light)
   ========================================================================== */
@media (prefers-color-scheme: light), body.light-mode {
    #imgModal {
        background-color: rgba(255, 255, 255, 0.45) !important;
    }
    .wall-title-display, .view-title, #resolutionMenu strong, .resolutions-grid strong {
        color: #1d1d1f !important;
    }
    .view-tags-title {
        color: rgba(0, 0, 0, 0.5) !important;
    }
    .view-tag {
        background: rgba(0, 0, 0, 0.04) !important;
        border: 1px solid rgba(0, 0, 0, 0.06) !important;
        color: #333333 !important;
    }
    .view-tag:hover {
        background: #ff0055 !important;
        border-color: #ff0055 !important;
        color: #ffffff !important;
    }
    .view-author {
        color: #555555 !important;
    }
    .share-btn-hybrid {
        background: rgba(0, 0, 0, 0.04) !important;
        border-color: rgba(0, 0, 0, 0.06) !important;
    }
    .share-btn-hybrid i, .share-btn-text { 
        color: #1d1d1f !important; 
    }
    .share-btn-hybrid:hover { 
        background: rgba(0, 0, 0, 0.07) !important; 
    }
    .share-dropdown {
        background: rgba(255, 255, 255, 0.8) !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    }
    .share-dropdown button { color: #1d1d1f !important; }
    .share-dropdown button i { color: rgba(0, 0, 0, 0.5) !important; }
    .share-dropdown button:hover { background: rgba(0, 0, 0, 0.05) !important; }
    
    #resolutionMenu > *, .resolutions-grid > *, #resolutionMenu a, .resolutions-grid a {
        background: rgba(0, 0, 0, 0.04) !important;
        border-color: rgba(0, 0, 0, 0.06) !important;
        color: #1d1d1f !important;
    }
    #resolutionMenu small, .resolutions-grid small { color: rgba(0, 0, 0, 0.4) !important; }
    #resolutionMenu > *:hover, .resolutions-grid > *:hover { background: rgba(0, 0, 0, 0.07) !important; }
    
    #resolutionMenu > .phone-btn, .resolutions-grid > .phone-btn {
        background: rgba(255, 0, 85, 0.06) !important;
        border-color: rgba(255, 0, 85, 0.15) !important;
    }
    #resolutionMenu > .phone-btn strong, .resolutions-grid > .phone-btn strong { color: #ff0055 !important; }
    #resolutionMenu > .phone-btn small, .resolutions-grid > .phone-btn small { color: rgba(255, 0, 85, 0.5) !important; }
    #resolutionMenu > .phone-btn:hover, .resolutions-grid > .phone-btn:hover { background: #ff0055 !important; border-color: #ff0055 !important; }
    #resolutionMenu > .phone-btn:hover strong, .resolutions-grid > .phone-btn:hover strong, #resolutionMenu > .phone-btn:hover small, .resolutions-grid > .phone-btn:hover small { color: #ffffff !important; }

    #modalRelatedGrid .related-item {
        background: rgba(0, 0, 0, 0.03) !important;
        outline: 1px solid rgba(0, 0, 0, 0.06) !important;
    }
    #modalRelatedGrid .related-item img {
        opacity: 0.95 !important; 
        filter: none !important;
    }
    #modalRelatedGrid .related-item:hover img {
        opacity: 1 !important;
        filter: brightness(1.02) !important;
    }

    .modal-details-panel h2, 
    .modal-details-panel h3, 
    .modal-details-panel .view-info + div h3 {
        color: #1d1d1f !important;
        opacity: 1 !important;
    }

    .modal-details-panel button[class*="color"], 
    .modal-details-panel a[class*="color"],
    .modal-details-panel div[style*="background"] + div a { 
        background: rgba(0, 0, 0, 0.04) !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        color: #1d1d1f !important;
        opacity: 1 !important;
    }

    #modalRelatedGridWide {
        background: rgba(0, 0, 0, 0.02) !important; 
        border: 1px solid rgba(0, 0, 0, 0.05) !important; 
    }
}

/* ==========================================================================
   12. MEDIA QUERIES RESPONSIVE (Optimizaciones PC y Móvil)
   ========================================================================== */

/* --- AJUSTES EXCLUSIVOS PARA PANTALLAS GRANDES (PC) --- */
@media (min-width: 769px) {
    .share-wrapper {
        transform: translateY(-2px) !important;
    }
    .share-wrapper:hover {
        transform: translateY(-3px) !important;
    }
}

/* --- AJUSTES EXCLUSIVOS PARA MÓVILES --- */
@media (max-width: 768px) {
    .share-btn-text {
        display: none !important;
    }
    
    .share-btn-hybrid {
        width: 36px !important;
        padding: 0 !important;
    }

    #resolutionMenu, .resolutions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    #modalRelatedGrid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important; 
        padding: 0 2px !important; 
    }

    .related-item.is-collection-thumb {
        aspect-ratio: 16 / 10 !important;
    }

    .related-item {
        aspect-ratio: 2 / 3; 
        overflow: hidden;
        border-radius: 8px;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), filter 0.25s ease;
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
        touch-action: manipulation !important; 
        -webkit-touch-callout: none !important; 
        pointer-events: auto !important;
        -webkit-user-select: none;
        user-select: none;
        -webkit-transform-style: preserve-3d;
        transform-style: preserve-3d;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .related-thumb {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        pointer-events: auto !important; 
        -webkit-touch-callout: none !important; 
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), filter 0.25s ease !important;
    }

    .related-item:active,
    .related-item:focus-within,
    .related-item:hover,
    .related-item:active .related-thumb,
    .related-item:focus-within .related-thumb,
    .related-item:hover .related-thumb {
        transform: scale(0.88) translateZ(0) !important;
    }

    .related-item:active,
    .related-item:focus-within,
    .related-item:hover {
        filter: brightness(0.65) contrast(1.15) !important;
        box-shadow: inset 0 8px 20px rgba(0, 0, 0, 0.7) !important;
    }
    
    @media (prefers-color-scheme: light), body.light-mode {
        .related-item:active,
        .related-item:focus-within,
        .related-item:hover {
            filter: brightness(0.8) contrast(1.1) !important;
            box-shadow: inset 0 6px 16px rgba(0, 0, 0, 0.25) !important;
        }
    }
}

/* ==========================================================================
   12b. OPTIMIZACIÓN MODO HORIZONTAL: ESTIRADO Y AJUSTE MAX DE IMAGEN
   ========================================================================== */
@media (min-width: 1024px) {
    
    .standard-panel-gallery {
        display: none !important;
    }
    
    .wide-only-gallery {
        display: block !important;
    }

    /* 🌟 CORREGIDO: Fuerza el centrado absoluto horizontal y vertical en pantallas grandes */
    .modal-content-wrapper {
        display: flex !important;
        justify-content: center !important; 
        align-items: center !important;     
        min-height: 100vh !important;
        padding: 40px 30px !important; 
        box-sizing: border-box !important;
    }

    /* 🌟 CORREGIDO: Añadido margin: 0 auto de seguridad y estiramiento controlado */
    .modal-container-focus {
        max-width: 1400px !important; 
        width: 100% !important;
        margin: 0 auto !important;    
        display: flex !important;
        flex-direction: row !important; 
        align-items: stretch !important; 
        gap: 40px !important; 
    }

    /* Columna Izquierda: Distribución simétrica expandida */
    .modal-left-column {
        display: flex !important;
        flex: 1 !important; 
        flex-direction: column !important;
        justify-content: flex-start !important; 
        align-items: stretch !important; 
        gap: 30px !important; 
        width: 100% !important;
    }

    /* Envoltura de la imagen: Máscara elástica obligatoria */
    .image-wrapper {
        width: 100% !important;
        max-height: 68vh !important; 
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 0 !important;
        overflow: hidden !important; 
        border-radius: 24px !important; 
        clip-path: inset(0% 0% 0% 0% round 24px) !important; 
        background: transparent !important;
        border: none !important;            
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25) !important; 
        flex-grow: 0 !important;
        flex-shrink: 0 !important;
    }

    /* La Imagen: ¡ESTIRADO COMPLETO Y TOTALMENTE NIVELADO! */
    .main-view-img {
        width: 100% !important;        
        height: 100% !important;       
        max-height: 68vh !important;  
        object-fit: cover !important; 
        border-radius: 24px !important; 
        filter: none !important; 
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
    }

    /* Columna Identificativa de Detalles (Derecha) */
    .modal-details-panel {
        width: 320px !important;     
        min-width: 320px !important; 
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        position: relative !important;
        top: 0 !important;
        padding: 28px !important;    
    }

   /* ¡FIX DE RESOLUCIONES EN ESCRITORIO CON TEXTO SUAVIZADO! */
    #resolutionMenu, .resolutions-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 12px !important;                              
        width: 100% !important;
    }

    #resolutionMenu > a, .resolutions-grid > a {
        flex-direction: column !important;                 
        justify-content: center !important;
        align-items: center !important;
        padding: 12px 8px !important;                     
        height: auto !important;
    }
    
    #resolutionMenu strong, .resolutions-grid strong {
        font-size: 0.85rem !important; /* Ajuste óptico para PC */
        font-weight: 400 !important;   /* Mantiene la finura */
    }

    /* Grid de relacionados ancho con bloque blur unificado */
    #modalRelatedGridWide {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 14px !important; 
        margin-top: 0 !important; 
        width: 100% !important;
        background: rgba(255, 255, 255, 0.03) !important; 
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        backdrop-filter: blur(15px) !important;       
        -webkit-backdrop-filter: blur(15px) !important; 
        border-radius: 24px !important;               
        padding: 20px !important;                      
        box-sizing: border-box !important;
    }
}
/* ==========================================================================
   13. COMPONENTES EXTRA / MISCELÁNEA
   ========================================================================== */
.search-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* 1. Clase que le aplicaremos al BODY cuando el modal esté abierto */
body.modal-prevent-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    overscroll-behavior: none !important; 
}

/* 2. Asegurar que el contenedor del modal tenga scroll suave y no contagie el rebote al fondo */
#imgModal {
    overscroll-behavior: contain !important; 
    -webkit-overflow-scrolling: touch !important; 
}

.fmc-modal {
    display: none !important;
    pointer-events: none; 
}
.fmc-modal.fmc-active {
    display: block !important;
    pointer-events: auto;
}

/* ==========================================================================
   14. LOADING DEL MODAL (Estilo Apple / Ultra-Smooth)
   ========================================================================== */
.modal-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px; 
    height: 32px;
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    border-top-color: #ff2d55; 
    animation: modalSpin 0.7s linear infinite;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%);
    backdrop-filter: blur(4px);
    transition: opacity 0.25s ease, visibility 0.25s;
    z-index: 10;
}

@keyframes modalSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-color-scheme: dark) {
    .modal-loader {
        border-color: rgba(255, 255, 255, 0.08);
        border-top-color: #ff2d55; 
    }
}

/* ==========================================================================
   ⚙️ CLASES DE SOPORTE PARA EL FETCH (Limpias para evitar parpadeos en móvil)
   ========================================================================== */
.modal-preload-hidden {
    display: none !important;
}

.modal-preload-visible {
    display: block !important;
}

.modal-preload-visible #modalInfoContent,
.modal-preload-visible .modal-resolutions-section,
.modal-preload-visible #modal-collections-container,
.modal-preload-visible #modalColorsArea,
.modal-preload-visible .standard-panel-gallery {
    animation: emersiónPremium 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    will-change: opacity, transform;
}

#modalInfoContent,
.modal-resolutions-section,
#modal-collections-container,
#modalColorsArea,
.standard-panel-gallery {
    opacity: 0;
    transform: translateY(12px);
}

@keyframes emersiónPremium {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-details-panel {
    display: flex;
    flex-direction: column;
}

#modalInfoContent { order: 1; }
.modal-resolutions-section { order: 2; }
#modal-collections-container { order: 3; }
#modalColorsArea { order: 4; }
.standard-panel-gallery { order: 5; }

/* ==========================================================================
   ⚡ SISTEMA ANTI-BRINCOS & PREVISUALIZACIÓN SUAVE (Global Modal)
   ========================================================================== */
.modal-preview-area {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.03);
    overflow: hidden;
    position: relative;
    width: 100%;
    min-height: 450px; 
}

#modalPlaceholder {
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    filter: blur(15px);
    transform: scale(1.05); 
    position: absolute;
    z-index: 1;
    display: block;
}

img#modalImage.modal-main-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    width: auto;
    height: auto;
    display: block;
    position: relative;
    z-index: 2; 
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: opacity;
    transition: opacity 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.modal-preload-hidden {
    display: none !important; 
}

.modal-preload-visible {
    display: block !important;
}

#modalLoader {
    position: absolute;
    z-index: 10;
    transition: opacity 0.25s ease;
}

/* ==========================================================================
   🗂️ MINI CARPETAS APILADAS 3D EN MODAL (Estilo Compacto & Premium)
   ========================================================================== */
.modal-collections-section {
    margin-top: 30px; 
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 20px; 
}

.modal-collections-title {
    font-size: 0.72rem; /* 🌟 Ajuste Fino */
    font-weight: 600;
    color: #111;
    letter-spacing: 1px;
    opacity: 0.4;
    text-transform: uppercase;
}

.modal-collections-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px; 
}

.modal-col-card {
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    outline: none;
    width: 100%;
    max-width: 240px; 
    margin: 0 auto;
}

.modal-stack-container {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 16 / 10 !important;
    z-index: 1;
}

.modal-stack-clip {
    position: absolute !important;
    inset: 0;
    border-radius: 12px; 
    overflow: hidden !important;
    z-index: 10;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal-stack-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; 
    display: block;
}

.modal-stack-bg {
    position: absolute !important;
    inset: 0;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal-stack-middle {
    z-index: 5;
    transform: rotate(-2.5deg) translateX(-5px) translateY(-3px);
    filter: brightness(0.85);
}

.modal-stack-bottom {
    z-index: 2;
    transform: rotate(4deg) translateX(6px) translateY(-4px);
    filter: brightness(0.7);
}

.modal-col-info {
    text-align: left;
    padding: 12px 2px 0 2px; 
}

.modal-col-title {
    display: block;
    font-size: 0.85rem; /* 🌟 Ajuste Fino */
    font-weight: 500;    /* 🌟 Ajuste Fino: Más delgado */
    color: #111;
    letter-spacing: -0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (hover: hover) {
    .modal-col-card:hover .modal-stack-clip {
        transform: translateY(-5px) scale(1.01);
    }
    .modal-col-card:hover .modal-stack-middle {
        transform: rotate(-5deg) translateX(-14px) translateY(-6px);
        filter: brightness(1);
    }
    .modal-col-card:hover .modal-stack-bottom {
        transform: rotate(7deg) translateX(16px) translateY(-8px);
        filter: brightness(0.8);
    }
}

@media (prefers-color-scheme: dark) {
    .modal-collections-section { border-top-color: rgba(255, 255, 255, 0.08); }
    .modal-collections-title { color: #fff; opacity: 0.5; }
    .modal-col-title { color: #fff; }
}

/* ==========================================================================
   📱 RESPONSIVE - COMPORTAMIENTO PARA TABLETS Y MÓVILES
   ========================================================================== */
@media (max-width: 1023px) {
    #modalInfoContent { order: 1; margin-bottom: 20px; }
    .modal-resolutions-section { order: 2; margin-bottom: 25px; }
    .standard-panel-gallery { order: 3; margin-bottom: 25px; }
    #modal-collections-container { order: 4; margin-top: 15px; margin-bottom: 20px; }
    #modalColorsArea { order: 5; margin-top: 15px; }

    .modal-collections-grid {
        flex-direction: row;
        gap: 15px;
    }
    
    .modal-col-card {
        width: 50%;
    }
    
    .modal-stack-container {
        aspect-ratio: 16 / 11 !important;
    }
}

@media (prefers-color-scheme: dark) {
    .modal-preview-area { background-color: rgba(255, 255, 255, 0.01); }
    .modal-collections-section { border-top-color: rgba(255, 255, 255, 0.08); }
    .modal-collections-title { color: #fff; opacity: 0.5; }
    .modal-col-title { color: #fff; }
}

/* ==========================================================================
   ⚙️ FONDITOS.ME - TIPOGRAFÍA PREMIUM DE RESOLUCIONES (MODO DINÁMICO)
   ========================================================================== */
.modal-resolutions-btn-title {
    display: block !important;
    font-size: 0.92rem !important;  /* 🌟 Ajuste Fino: Estética compactada */
    font-weight: 500 !important;   /* 🌟 Ajuste Fino: Finura tipográfica Apple */
    letter-spacing: -0.1px !important;
    color: inherit !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

.modal-resolutions-btn-subtitle {
    display: block !important;
    font-size: 0.68rem !important;  /* 🌟 Ajuste Fino */
    font-weight: 500 !important;
    color: rgba(255, 255, 255, 0.4) !important;
    margin: 0 !important;
    padding: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    line-height: 1 !important;
}

@media (prefers-color-scheme: light) {
    .modal-resolutions-btn-subtitle {
        color: #86868b !important;
        font-weight: 500 !important;
    }
}

#resolutionMenu a, 
#resolutionMenu .resolution-item, 
#resolutionMenu button {
    color: #434345;
}

/* ⚙️ FONDITOS.ME - GRID DE COLORES FLEXIBLE NATIVO */
#modalColorsGrid,
.modal-colors-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin-top: 10px !important;
}

#modalColorsGrid a,
#modalColorsGrid button,
.modal-colors-grid a,
.modal-colors-grid button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 calc(50% - 4px) !important;
    min-width: 120px !important;
    height: 34px !important; /* 🌟 Ajuste Fino: Botones de colores un pelo más delgados */
    margin: 0 !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
    font-size: 0.85rem !important; /* 🌟 Texto de colores más fino */
    font-weight: 500 !important;
    border-radius: 20px !important; /* 🌟 Redondeado perfecto y liso */
}

#modalColorsGrid a:last-child:nth-child(odd),
#modalColorsGrid button:last-child:nth-child(odd),
.modal-colors-grid a:last-child:nth-child(odd),
.modal-colors-grid button:last-child:nth-child(odd) {
    flex: 1 1 100% !important;
}