.modern-gallery-search {
    margin-bottom: 30px;
    opacity: 0;
    animation: fadeIn 0.6s ease 0.2s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modern-gallery-search-input {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 15px 25px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: block;
    transition: all 0.3s ease;
}

.modern-gallery-search-input:focus {
    outline: none;
    border-color: #172554;
    box-shadow: 0 4px 6px rgba(23, 37, 84, 0.1);
}

.modern-gallery-albums {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 20px;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-gallery-album-preview {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.modern-gallery-album-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #172554;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.modern-gallery-album-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.modern-gallery-album-preview:hover::before {
    transform: scaleX(1);
}

.modern-gallery-album-link {
    text-decoration: none !important;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.modern-gallery-album-link:hover {
    text-decoration: none !important;
}

.modern-gallery-album-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.modern-gallery-album-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.modern-gallery-album-preview:hover .modern-gallery-album-image img {
    transform: scale(1.05);
}

/* --- AJUSTES DE DISEÑO PARA LOS TÍTULOS DE LOS ÁLBUMES --- */
.modern-gallery-album-info {
    padding: 20px;
    background: #fff;
    text-align: center; /* Fuerza el centrado del texto */
}

.modern-gallery-album-title {
    margin: 0 0 10px 0 !important;
    font-size: 16px !important; /* Fuerza un tamaño fijo en píxeles para ignorar el tema */
    font-weight: 800 !important; /* Más negrita para destacar */
    color: #172554 !important;
    text-decoration: none;
    text-transform: uppercase !important; /* Fuerza las mayúsculas como en tu foto */
    line-height: 1.4 !important;
}

.modern-gallery-image-count {
    color: #888 !important;
    font-size: 14px !important;
    text-decoration: none;
    display: block;
}
/* -------------------------------------------------------- */

/* Galería de imágenes */
.modern-gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 30px 50px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.modern-gallery-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #172554, #1e40af);
    border-radius: 16px 16px 0 0;
}

.modern-gallery-title {
    font-size: 2.25em;
    margin-bottom: 20px;
    color: #172554;
    text-align: center;
    font-weight: 600;
    position: relative;
    padding-bottom: 15px;
}

.modern-gallery-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: #172554;
    border-radius: 2px;
}

.modern-gallery-description {
    margin-bottom: 30px;
    color: #666;
    line-height: 1.6;
}

.modern-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 16px;
}

.modern-gallery-back-button {
    text-align: center;
    margin-top: 30px;
}

.modern-gallery-back-button .button {
    display: inline-block;
    padding: 12px 24px;
    background: #172554;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid #172554;
    box-shadow: 0 2px 4px rgba(23, 37, 84, 0.1);
}

.modern-gallery-back-button .button:hover {
    color: #172554;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(23, 37, 84, 0.1);
}

.modern-gallery-back-button .button:focus {
    outline: 3px solid rgba(23, 37, 84, 0.3);
    outline-offset: 2px;
}

.modern-gallery-view-more {
    text-align: center;
    margin-top: 30px;
}

.modern-gallery-view-more .button {
    display: inline-block;
    padding: 12px 24px;
    background: #172554;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid #172554;
    box-shadow: 0 2px 4px rgba(23, 37, 84, 0.1);
}

.modern-gallery-view-more .button:hover {
    background-color: #fff;
    color: #172554 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(23, 37, 84, 0.1);
}

.modern-gallery-view-more .button:focus {
    outline: 3px solid rgba(23, 37, 84, 0.3);
    outline-offset: 2px;
}

.modern-gallery-image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 250px;
}

.modern-gallery-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.modern-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #f3f4f6;
    transition: all 0.3s ease;
    opacity: 1;
    padding: 10px;
}

.modern-gallery-image {
    position: relative;
    overflow: hidden;
}

.modern-gallery-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

.modern-gallery-image.loaded::before {
    display: none;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.modern-gallery-image:hover img {
    transform: scale(1.05);
    opacity: 0.8;
}

/* Modal */
.modern-gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(23, 37, 84, 0.97);
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.modern-gallery-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modern-gallery-modal-content {
    position: relative;
    width: auto;
    max-width: 90%;
    max-height: 85vh;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-gallery-modal.active .modern-gallery-modal-content {
    opacity: 1;
    transform: scale(1);
}

.modern-gallery-modal-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    display: block;
    margin: 0 auto;
}

.modern-gallery-modal-caption {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    text-align: center;
    padding: 12px 30px;
    font-size: 16px;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border-radius: 30px;
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modern-gallery-modal-close,
.modern-gallery-modal-prev,
.modern-gallery-modal-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    outline: none;
    backdrop-filter: blur(4px);
}

.modern-gallery-modal-close {
    top: -50px;
    right: -50px;
    width: 44px;
    height: 44px;
    font-size: 24px;
    border-radius: 50%;
    font-weight: 300;
}

.modern-gallery-modal-prev,
.modern-gallery-modal-next {
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    font-size: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.modern-gallery-modal-prev {
    left: -60px;
}

.modern-gallery-modal-next {
    right: -60px;
}

.modern-gallery-modal-close:hover,
.modern-gallery-modal-prev:hover,
.modern-gallery-modal-next:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.modern-gallery-modal-close:focus,
.modern-gallery-modal-prev:focus,
.modern-gallery-modal-next:focus {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Estilos para lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mejoras de accesibilidad */
.modern-gallery-search-input:focus {
    outline: 3px solid #172554;
    outline-offset: 2px;
}

.modern-gallery-album-link:focus {
    outline: none;
}

.modern-gallery-album-link:focus .modern-gallery-album-preview {
    box-shadow: 0 0 0 3px #172554, 0 6px 16px rgba(0,0,0,0.15);
}

/* Indicador de enfoque personalizado */
.modern-gallery-image:focus-within {
    outline: 3px solid #172554;
    outline-offset: 4px;
    border-radius: 8px;
}

.modern-gallery-modal-prev:hover,
.modern-gallery-modal-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Galería Corporativa */
.modern-gallery-corporate {
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    padding: 40px;
    border-radius: 8px;
    margin: 40px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.modern-gallery-corporate-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 25px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.modern-gallery-corporate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #003875, #005BAA);
    border-radius: 8px 8px 0 0;
}

.modern-gallery-corporate-main img,
.modern-gallery-corporate-item img {
    border-radius: 2px;
    transition: all 0.4s ease;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
}

.modern-gallery-corporate-main:hover img,
.modern-gallery-corporate-item:hover img {
    transform: scale(1.03);
    filter: brightness(1.02);
}

.modern-gallery-corporate-main {
    height: 600px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    padding: 4px;
    line-height: 0;
    display: flex;
}

.modern-gallery-corporate-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.modern-gallery-corporate-main:hover img {
    transform: scale(1.05);
}

.modern-gallery-corporate-side {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
}

.modern-gallery-corporate-item {
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    height: 290px;
    background: #fff;
    padding: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
}

.modern-gallery-corporate-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
}

.modern-gallery-corporate-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.modern-gallery-corporate-item:hover img {
    transform: scale(1.05);
}

/* Responsive para Galería Corporativa */
@media (max-width: 768px) {
    .modern-gallery-corporate {
        padding: 20px;
        margin: 20px 0;
    }

    .modern-gallery-corporate-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modern-gallery-corporate-main {
        height: 400px;
        padding: 6px;
    }

    .modern-gallery-corporate-item {
        height: 200px;
        padding: 4px;
    }

    .modern-gallery-corporate::before {
        height: 2px;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .modern-gallery-container {
        padding: 40px 20px;
    }

    .modern-gallery-title {
        font-size: 2em;
    }

    .modern-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .modern-gallery-container {
        padding: 20px 15px 30px;
        border-radius: 8px;
    }

    .modern-gallery-back-button .button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .modern-gallery-albums {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .modern-gallery-album-image {
        height: 220px;
    }

    .modern-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }

    .modern-gallery-image img {
        height: 200px;
    }

    .modern-gallery-title {
        font-size: 1.75em;
        margin-bottom: 20px;
    }

    .modern-gallery-search-input {
        padding: 12px 20px;
        font-size: 15px;
        margin-bottom: 30px;
    }

    .modern-gallery-modal-content {
        max-width: 95%;
    }

    .modern-gallery-modal-close {
        top: 10px;
        right: 10px;
    }

    .modern-gallery-modal-prev,
    .modern-gallery-modal-next {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    .modern-gallery-modal-caption {
        bottom: 10px;
        padding: 8px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .modern-gallery-container {
        padding: 20px 10px;
    }

    .modern-gallery-albums {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px;
    }

    .modern-gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }

    .modern-gallery-image img {
        height: 180px;
    }

    .modern-gallery-title {
        font-size: 1.5em;
    }

    .modern-gallery-search-input {
        padding: 10px 15px;
        font-size: 14px;
    }
}