/*
 * galerias.css — parte 1 de 5
 * Base de la página, bloques interactivos, carrusel de colecciones y últimas galerías
 *
 * Fragmento de la hoja original de la página de galerías. El ORDEN de
 * carga de estas partes reproduce el del archivo único y debe mantenerse:
 * cambiarlo altera la cascada. Ver el orden en public/galerias.html.
 */
/* PÁGINA DE GALERÍAS - ESTILOS MODULARES */

/* Ocultar botón de búsqueda en Tribu Colab */
body.hide-search-button .contextual-search-fab {
    display: none !important;
}

.galerias-page-body {
    background: #f9fafb;
    overflow-x: hidden;
    max-width: 100vw;
}

.galerias-page-main {
    min-height: 100vh;
    padding-top: 70px;
    padding-bottom: 80px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* COLECCIONES HEADER */
.colecciones-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 2rem 2rem 1rem 2rem;
}

.colecciones-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1.25rem 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-accent {
    width: 4px;
    height: 28px;
    background: linear-gradient(180deg, #8b5cf6 0%, #ec4899 100%);
    border-radius: 2px;
}

/* Contenedor con flechas de navegación */
.colecciones-scroll-wrapper {
    position: relative;
}

.colecciones-scroll {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.colecciones-scroll::-webkit-scrollbar {
    height: 6px;
}

.colecciones-scroll::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.colecciones-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.colecciones-scroll::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Flechas de navegación estilo Disney+ - Modernas y pequeñas */
.colecciones-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
}

.colecciones-nav-arrow:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-50%) scale(1.1);
}

.colecciones-nav-arrow.visible {
    display: flex;
}

.colecciones-nav-arrow.left {
    left: 8px;
}

.colecciones-nav-arrow.right {
    right: 8px;
}

.colecciones-nav-arrow i {
    font-size: 1.25rem;
    color: #1f2937;
    font-weight: 600;
}

.colecciones-nav-arrow:active {
    transform: translateY(-50%) scale(1.05);
}

/* COLECCIÓN ITEM */
.coleccion-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 90px;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
}

.coleccion-item:hover {
    transform: translateY(-2px);
}

.coleccion-item.active .coleccion-icon-wrapper {
    border-width: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.coleccion-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

.coleccion-icon-wrapper.has-image {
    padding: 0;
}

.coleccion-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
    overflow: hidden;
}

.coleccion-icon-wrapper i {
    font-size: 2rem;
    color: white;
}

.coleccion-nombre {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    text-align: center;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.2;
    word-break: normal;
    overflow-wrap: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.coleccion-item.active .coleccion-nombre {
    color: #1f2937;
    font-weight: 600;
}

/* Badge de nuevo contenido - verde y mitad afuera */
.coleccion-new-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    border: 2.5px solid white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.5);
    animation: newContentPulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes newContentPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

/* LOADING STATE */
.colecciones-loading {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.coleccion-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 90px;
}

.skeleton-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    width: 70px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* CONTENIDO DE GALERÍAS */
.galerias-content {
    padding: 2rem 0;
}

/* Contenedor principal de galerías */
#galeriasContent {
    width: 100%;
    min-height: 50vh;
    position: relative;
    overflow: visible; /* Permitir scroll normal */
    transition: opacity 0.2s ease;
    isolation: isolate; /* Crear nuevo contexto de apilamiento */
}

/* Animación de carga al cambiar de vista */
#galeriasContent.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Asegurar que cada vista sea independiente */
#galeriasContent > * {
    width: 100%;
    clear: both;
}

.galerias-content .container {
    max-width: 1400px;
    padding: 0 2rem;
}

/* VISTA DE COLECCIÓN */
.coleccion-header-page {
    margin-bottom: 2rem;
}

.btn-back {
    display: none;
}

.coleccion-info {
    margin-bottom: 0;
    text-align: center;
}

.coleccion-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.coleccion-description {
    font-size: 1.125rem;
    color: #6b7280;
    margin: 0;
}

/* BUSCADOR DE COLECCIÓN */
.coleccion-search-wrapper {
    margin-top: 1.25rem;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.coleccion-search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 0.875rem 1.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.coleccion-search-container:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
}

.coleccion-search-icon {
    font-size: 1.25rem;
    color: #9ca3af;
    margin-right: 0.75rem;
    transition: color 0.3s ease;
}

.coleccion-search-container:focus-within .coleccion-search-icon {
    color: #8b5cf6;
}

.coleccion-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #1f2937;
    background: transparent;
    font-family: 'Inter', sans-serif;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.coleccion-search-input:focus {
    outline: none;
    box-shadow: none;
}

.coleccion-search-input::placeholder {
    color: #9ca3af;
}

.coleccion-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
}

.coleccion-search-clear:hover {
    background: #e5e7eb;
    transform: scale(1.1);
}

.coleccion-search-clear i {
    font-size: 1rem;
    color: #6b7280;
}

.coleccion-search-results {
    margin-top: 0.75rem;
    padding: 0.625rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideDown 0.3s ease;
}

.coleccion-search-results.no-results {
    background: #fef2f2;
    border-color: #fecaca;
}

.search-results-text {
    font-size: 0.875rem;
    color: #166534;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.coleccion-search-results.no-results .search-results-text {
    color: #991b1b;
}

.search-results-text i {
    font-size: 1rem;
}

/* 🆕 INDICADOR DE BÚSQUEDA EN PROGRESO */
.buscando-indicador {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.buscando-indicador i {
    font-size: 2.5rem;
    color: #8b5cf6;
    animation: spin 1s linear infinite;
}

.buscando-indicador span {
    font-size: 0.9375rem;
    color: #6b7280;
    font-weight: 500;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 🆕 RESULTADOS DE BÚSQUEDA - FOTOS */
.resultados-busqueda-section {
    width: 100%;
    margin-bottom: 2rem;
}

/* 🆕 GRUPO DE GALERÍA CON SUS FOTOS */
.resultado-galeria-grupo {
    margin-bottom: 2.5rem;
}

.resultado-galeria-grupo.sin-fotos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* 🆕 TARJETA NORMAL EN DESKTOP */
.resultado-galeria-grupo > .galeria-card,
.resultado-galeria-grupo > .galeria-carrusel-item,
.resultado-galeria-grupo > .galeria-mosaico-item,
.resultado-galeria-grupo > .galeria-grid-item,
.resultado-galeria-grupo > .galeria-mosaico-wrapper {
    width: 320px;
    max-width: 320px;
    margin-bottom: 1rem;
}

/* 🆕 OCULTAR DESCRIPCIÓN EN RESULTADOS */
.resultado-galeria-grupo .galeria-description,
.resultado-galeria-grupo .galeria-lista-description,
.resultado-galeria-grupo .galeria-mosaico-info p {
    display: none !important;
}

/* 🆕 REDUCIR ALTURA DE PORTADA EN DESKTOP - WRAPPER Y IMAGEN */
.resultado-galeria-grupo .galeria-image-wrapper {
    padding-top: 0 !important;
    height: 160px !important;
}

.resultado-galeria-grupo .galeria-image {
    position: relative !important;
    height: 160px !important;
    width: 100% !important;
    object-fit: cover !important;
}

/* Grid de fotos debajo de cada galería */
.resultado-fotos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 1rem;
    padding: 0;
}

.foto-resultado {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #f3f4f6;
}

.foto-resultado:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.foto-resultado img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Overlay del ojo removido en desktop */

/* Sin resultados */
.sin-resultados-busqueda {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.sin-resultados-busqueda i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    color: #9ca3af;
}

.sin-resultados-busqueda h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.sin-resultados-busqueda p {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ocultar galerías en búsqueda */
.search-hidden {
    display: none !important;
}

/* BLOQUES */
.bloque-section {
    margin-bottom: 3rem;
}

.bloque-header {
    margin-bottom: 1.5rem;
}

.bloque-title-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bloque-ultimas-galerias .bloque-title {
    margin-bottom: 0;
}

.btn-ver-todas {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #8b5cf6;
    background: transparent;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
    width: fit-content;
}

.btn-ver-todas:hover {
    color: #7c3aed;
    transform: translateX(2px);
}

.btn-ver-todas i {
    font-size: 0.75rem;
}

.bloque-title-wrapper {
    width: 100%;
}

.bloque-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.bloque-description {
    font-size: 0.95rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   ÚLTIMAS GALERÍAS AGREGADAS
======================================== */
.bloque-ultimas-galerias {
    margin-bottom: 0.5rem;
}

/* Reducir espacio entre últimas galerías y el siguiente bloque */
.bloque-ultimas-galerias + .container {
    margin-top: -1.5rem;
}

.ultimas-galerias-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.ultima-galeria-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.ultima-galeria-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.ultima-galeria-image {
    position: relative;
    width: 100%;
    padding-top: 75%;
    overflow: hidden;
    background: #f3f4f6;
}

.ultima-galeria-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ultima-galeria-card:hover .ultima-galeria-image img {
    transform: scale(1.05);
}

.ultima-galeria-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.ultima-galeria-placeholder i {
    font-size: 2rem;
    color: #d1d5db;
}

.ultima-galeria-info {
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ultima-galeria-titulo {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ultima-galeria-contador {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.ultima-galeria-contador i {
    font-size: 0.9375rem;
    color: #9ca3af;
}

.ultima-galeria-contador .counter-label {
    color: #9ca3af;
}

/* Wrapper para contador y estadísticas en la misma línea */
.ultima-galeria-contador-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Estadísticas en últimas galerías - mismo estilo que contador */
.ultima-galeria-stat {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6875rem;
    color: #6b7280;
}

.ultima-galeria-stat i {
    font-size: 0.75rem;
    color: #9ca3af;
}

.ultima-galeria-stat .counter-value {
    font-weight: 500;
    color: #6b7280;
}

/* Distinción de galería especial en últimas galerías.
   ----------------------------------------------------------------------------
   Va a la izquierda, donde no estorba a tribu ni premium (que se colocan a la
   derecha). Privada y registrados también son de la izquierda, pero no pueden
   coincidir con una especial porque `tipo_galeria` es un solo valor; aun así, la
   regla de hermanos de abajo los corre si algún día llegaran a convivir. */
.ultima-galeria-badge-distincion {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dist-color);
    color: #ffffff;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--dist-color) 45%, transparent);
    z-index: 3;
}

.ultima-galeria-badge-distincion i {
    font-size: 0.75rem;
}

/* Si coincidiera con otro badge de la izquierda, este se desplaza */
.ultima-galeria-badge-distincion ~ .ultima-galeria-badge-privada,
.ultima-galeria-badge-distincion ~ .ultima-galeria-badge-registrados {
    left: 36px;
}

/* Badge de Tribu Colab en últimas galerías */
.ultima-galeria-badge-tribu {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    z-index: 2;
}

.ultima-galeria-badge-tribu i {
    font-size: 0.75rem;
}

/* Badge de galería privada en últimas galerías */
.ultima-galeria-badge-privada {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.ultima-galeria-badge-privada i {
    font-size: 0.7rem;
}

/* Badge de galería solo para registrados en últimas galerías */
.ultima-galeria-badge-registrados {
    position: absolute;
    top: 6px;
    left: 6px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    z-index: 2;
}

.ultima-galeria-badge-registrados i {
    font-size: 0.7rem;
}

/* Badge de galería premium en últimas galerías */
.ultima-galeria-badge-premium {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    z-index: 2;
}

.ultima-galeria-badge-premium i {
    font-size: 0.7rem;
}

/* Estilo para galería solo-registrados (clickeable) */
.ultima-galeria-card.ultima-galeria-solo-registrados {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Galería bloqueada por temporizador */
.ultima-galeria-card.ultima-galeria-locked {
    cursor: not-allowed;
    position: relative;
}

.ultima-galeria-card.ultima-galeria-locked .ultima-galeria-image img {
    filter: grayscale(50%) brightness(0.7);
}

.ultima-galeria-timer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: white;
    z-index: 3;
}

.ultima-galeria-timer-overlay i {
    font-size: 1.25rem;
    opacity: 0.9;
}

.ultima-galeria-timer-countdown {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}
