:root {
    --color-primario: #0056b3;
    --color-fondo: #f4f4f9;
    --color-texto: #333;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--color-fondo);
    color: var(--color-texto);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    .gallery-header h1 { font-size: 1.5rem; }
    .gallery-img { height: 160px !important; }
}

.gallery-header {
    text-align: center;
    padding: 15px 10px;
    background: white;
    border-bottom: 2px solid #ddd;
}

.gallery-header h1 { margin: 0; color: var(--color-primario); }
.gallery-header p { margin: 5px 0 0; font-size: 0.9rem; color: #666; }

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #666;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color-primario);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover { transform: translateY(-3px); }

.gallery-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.gallery-info {
    padding: 8px;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.3;
}

.gallery-info strong { color: var(--color-primario); display: block; margin-bottom: 2px; }

.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.98);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: stretch; 
}

@media (max-width: 768px) {
    .modal {
        background: black;
    }
}

.loader-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.photo-modal-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px; 
    margin: 0 auto;
    position: relative;
    padding-top: 40px; 
    justify-content: space-between; 
}

.modal-close {
    position: absolute;
    top: 10px; right: 20px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 1005;
    opacity: 0.7;
}

.modal-close:hover { opacity: 1; }

.photo-viewport {
    flex: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    position: relative;
}

#photo-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    transition: background 0.2s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent; 
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.4); }
.nav-btn:active { transform: translateY(-50%) scale(0.9); }

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

@media (max-width: 768px) {
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.1);
    }
    .prev-btn { left: 8px; }
    .next-btn { right: 8px; }
}

.modal-carousel-container {
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.carousel-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-behavior: smooth;
    width: 100%;
}

.carousel-list::-webkit-scrollbar { display: none; }
.carousel-list { -ms-overflow-style: none; scrollbar-width: none; }

.carousel-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s, border 0.2s;
    flex-shrink: 0; 
}

.carousel-thumb.active {
    opacity: 1;
    border-color: #4caf50; 
}

.carousel-thumb:hover:not(.active) { opacity: 0.9; }

.photo-controls {
    padding: 15px 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
    background: #0a0a0a;
}

@media (max-width: 768px) {
    .photo-controls {
        padding: 10px;
        padding-bottom: env(safe-area-inset-bottom, 10px); 
    }
}

.btn-action {
    flex: 1;
    max-width: 200px;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download { background: white; color: black; }
.btn-share { background: #25D366; color: white; }


:root {
    --color-primario: #0056b3;
    --color-fondo: #f4f4f9;
    --color-texto: #333;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--color-fondo);
    color: var(--color-texto);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    .gallery-header h1 { font-size: 1.5rem; }
    .gallery-img { height: 160px !important; }
}

.gallery-header {
    text-align: center;
    padding: 15px 10px;
    background: white;
    border-bottom: 2px solid #ddd;
}

.gallery-header h1 { margin: 0; color: var(--color-primario); }
.gallery-header p { margin: 5px 0 0; font-size: 0.9rem; color: #666; }

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #666;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color-primario);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover { transform: translateY(-3px); }

.gallery-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.gallery-info {
    padding: 8px;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.3;
}

.gallery-info strong { color: var(--color-primario); display: block; margin-bottom: 2px; }

.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.98);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: stretch; 
}

@media (max-width: 768px) {
    .modal {
        background: black;
    }
}

.loader-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.photo-modal-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px; 
    margin: 0 auto;
    position: relative;
    padding-top: 40px; 
    justify-content: space-between; 
}

.modal-close {
    position: absolute;
    top: 10px; right: 20px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 1005;
    opacity: 0.7;
}

.modal-close:hover { opacity: 1; }

.photo-viewport {
    flex: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    position: relative;
}

#photo-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    transition: background 0.2s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent; 
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.4); }
.nav-btn:active { transform: translateY(-50%) scale(0.9); }

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

@media (max-width: 768px) {
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.1);
    }
    .prev-btn { left: 8px; }
    .next-btn { right: 8px; }
}

.modal-carousel-container {
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.carousel-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-behavior: smooth;
    width: 100%;
}

.carousel-list::-webkit-scrollbar { display: none; }
.carousel-list { -ms-overflow-style: none; scrollbar-width: none; }

.carousel-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s, border 0.2s;
    flex-shrink: 0; 
}

.carousel-thumb.active {
    opacity: 1;
    border-color: #4caf50; 
}

.carousel-thumb:hover:not(.active) { opacity: 0.9; }

.photo-controls {
    padding: 15px 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
    background: #0a0a0a;
}

@media (max-width: 768px) {
    .photo-controls {
        padding: 10px;
        padding-bottom: env(safe-area-inset-bottom, 10px); 
    }
}

.btn-action {
    flex: 1;
    max-width: 200px;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download { background: white; color: black; }
.btn-share { background: #25D366; color: white; }

/* NUEVO: Estilos para la fecha y hora flotante */
.overlay-datetime {
    position: absolute;
    top: 15px;
    left: 20px;
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    z-index: 1004; 
    margin: 0;
    pointer-events: none;
}


:root {
    --color-primario: #0056b3;
    --color-fondo: #f4f4f9;
    --color-texto: #333;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--color-fondo);
    color: var(--color-texto);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    .gallery-header h1 { font-size: 1.5rem; }
    .gallery-img { height: 160px !important; }
}

.gallery-header {
    text-align: center;
    padding: 15px 10px;
    background: white;
    border-bottom: 2px solid #ddd;
}

.gallery-header h1 { margin: 0; color: var(--color-primario); }
.gallery-header p { margin: 5px 0 0; font-size: 0.9rem; color: #666; }

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #666;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color-primario);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover { transform: translateY(-3px); }

.gallery-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.gallery-info {
    padding: 8px;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.3;
}

.gallery-info strong { color: var(--color-primario); display: block; margin-bottom: 2px; }

.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.98);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: stretch; 
}

@media (max-width: 768px) {
    .modal {
        background: black;
    }
}

.loader-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.photo-modal-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px; 
    margin: 0 auto;
    position: relative;
    padding-top: 40px; 
    justify-content: space-between; 
}

.modal-close {
    position: absolute;
    top: 10px; right: 20px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 1005;
    opacity: 0.7;
}

.modal-close:hover { opacity: 1; }

.photo-viewport {
    flex: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    position: relative;
}

#photo-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    transition: background 0.2s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent; 
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.4); }
.nav-btn:active { transform: translateY(-50%) scale(0.9); }

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

@media (max-width: 768px) {
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.1);
    }
    .prev-btn { left: 8px; }
    .next-btn { right: 8px; }
}

.modal-carousel-container {
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.carousel-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-behavior: smooth;
    width: 100%;
}

.carousel-list::-webkit-scrollbar { display: none; }
.carousel-list { -ms-overflow-style: none; scrollbar-width: none; }

.carousel-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s, border 0.2s;
    flex-shrink: 0; 
}

.carousel-thumb.active {
    opacity: 1;
    border-color: #4caf50; 
}

.carousel-thumb:hover:not(.active) { opacity: 0.9; }

.photo-controls {
    padding: 15px 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
    background: #0a0a0a;
}

@media (max-width: 768px) {
    .photo-controls {
        padding: 10px;
        padding-bottom: env(safe-area-inset-bottom, 10px); 
        gap: 8px;
    }
    .btn-action {
        font-size: 0.8rem !important; /* Achicamos texto para que entren 3 botones */
        padding: 10px !important;
    }
}

.btn-action {
    flex: 1;
    max-width: 200px;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download { background: white; color: black; }
.btn-share { background: #25D366; color: white; }
.btn-autoplay { background: #f39c12; color: white; } /* Botón naranja por defecto (Pausar) */

.overlay-datetime {
    position: absolute;
    top: 15px;
    left: 20px;
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    z-index: 1004; 
    margin: 0;
    pointer-events: none;
}

:root {
    --color-primario: #0056b3;
    --color-fondo: #f4f4f9;
    --color-texto: #333;
}

html {
    background-color: var(--color-fondo);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: transparent; 
    color: var(--color-texto);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

.site-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0; 
    background-repeat: repeat;
    opacity: 0.45; 
    pointer-events: none; 
}

.gallery-header, .loader-container, .gallery-grid {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 16px !important; 
        padding: 10px !important;
    }
    .gallery-header h1 { font-size: 1.5rem; }
    .gallery-img { height: 180px !important; }
}

.gallery-header {
    text-align: center;
    padding: 15px 10px;
    background: white;
    border-bottom: 2px solid #ddd;
}

.gallery-header h1 { margin: 0; color: var(--color-primario); }
.gallery-header p { margin: 5px 0 0; font-size: 0.9rem; color: #666; }

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #666;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color-primario);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px; 
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    position: relative; 
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(0,0,0,0.2); 
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.gallery-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 25px 12px 12px 12px;
    font-size: 0.85rem;
    text-align: left;
    line-height: 1.3;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent); 
    color: white;
    box-sizing: border-box;
}

.gallery-info strong { 
    color: #4caf50; 
    display: block; 
    margin-bottom: 3px; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    font-size: 0.95rem;
}

.gallery-info span { 
    color: #eee; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
}

.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #080808; 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: stretch; 
}

.modal-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    background-repeat: repeat;
    opacity: 0.35; 
    pointer-events: none;
}

.loader-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.photo-modal-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px; 
    margin: 0 auto;
    position: relative;
    padding-top: 40px; 
    justify-content: space-between; 
    z-index: 1; 
}

.modal-close {
    position: absolute;
    top: 10px; right: 20px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 1005;
    opacity: 0.7;
}

.modal-close:hover { opacity: 1; }

.photo-viewport {
    flex: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    position: relative;
}

#photo-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    transition: background 0.2s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent; 
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.4); }
.nav-btn:active { transform: translateY(-50%) scale(0.9); }

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

@media (max-width: 768px) {
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.1);
    }
    .prev-btn { left: 8px; }
    .next-btn { right: 8px; }
}

.modal-carousel-container {
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.carousel-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-behavior: smooth;
    width: 100%;
}

.carousel-list::-webkit-scrollbar { display: none; }
.carousel-list { -ms-overflow-style: none; scrollbar-width: none; }

.carousel-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s, border 0.2s;
    flex-shrink: 0; 
}

.carousel-thumb.active {
    opacity: 1;
    border-color: #4caf50; 
}

.carousel-thumb:hover:not(.active) { opacity: 0.9; }

/* NUEVO FLEX-BOX PARA LOS 4 BOTONES */
.photo-controls {
    padding: 15px 10px;
    display: flex;
    flex-wrap: wrap; /* Permite saltar de línea en celular */
    justify-content: center;
    gap: 10px;
    background: #0a0a0a;
}

@media (max-width: 768px) {
    .photo-controls {
        padding: 10px;
        padding-bottom: env(safe-area-inset-bottom, 10px); 
    }
    .btn-action {
        flex: 1 1 calc(50% - 10px) !important; /* Dos columnas en móvil */
        font-size: 0.85rem !important;
        padding: 10px !important;
    }
}

.btn-action {
    flex: 1;
    max-width: 200px;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download { background: white; color: black; }
.btn-share { background: #25D366; color: white; }
.btn-autoplay { background: #f39c12; color: white; } 
.btn-mode { background: #8e44ad; color: white; } /* Botón de Foto Completa (Morado) */

.overlay-datetime {
    position: absolute;
    top: 15px;
    left: 20px;
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    z-index: 1004; 
    margin: 0;
    pointer-events: none;
}


:root {
    --color-primario: #0056b3;
    --color-fondo: #f4f4f9;
    --color-texto: #333;
}

html {
    background-color: var(--color-fondo);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: transparent; 
    color: var(--color-texto);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

.site-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0; 
    background-repeat: repeat;
    opacity: 0.45; 
    pointer-events: none; 
}

.gallery-header, .loader-container, .gallery-grid {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 16px !important; 
        padding: 10px !important;
    }
    .gallery-header h1 { font-size: 1.1rem !important; } /* Aún más chico en móviles */
    .gallery-img { height: 180px !important; }
}

.gallery-header {
    text-align: center;
    padding: 15px 10px;
    background: white;
    border-bottom: 2px solid #ddd;
}

/* TITULO REDUCIDO EN ESCRITORIO */
.gallery-header h1 { margin: 0; color: var(--color-primario); font-size: 1.4rem; }
.gallery-header p { margin: 5px 0 0; font-size: 0.9rem; color: #666; }

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #666;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color-primario);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px; 
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    position: relative; 
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(0,0,0,0.2); 
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.gallery-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 25px 12px 12px 12px;
    font-size: 0.85rem;
    text-align: left;
    line-height: 1.3;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent); 
    color: white;
    box-sizing: border-box;
}

.gallery-info strong { 
    color: #4caf50; 
    display: block; 
    margin-bottom: 3px; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    font-size: 0.95rem;
}

.gallery-info span { 
    color: #eee; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
}

.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #080808; 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: stretch; 
}

.modal-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    background-repeat: repeat;
    opacity: 0.35; 
    pointer-events: none;
}

.loader-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.photo-modal-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px; 
    margin: 0 auto;
    position: relative;
    padding-top: 40px; 
    justify-content: space-between; 
    z-index: 1; 
}

.modal-close {
    position: absolute;
    top: 10px; right: 20px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 1005;
    opacity: 0.7;
}

.modal-close:hover { opacity: 1; }

.photo-viewport {
    flex: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    position: relative;
}

#photo-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    transition: background 0.2s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent; 
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.4); }
.nav-btn:active { transform: translateY(-50%) scale(0.9); }

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

@media (max-width: 768px) {
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.1);
    }
    .prev-btn { left: 8px; }
    .next-btn { right: 8px; }
}

.modal-carousel-container {
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.carousel-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-behavior: smooth;
    width: 100%;
}

.carousel-list::-webkit-scrollbar { display: none; }
.carousel-list { -ms-overflow-style: none; scrollbar-width: none; }

.carousel-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s, border 0.2s;
    flex-shrink: 0; 
}

.carousel-thumb.active {
    opacity: 1;
    border-color: #4caf50; 
}

.carousel-thumb:hover:not(.active) { opacity: 0.9; }

.photo-controls {
    padding: 15px 10px;
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    gap: 10px;
    background: #0a0a0a;
}

@media (max-width: 768px) {
    .photo-controls {
        padding: 10px;
        padding-bottom: env(safe-area-inset-bottom, 10px); 
    }
    .btn-action {
        flex: 1 1 calc(50% - 10px) !important; 
        font-size: 0.85rem !important;
        padding: 10px !important;
    }
}

.btn-action {
    flex: 1;
    max-width: 200px;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download { background: white; color: black; }
.btn-share { background: #25D366; color: white; }
.btn-autoplay { background: #f39c12; color: white; } 
.btn-mode { background: #8e44ad; color: white; } 

.overlay-datetime {
    position: absolute;
    top: 15px;
    left: 20px;
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    z-index: 1004; 
    margin: 0;
    pointer-events: none;
}