* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: rgba(0, 0, 0, 0.8);
    background-image: url(../images/banner.jpg);
    color: white;
    padding: 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    /* Añadimos padding-bottom para asegurar espacio */
    padding-bottom: 1.5rem;
}


/* Filtros avanzados - ocultos por defecto */
.advanced-filters {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    margin: 15px auto;
    max-width: 1200px;
    display: none; /* ¡OCULTO POR DEFECTO! */
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Botón para mostrar/ocultar filtros */
.toggle-filters-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
    font-size: 0.9rem;
    margin-top: 10px;
}

.toggle-filters-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.toggle-filters-btn.hide {
    background: linear-gradient(45deg, #6c757d, #545b62);
}

header h1 {
    margin: 0 0 1rem 0;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.admin-link {
    margin-bottom: 15px;
}

.admin-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    transition: transform 0.2s;
    display: inline-block;
    font-size: 0.9rem;
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    min-width: 100px;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.tab-button.active {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Filtros avanzados */
.advanced-filters {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    margin: 15px auto;
    max-width: 1200px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    color: white;
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-weight: bold;
}

.advanced-filters select,
.advanced-filters input {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.advanced-filters button {
    padding: 8px 15px;
    font-size: 0.9rem;
    min-width: 100px;
}

.clear-filters-btn {
    background: linear-gradient(45deg, #6c757d, #495057) !important;
}

.clear-filters-btn:hover {
    background: linear-gradient(45deg, #5a6268, #343a40) !important;
}

.search-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 10px;
    margin-bottom: 15px;
}

#searchInput {
    padding: 10px 15px;
    font-size: 14px;
    border: none;
    border-radius: 20px;
    width: 250px;
    max-width: 90%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#searchInput:focus {
    outline: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

button {
    padding: 10px 15px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
    font-size: 14px;
}

button:hover {
    transform: translateY(-2px);
}

/* Estilos para las pestañas */
.tab-content {
    display: none;
    padding: 15px;
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
    width: 100%;
}

.tab-content.active {
    display: block;
}

/* Estilos para la colección */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
}

/* Animaciones de entrada */
.mineral-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    padding: 15px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mineral-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.mineral-card h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.mineral-card p {
    margin: 6px 0;
    line-height: 1.4;
    color: #555;
    font-size: 0.9rem;
}

.mineral-card strong {
    color: #333;
    display: inline-block;
    min-width: 90px;
    font-size: 0.9rem;
}

/* Carrusel de imágenes */
.image-carousel {
    position: relative;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid #eee;
    width: 100%;
    height: 180px;
}

.carousel-container {
    display: flex;
    transition: transform 0.3s ease;
    width: 100%;
    height: 100%;
}

.carousel-image {
    min-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s;
}

.indicator.active {
    background: white;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    z-index: 10;
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.prev-btn {
    left: 5px;
}

.next-btn {
    right: 5px;
}

/* Estilos para la galería */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    width: 100%;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
    background: white;
    aspect-ratio: 1;
    opacity: 0;
    transform: scale(0.8);
    animation: fadeInScale 0.5s ease forwards;
}

@keyframes fadeInScale {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    text-align: center;
    font-weight: bold;
    font-size: 0.8em;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

/* Estilos para Acerca de */
.about-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.about-section {
    margin-bottom: 25px;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section h2 {
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 8px;
    margin-top: 0;
    font-size: 1.5rem;
}

.about-section p {
    line-height: 1.6;
    color: #555;
    font-size: 1rem;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.contact-item {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.contact-item h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.1em;
}

.contact-item p {
    margin: 5px 0;
    color: #666;
    font-size: 0.9rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.info-item {
    background: rgba(255, 107, 107, 0.1);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #ff6b6b;
}

.info-item h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.1em;
}

.info-item ul {
    padding-left: 15px;
    margin: 10px 0;
}

.info-item li {
    margin: 6px 0;
    color: #666;
    font-size: 0.9rem;
}

.info-item p {
    margin: 6px 0;
    color: #666;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: auto;
    backdrop-filter: blur(10px);
    font-size: 0.8rem;
}

.footer-content p {
    margin: 3px 0;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: white;
    font-size: 1.1rem;
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    animation: fadeIn 0.3s;
}

.modal-content-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 95%;
    max-height: 90%;
    width: 100%;
}

.modal-content {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
    margin: 0 auto;
    width: auto;
    height: auto;
}

.modal-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
    color: white;
    font-size: 16px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

#imageCounter {
    min-width: 80px;
    font-size: 14px;
}

#modalCaption {
    color: #ccc;
    font-size: 16px;
    margin-top: 8px;
    padding: 0 10px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #f1f1f1;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s;
}

.close:hover {
    color: #ff6b6b;
}

/* Estilos para paginación - Versión definitiva */
.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 25px auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 25px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 340px;
    width: 95%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Información de página en la parte superior */
.pagination .page-info {
    color: white;
    font-weight: 700;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 20px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Contenedor para botones de navegación */
.nav-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination .nav-btn {
    flex: 1;
    min-width: 120px;
    padding: 14px;
    border: 2px solid transparent;
    border-radius: 18px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-align: center;
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
}

.pagination .nav-btn:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    border-color: rgba(255, 255, 255, 0.4);
}

.pagination .nav-btn:disabled {
    opacity: 0.45;
    transform: none;
    cursor: not-allowed;
    box-shadow: none;
}

/* Contenedor para botones de página - CORREGIDO COMPLETAMENTE */
.page-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap; /* Permite que se organicen en múltiples filas si es necesario */
    padding: 5px 0;
    min-height: 58px;
}

/* Estilos para los botones de página */
.pagination .page-btn,
.pagination .ellipsis {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    cursor: pointer;
    min-width: 48px; /* Asegura que no se encojan */
    flex-shrink: 0; /* Evita que se reduzcan */
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    line-height: 1;
    text-align: center;
}

.pagination .page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255,255,255,0.2);
}

.pagination .page-btn.active {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border: 2px solid transparent;
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(238, 90, 36, 0.6);
}

.pagination .page-btn.active:hover {
    background: linear-gradient(135deg, #ff523b, #ee4a1a);
    box-shadow: 0 10px 30px rgba(238, 90, 36, 0.8);
}

/* Estilos para puntos suspensivos */
.pagination .ellipsis {
    cursor: default;
    background: transparent;
    border: none;
    font-weight: bold;
    font-size: 20px;
    color: white;
}

/* Versión para tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .pagination {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: 650px;
        gap: 15px;
        padding: 20px;
    }
    
    .pagination .page-info {
        min-width: 160px;
        font-size: 17px;
        padding: 12px 20px;
    }
    
    .nav-buttons {
        flex: 0 0 auto;
        width: auto;
        gap: 15px;
    }
    
    .page-buttons {
        flex: 1;
        justify-content: center;
        flex-wrap: wrap;
        min-height: 58px;
    }
    
    .pagination .nav-btn {
        min-width: 100px;
        min-height: 50px;
        padding: 12px;
        font-size: 15px;
    }
    
    .pagination .page-btn,
    .pagination .ellipsis {
        width: 46px;
        height: 46px;
        font-size: 15px;
        min-width: 46px;
    }
}

/* Versión para desktop (1025px+) */
@media (min-width: 1025px) {
    .pagination {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        max-width: 750px;
        gap: 20px;
        padding: 25px;
    }
    
    .pagination .page-info {
        min-width: 180px;
        font-size: 18px;
        padding: 14px 25px;
    }
    
    .nav-buttons {
        width: auto;
        gap: 20px;
    }
    
    .page-buttons {
        display: flex;
        gap: 12px;
        width: auto;
        justify-content: center;
        flex-wrap: wrap;
        min-height: 62px;
    }
    
    .pagination .nav-btn {
        min-width: 110px;
        min-height: 56px;
        padding: 16px 20px;
        font-size: 17px;
        border-radius: 20px;
    }
    
    .pagination .page-btn,
    .pagination .ellipsis {
        width: 52px;
        height: 52px;
        font-size: 18px;
        min-width: 52px;
        border-radius: 16px;
    }
}

/* Correcciones específicas para móviles */
@media (max-width: 375px) {
    .pagination {
        max-width: 300px;
        padding: 18px;
        gap: 12px;
    }
    
    .pagination .page-info {
        font-size: 16px;
        padding: 10px 16px;
        min-height: 48px;
    }
    
    .pagination .nav-btn {
        min-width: 100px;
        min-height: 48px;
        padding: 12px;
        font-size: 14px;
    }
    
    .pagination .page-btn,
    .pagination .ellipsis {
        width: 44px;
        height: 44px;
        font-size: 14px;
        min-width: 44px;
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 320px) {
    .pagination {
        max-width: 280px;
        padding: 16px;
        gap: 10px;
    }
    
    .pagination .page-info {
        font-size: 15px;
        padding: 8px 14px;
        min-height: 44px;
    }
    
    .pagination .nav-btn {
        min-width: 90px;
        min-height: 44px;
        padding: 10px;
        font-size: 13px;
    }
    
    .pagination .page-btn,
    .pagination .ellipsis {
        width: 40px;
        height: 40px;
        font-size: 13px;
        min-width: 40px;
    }
}

/* Efectos táctiles */
@media (hover: none) and (pointer: coarse) {
    .pagination button:active {
        transform: scale(0.95) !important;
        transition: transform 0.1s ease !important;
    }
    
    .pagination .page-btn.active:active {
        transform: scale(0.92) translateY(-2px) !important;
    }
}

/* Asegurar que el texto no se corte */
.pagination .page-btn,
.pagination .ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Estilos adicionales para garantizar el comportamiento horizontal */
.page-buttons::-webkit-scrollbar {
    height: 4px;
}

.page-buttons::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.page-buttons::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.page-buttons::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Asegurar que el contenedor no se expanda */
.pagination {
    min-width: 0;
}

.page-buttons {
    min-width: 0;
}
/* Asegurar que no se desborde en pantallas muy pequeñas */
@media (max-width: 320px) {
    .pagination {
        max-width: 280px;
        padding: 16px;
        gap: 12px;
    }
    
    .pagination .page-info {
        font-size: 16px;
        padding: 10px 16px;
    }
    
    .pagination .nav-btn {
        min-height: 48px;
        padding: 12px;
        font-size: 14px;
    }
    
    .pagination .page-btn {
        width: 44px;
        height: 44px;
        font-size: 14px;
    }
    
    .pagination span {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* Botones con íconos mejorados para móviles */
.pagination .nav-btn::before {
    content: '';
    display: inline-block;
    margin-right: 8px;
    width: 20px;
    height: 20px;
}

.pagination .nav-btn:nth-child(1)::before {
    content: '←';
}

.pagination .nav-btn:nth-child(2)::before {
    content: '→';
}

@media (max-width: 767px) {
    .pagination .nav-btn {
        font-size: 14px;
    }
    
    .pagination .nav-btn::before {
        margin-right: 6px;
        width: 16px;
        height: 16px;
        font-size: 16px;
    }
}

/* Fondo extra para mejor contraste en móviles */
@media (max-width: 767px) {
    .pagination {
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(25px);
    }
}

/* Asegurar que los textos no se corten */
.pagination .nav-btn,
.pagination .page-info {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Asegurar que el body tenga altura completa */
html, body {
    height: 100%;
}

/* Prevenir el zoom en inputs en iOS */
input, textarea, select {
    font-size: 16px;

    /* Estilo para el nombre en la galería */
.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 0.85em;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    cursor: pointer; /* Indica que es clickeable */
    text-decoration: underline; /* Opcional: subrayado para indicar enlace */
}

.gallery-caption:hover {
    background: rgba(255, 107, 107, 0.8); /* Cambia de color al hover */
    transform: translateY(0);
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}