/* ========================================
   GAL-MASONRY.CSS - Estilos para Galerías
   Basado en Pinterest/Instagram layout
   SIN DEPENDENCIAS DE BOOTSTRAP
   Versión: 2.8 - Adaptive Layout (2025-11-10)
   ======================================== */

/* ===== RESET Y BASE STYLES ===== */
* {
    box-sizing: border-box;
}

/* body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
} */

/* ===== ESTILOS BASE (reemplazando Bootstrap) ===== */
.gal-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    /* padding: 2.5rem 1rem; */
}

.gal-wrapper {
    width: 100%;
}

/* ===== SECCIONES GENERALES ===== */
.gal-section {
    margin-bottom: 4rem;
}

.gal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
   /*  border-bottom: 2px solid #f0f0f0; */
    width: 95%;
    margin: auto;
}
.header-gal-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.gal-section-title {
    font-size: 1.7rem;
    font-weight: 700;
    /* color: #333; */
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gal-section-subtitle {
    font-size: 0.9rem;
    margin: 0.2rem 0 0 0 !important;
    opacity: 0.7;
    font-weight: 400;
    line-height: 1.3;
}

.gal-section-title i {
    color: var(--zikpic-green, #37cd37);
}

.gal-section-link {
    color: var(--zikpic-green, #37cd37);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.gal-section-link:hover {
    color: var(--zikpic-dark-green, #2ea82e);
    transform: translateX(5px);
}

/* ===== FILA 1: MASONRY PRINCIPAL (CSS COLUMNS) ===== */
.gal-masonry {
    column-count: 4;
    column-gap: 20px;
    padding: 0px 0px 20px;
    line-height: 0;
    font-size: 0;
    /* align-items solo funciona en modo grid, no afecta CSS columns */
}

/* Modo grid (cuando hay pocas imágenes) - controlado por JavaScript */
.gal-masonry[data-layout-mode="grid"] {
    align-items: start; /* Alinear items al inicio (no estirar verticalmente) */
}

.gal-masonry[data-layout-mode="grid"] .gal-item {
    display: block;
    width: 100%;
    break-inside: auto;
}

/* Responsivo para garantizar al menos 4 columnas en escritorio */

/* Responsivo para masonry */
@media (max-width: 1200px) {
    .gal-masonry {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .gal-masonry {
        column-count: 2;
        column-gap: 15px;
    }
}

@media (max-width: 480px) {
    .gal-masonry {
        column-count: 1;
        column-gap: 15px;
    }
}

.gal-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    height: auto;
    margin: 0 0 20px 0;
    padding: 0;
    line-height: 0;
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    page-break-inside: avoid;
    opacity: 0;
}

.gal-item.fade-in {
    opacity: 1;
}

.gal-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.gal-item-media {
    position: relative;
    width: 100%;
    line-height: 0;
    font-size: 0;
    flex: 1;
}

.gal-item-media img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px 10px 0 0;
    margin: 0;
    padding: 0;
}

/* ⚠️ REGLAS COMENTADAS - Conflicto con column-count responsive
   Las reglas de grid-template-columns sobrescriben el sistema de columns
   que está definido arriba (líneas 89-158)
*/
/* @media (max-width: 1200px) {
    .gal-masonry {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .gal-masonry {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .gal-masonry {
        grid-template-columns: 1fr;
        gap: 15px;
    }
} */

/* Video específico */
.gal-item-media.video {
    position: relative;
}

.video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.8rem;
    opacity: 0.9;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
}

.gal-item:hover .video-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.duration-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Overlay de información */
.gal-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(8, 55, 156, 0.8));
    color: white;
    padding: 20px 15px 15px;
    opacity: 0;
    transition: all 0.3s ease;
}

.gal-item:hover .gal-item-overlay {
    opacity: 1;
}

.gal-item-author {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid white;
}

.author-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.gal-item-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.gal-item-gallery {
    font-size: 0.75rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* Botón Cargar Más */
.load-more-container {
    text-align: center;
    margin: 3rem 0;
}

.load-more-btn {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 18px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.load-more-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ===== FILA 2: GALERÍAS DESTACADAS ===== */
.galleries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.gallery-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.gallery-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 200px;
    gap: 2px;
}

.preview-thumb {
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-placeholder {
    font-size: 2rem;
    color: #ccc;
}

.gallery-info {
    padding: 15px;
}

.gallery-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #333;
}

.gallery-author {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.author-avatar-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 6px;
}

.gallery-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: #666;
}

/* ===== FILA 3: CREADORES DESTACADOS ===== */
.creators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.creator-card {
    text-align: center;
    background: white;
    border-radius: 16px;
    padding: 25px 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.creator-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.creator-avatar {
    position: relative;
    margin: 0 auto 15px;
    width: 80px;
    height: 80px;
}

.creator-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.verified-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--zikpic-green, #37cd37);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    border: 2px solid white;
}

.creator-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #333;
}

.creator-username {
    color: #666;
    margin: 0 0 10px 0;
    font-size: 0.9rem;
}

.creator-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.85rem;
    color: #666;
}

/* ===== FILA 4: TENDENCIAS ===== */
.trending-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-behavior: smooth;
}

.trending-scroll::-webkit-scrollbar {
    height: 8px;
}

.trending-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.trending-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.trending-scroll::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.trending-item {
    position: relative;
    min-width: 200px;
    height: 250px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.trending-item:hover {
    transform: scale(1.05);
}

.trending-media {
    width: 100%;
    height: 100%;
    position: relative;
}

.trending-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay-small {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    opacity: 0.9;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.trending-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

/* ===== MODAL ESTILO INSTAGRAM ===== */
.media-modal-container {
    display: flex;
    height: 90vh;
    max-height: 800px;
}

.media-display {
    flex: 2;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.media-sidebar {
    flex: 1;
    background: white;
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid #eee;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    /* ⚠️ COMENTADO - Conflicto con column-count
    .gal-masonry {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        grid-gap: 15px;
    }
    */
    
    .gal-section-title {
        font-size: 1.5rem;
    }
    
    .galleries-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .creators-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .trending-item {
        min-width: 150px;
        height: 200px;
    }
    
    .media-modal-container {
        flex-direction: column;
        height: auto;
    }
    
    .media-display {
        height: 60vh;
    }
}

@media (max-width: 576px) {
    /* ⚠️ COMENTADO - Conflicto con column-count
    .gal-masonry {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        grid-gap: 10px;
    }
    */
    
    .gal-section {
        margin-bottom: 2.5rem;
    }
    
    .galleries-grid {
        grid-template-columns: 1fr;
    }
    
    .creators-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
    }
}

/* ===== UTILIDADES ===== */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===== NUEVOS ESTILOS PARA CLASES ACTUALIZADAS ===== */

/* Grids para galerías y creadores */
.gal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Más pequeño para garantizar 4 columnas */
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Responsivo para el grid de galerías */
@media (min-width: 1200px) {
    .gal-grid {
        grid-template-columns: repeat(4, 1fr); /* FORZAR exactamente 4 columnas en escritorio */
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 1400px) {
    .gal-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); /* 4-5 columnas flexibles en pantallas muy grandes */
        max-width: 1400px;
    }
}

@media (max-width: 768px) {
    .gal-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* 2 columnas en tablet */
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .gal-grid {
        grid-template-columns: 1fr; /* 1 columna en móvil */
        gap: 1rem;
    }
}

/* Cards de galerías */
.gal-gallery-card {
    background: white;
    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;
    cursor: pointer;
}

.gal-gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gal-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    aspect-ratio: 1;
}

.gal-preview-item {
    overflow: hidden;
    
    /* ===== MEJORAS PARA RENDERIZADO CONSISTENTE ===== */
    /* Forzar contexto de apilamiento */
    position: relative;
    z-index: 1;
    
    /* Mejorar bordes y contenido */
    border-radius: 6px;
    
    /* Activar aceleración por hardware en el contenedor */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    
    /* Optimizar composición */
    contain: layout style paint;
}

.gal-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    
    /* ===== CORRECCIÓN ANTI-PIXELACIÓN CHROME ===== */
    /* Forzar algoritmo de escalado suave */
    image-rendering: -webkit-optimize-contrast; /* Chrome/Safari */
    image-rendering: -moz-crisp-edges;          /* Firefox */
    image-rendering: crisp-edges;               /* Estándar */
    image-rendering: pixelated;                 /* Fallback */
    image-rendering: auto;                      /* Override para suavizado */
    
    /* Activar aceleración por hardware */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    
    /* Mejorar suavizado */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    
    /* Optimizar renderizado */
    will-change: transform;
    
    /* Filtro adicional para Chrome */
    filter: contrast(1.02) brightness(1.01);
}

/* ===== REGLAS ESPECÍFICAS POR NAVEGADOR PARA ANTI-PIXELACIÓN ===== */

/* Chrome y Safari - Máxima prioridad al suavizado */
@supports (-webkit-appearance: none) {
    .gal-preview-item img {
        image-rendering: -webkit-optimize-contrast;
        -webkit-filter: blur(0.5px);
        filter: blur(0.5px) contrast(1.1);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Firefox - Mantener nitidez pero sin pixelación */
@-moz-document url-prefix() {
    .gal-preview-item img {
        image-rendering: auto;
        image-rendering: -moz-crisp-edges;
    }
}

/* Edge - Optimización específica */
@supports (-ms-accelerator: true) {
    .gal-preview-item img {
        image-rendering: auto;
        -ms-interpolation-mode: bicubic;
    }
}

.gal-gallery-card:hover .gal-preview-item img {
    transform: scale(1.05);
}

.gal-gallery-info {
    padding: 1rem;
}

.gal-gallery-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.gal-gallery-author {
    color: #666;
    font-size: 0.9rem;
}

/* Cards de creadores */
.gal-creator-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.gal-creator-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gal-creator-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    display: block;
    border: 3px solid var(--zikpic-green, #37cd37);
}

/* Avatar con iniciales para usuarios sin foto */
.gal-creator-avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--zikpic-green, #37cd37), var(--zikpic-dark-green, #2ea82e));
    color: white;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    border: 3px solid var(--zikpic-green, #37cd37);
    box-shadow: 0 4px 12px rgba(55, 205, 55, 0.2);
    position: relative;
    overflow: hidden;
}

/* Variaciones de color para diferentes usuarios */
.gal-creator-avatar-placeholder[data-user-color="0"] { background: linear-gradient(135deg, #ff6b6b, #ee5a52); border-color: #ff6b6b; }
.gal-creator-avatar-placeholder[data-user-color="1"] { background: linear-gradient(135deg, #4ecdc4, #44a08d); border-color: #4ecdc4; }
.gal-creator-avatar-placeholder[data-user-color="2"] { background: linear-gradient(135deg, #45b7d1, #3a9bc1); border-color: #45b7d1; }
.gal-creator-avatar-placeholder[data-user-color="3"] { background: linear-gradient(135deg, #96ceb4, #85a392); border-color: #96ceb4; }
.gal-creator-avatar-placeholder[data-user-color="4"] { background: linear-gradient(135deg, #feca57, #ff9ff3); border-color: #feca57; }
.gal-creator-avatar-placeholder[data-user-color="5"] { background: linear-gradient(135deg, #ff9ff3, #f368e0); border-color: #ff9ff3; }
.gal-creator-avatar-placeholder[data-user-color="6"] { background: linear-gradient(135deg, #54a0ff, #2e86de); border-color: #54a0ff; }
.gal-creator-avatar-placeholder[data-user-color="7"] { background: linear-gradient(135deg, #5f27cd, #341f97); border-color: #5f27cd; }
.gal-creator-avatar-placeholder[data-user-color="8"] { background: linear-gradient(135deg, #00d2d3, #01a3a4); border-color: #00d2d3; }
.gal-creator-avatar-placeholder[data-user-color="9"] { background: linear-gradient(135deg, #ff6348, #e17055); border-color: #ff6348; }

.gal-creator-info {
    text-align: center;
}

.gal-creator-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.gal-creator-stats {
    display: flex;
    justify-content: center;
    gap: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.gal-creator-stats i {
    color: var(--zikpic-green, #37cd37);
}

/* Overlay actualizado para gal-item */
.gal-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent 50%, rgba(5, 51, 110, 0.8));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

.gal-item:hover .gal-item-overlay {
    opacity: 1;
}

.gal-stats {
    display: flex;
    gap: 1rem;
    color: white;
    font-size: 0.9rem;
    align-self: flex-start;
}

.gal-stats i {
    margin-right: 0.25rem;
}

.gal-info {
    color: white;
    align-self: flex-end;
    width: 100%;
}

.gal-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: white;
    line-height: normal;
}

.gal-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gal-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.gal-author-name {
    font-size: 0.9rem;
    color: white;
}

/* Modal sin Bootstrap */
.gal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.gal-modal.show {
    display: flex;
}

.gal-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.gal-modal-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.gal-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.gal-modal-container {
    display: flex;
    height: 100%;
}

.gal-modal-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Contenido de media dentro del modal */
#modal-media-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#modal-media-content img,
#modal-media-content video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Asegurar que las imágenes se muestren correctamente */
#modal-media-content img {
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.gal-modal-sidebar {
    width: 350px;
    background: white;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Estilos específicos del contenido del modal */
.modal-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-author-details {
    flex: 1;
}

.modal-author-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin-bottom: 2px;
}

.modal-media-date {
    font-size: 0.8rem;
    color: #666;
}

.modal-follow-btn {
    background: var(--zikpic-green, #37cd37);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.modal-follow-btn:hover {
    background: var(--zikpic-dark-green, #2ea82e);
}

.modal-content-info {
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-media-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
}

.modal-media-description {
    color: #666;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.modal-media-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.modal-tag {
    background: #f0f0f0;
    color: #666;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.modal-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.modal-stat:hover {
    color: var(--zikpic-green, #37cd37);
}

.modal-stat.liked {
    color: #e91e63;
}

.modal-stat i {
    font-size: 1.1rem;
}

.modal-comments-section {
    flex: 1;
    min-height: 200px;
}

/* Animación de like */
@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Scroll personalizado para sidebar */
.gal-modal-sidebar::-webkit-scrollbar {
    width: 6px;
}

.gal-modal-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.gal-modal-sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.gal-modal-sidebar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gal-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .gal-modal-content {
        width: 95vw;
        height: 95vh;
    }
    
    .gal-modal-container {
        flex-direction: column;
    }
    
    .gal-modal-sidebar {
        width: 100%;
        height: 40%;
    }
    
    .gal-modal-media {
        height: 60%;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== PREVIEW GRIDS DINÁMICOS ===== */
/* Grids adaptativos según número de imágenes disponibles */

/* 1 imagen: ocupa todo el espacio */
.gal-preview-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    aspect-ratio: 1;
}

/* 2 imágenes: divididas verticalmente */
.gal-preview-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    aspect-ratio: 1;
}

/* 3 imágenes: una grande a la izquierda, dos pequeñas a la derecha */
.gal-preview-grid-3 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    aspect-ratio: 1;
}

.gal-preview-grid-3 .gal-preview-item:first-child {
    grid-row: 1 / -1; /* Ocupa toda la altura */
}

/* 4 imágenes: grid 2x2 (layout original) */
.gal-preview-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    aspect-ratio: 1;
}

/* Mantener compatibilidad con el layout original */
.gal-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    aspect-ratio: 1;
}

/* Estilos debug (remover en producción) */
.gal-debug-info {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.gal-gallery-card:hover .gal-debug-info {
    opacity: 1;
}

/* ===============================
   ESTILOS PARA FILTROS Y PESTAÑAS
   =============================== */

/* Contenedor de filtros mixto (pestañas + select) */
.gal-filters-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* Contenedor del select de tipo */
.gal-type-select-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Estilos para el select de tipo de contenido */
.gal-type-filter {
    padding: 8px 12px;
    border: 2px solid #81d742;
    border-radius: 20px;
    background: white;
    color: #81d742;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    min-width: 140px;
}

.gal-type-filter:hover {
    background: #81d742;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(129, 215, 66, 0.3);
}

.gal-type-filter:focus {
    background: #81d742;
    color: white;
    box-shadow: 0 0 0 3px rgba(129, 215, 66, 0.2);
}

/* Ajustar el header para acomodar los filtros */
.gal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    flex-wrap: wrap;
    /* gap: 15px; */
    flex-direction: column;
}

/* En dispositivos móviles, hacer que el header sea columna */
@media (max-width: 768px) {
    .gal-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .gal-filters-container {
        width: 100%;
    }
    
    .gal-type-select-container {
        justify-content: flex-start;
    }
    
    .gal-type-filter {
        flex: 1;
        min-width: auto;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .gal-filters-container {
        gap: 10px;
    }
    
    .gal-type-select-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .gal-type-filter {
        width: 100%;
        max-width: none;
    }
}

/* Asegurar que las pestañas en galería tengan el mismo estilo que en comics */
.gal-section .series-tabs-scroll-wrap {
    max-width: 100%;
}

/* MASONRY PRINCIPAL TABS */

.masonry-tab-btn {
    background: none;
    border: none;
    outline: none;
    color: var(--zikpic-dark, #222);
    font-size: 1.05rem;
    font-weight: 700;
    padding: 15px 28px 15px 28px;
    margin-right: 18px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    font-family: inherit;
    letter-spacing: 0.01em;
    box-shadow: inset -1px 0px 14px rgb(157 157 157 / 7%);
}
.masonry-tab-btn.active {
    color: var(--zikpic-dark, #222);
    background: #f5f5f5;
    border-bottom: 3px solid var(--zikpic-green, #81d742);
    box-shadow: 0 2px 8px #0001;
    z-index: 2;
}
.masonry-tabs {
    display: flex;
    gap: 8px;
    margin: 40px 30px 30px 0px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    font-family: inherit;
}

/* Subrayado para pestaña activa */


.series-tabs-scroll-wrap {
  position: relative;
  margin-bottom: 1.5em;
}
.masonry-tabs-scrollable {
    display: flex;
    align-items: center;
    min-height: 50px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    white-space: nowrap;
    padding: 0 36px;
}

.masonry-tabs-scrollable::-webkit-scrollbar {
    display: none;
}
.masonry-tab-scroll-btn {
  display: flex;
  position: absolute;
  top: 0;
  bottom: 0;
  left: auto;
  right: auto;
  z-index: 10;
  background: rgba(255,255,255,0.97);
  border: none;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 1.5em;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: #333;
  /* box-shadow: 0 0 6px 0 rgba(0,0,0,0.08); */
}

.masonry-tab-scroll-btn.is-hidden {
  display: none !important;
}
.masonry-tab-scroll-btn.left { left: 0; border-radius: 8px 0 0 8px; }
.masonry-tab-scroll-btn.right { right: 0; border-radius: 0 8px 8px 0; background: rgba(255,255,255,0.9); z-index: 2; }
/* ===============================
   ESTILOS PARA CARGA AJAX Y BOTONES
   =============================== */

/* Contenedor del botón Ver más */
.gal-load-more-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 30px 0;
    gap: 15px;
}

/* Botón Ver más */
.gal-load-more {
/*     display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #81d742, #68b82f);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(129, 215, 66, 0.3);
    min-width: 180px;
    justify-content: center; */
    background: #f3f4f6;
    color: #181a1b;
    border-radius: 18px;
    padding: 0.7em 1.7em;
    font-weight: 600;
    font-size: 1.08em;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: background 0.18s, color 0.18s;
    border: none;
    outline: none;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-block;
}

.gal-load-more i {
    font-size: 20px;
}

.gal-load-more:hover {
    /* transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(129, 215, 66, 0.4);
    background: linear-gradient(135deg, #68b82f, #5a9c28); */
    background: #e0e1e3;
    color: #181a1b;
    text-decoration: none;
}

.gal-load-more:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(129, 215, 66, 0.3);
}

.gal-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(129, 215, 66, 0.2);
}

/* Indicador de carga */
.gal-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #81d742;
    font-weight: 500;
    font-size: 14px;
}

.gal-loading i {
    font-size: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Animaciones para nuevos elementos */
.gal-item.animated {
    animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados de loading para contenedores */
.gal-masonry.loading,
.gal-grid.loading {
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ===============================
   MEJORAS DE INTERACTIVIDAD
   =============================== */

/* Estilos para hacer las imágenes claramente clickeables */
.gal-item {
    cursor: pointer !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
}

.gal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gal-item-media {
    transition: transform 0.2s ease;
    cursor: pointer;
}

.gal-item:hover .gal-item-media {
    transform: scale(1.02);
}

.gal-item-media img {
    cursor: pointer;
    transition: filter 0.2s ease;
}

.gal-item:hover .gal-item-media img {
    filter: brightness(1.05);
}

/* Asegurar que el overlay no bloquee clics */
.gal-item-overlay {
    pointer-events: none;
}

.gal-item-overlay .gal-stats,
.gal-item-overlay .gal-author {
    pointer-events: auto;
}

/* Estilo para indicar que es clickeable */
.gal-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(129, 215, 66, 0);
    transition: background 0.2s ease;
    border-radius: 8px;
    pointer-events: none;
}

.gal-item:hover::after {
    background: rgba(129, 215, 66, 0.05);
}

/* Efecto hover mejorado para elementos de galería */
.gal-item:hover .gal-item-overlay {
    opacity: 1;
}

.gal-item-overlay {
    transition: opacity 0.3s ease;
}

/* Responsive para botones */
@media (max-width: 768px) {
    .gal-load-more {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .gal-load-more {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ===============================
   ESTILOS PARA AVATARES
   =============================== */

/* Estilos para avatar placeholder en los elementos de la galería */
.gal-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

.gal-author-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    color: white;
    margin-right: 8px;
    text-transform: uppercase;
}

/* Estilos para avatares de creadores destacados */
.gal-creator-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
}

.gal-creator-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 24px;
    color: white;
    margin-bottom: 15px;
    text-transform: uppercase;
}

/* Colores para los avatares placeholder basados en data-user-color */
.gal-author-avatar-placeholder[data-user-color="0"], 
.gal-creator-avatar-placeholder[data-user-color="0"] { background: #ff6b6b; }
.gal-author-avatar-placeholder[data-user-color="1"], 
.gal-creator-avatar-placeholder[data-user-color="1"] { background: #4ecdc4; }
.gal-author-avatar-placeholder[data-user-color="2"], 
.gal-creator-avatar-placeholder[data-user-color="2"] { background: #45b7d1; }
.gal-author-avatar-placeholder[data-user-color="3"], 
.gal-creator-avatar-placeholder[data-user-color="3"] { background: #96ceb4; }
.gal-author-avatar-placeholder[data-user-color="4"], 
.gal-creator-avatar-placeholder[data-user-color="4"] { background: #feca57; }
.gal-author-avatar-placeholder[data-user-color="5"], 
.gal-creator-avatar-placeholder[data-user-color="5"] { background: #ff9ff3; }
.gal-author-avatar-placeholder[data-user-color="6"], 
.gal-creator-avatar-placeholder[data-user-color="6"] { background: #54a0ff; }
.gal-author-avatar-placeholder[data-user-color="7"], 
.gal-creator-avatar-placeholder[data-user-color="7"] { background: #5f27cd; }
.gal-author-avatar-placeholder[data-user-color="8"], 
.gal-creator-avatar-placeholder[data-user-color="8"] { background: #00d2d3; }
.gal-author-avatar-placeholder[data-user-color="9"], 
.gal-creator-avatar-placeholder[data-user-color="9"] { background: #ff9f43; }

/* ===============================
   ESTILOS PARA MODAL Y NAVEGACIÓN
   =============================== */

/* Estilo para el corazón cuando está activo/liked */
.modal-actions .like-item i.liked {
    color: #ff4757 !important;
    animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.modal-actions .like-item {
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-actions .like-item:hover {
    color: #ff4757;
}

.modal-actions .view-item {
    cursor: default;
}

/* Contenedor de filtros */
.gal-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ===============================
   ESTILOS PARA FLECHAS DE NAVEGACIÓN DEL MODAL
   =============================== */

/* Hacer que modal-media-section sea el contenedor de referencia para flechas móviles */
.modal-media-section {
    position: relative;
}

.modal-nav-arrow {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s ease;
    font-size: 18px;
}

.modal-nav-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.modal-nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* FLECHAS PARA DESKTOP - A los lados de toda la pantalla */
.modal-nav-arrow.desktop-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex; /* Visible por defecto en desktop */
}

.modal-nav-arrow.desktop-nav.prev {
    left: 20px;
}

.modal-nav-arrow.desktop-nav.next {
    right: 20px;
}

.modal-nav-arrow.desktop-nav:hover {
    transform: translateY(-50%) scale(1.1);
}

/* FLECHAS PARA MÓVIL - Solo sobre la imagen */
.modal-nav-arrow.mobile-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: none !important; /* Ocultas SIEMPRE por defecto */
    width: 40px;
    height: 40px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.8);
}

.modal-nav-arrow.mobile-nav.prev {
    left: 10px;
}

.modal-nav-arrow.mobile-nav.next {
    right: 10px;
}

/* DESKTOP: Asegurar que solo aparezcan flechas de desktop */
@media (min-width: 769px) {
    .modal-nav-arrow.desktop-nav {
        display: flex !important;
    }
    
    .modal-nav-arrow.mobile-nav {
        display: none !important;
    }
}

/* ===== CSS ADICIONAL PARA MÓDULO DE GALERÍAS DESTACADAS ===== */

.gal-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.gal-time-filter,
.gal-sort-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gal-time-filter select,
.gal-sort-filter select {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    transition: all 0.3s ease;
}

.gal-time-filter select:focus,
.gal-sort-filter select:focus {
    outline: none;
    border-color: #81d742;
    box-shadow: 0 0 0 3px rgba(129, 215, 66, 0.1);
}

.order-toggle-btn {
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.order-toggle-btn:hover {
    background: #81d742;
    border-color: #81d742;
    color: white;
}

.order-toggle-btn i {
    font-size: 1rem;
}

.gal-sort-filter label {
    font-weight: 500;
    color: #666;
    font-size: 0.9rem;
}

/* Loading states */
.gal-loading {
    text-align: center;
    padding: 1rem;
    color: #666;
}

.gal-loading i {
    margin-right: 0.5rem;
}

/* Error states */
.gal-error {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Responsive para filtros */
@media (max-width: 768px) {
    .gal-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .gal-filters {
        width: 100%;
        justify-content: flex-start;
    }
    
    .gal-time-filter,
    .gal-sort-filter {
        flex: 1;
        min-width: 0;
    }
    
    .gal-time-filter select,
    .gal-sort-filter select {
        width: 100%;
    }
}

/* MÓVIL: Solo flechas móviles, ocultar desktop */
@media (max-width: 768px) {
    /* Ocultar flechas de desktop en móvil */
    .modal-nav-arrow.desktop-nav {
        display: none !important;
    }
    
    /* Mostrar SOLO flechas de móvil */
    .modal-nav-arrow.mobile-nav {
        display: flex !important;
    }
    
    /* En móvil, hacer las flechas un poco más transparentes */
    .modal-nav-arrow.mobile-nav:not(:hover) {
        background: rgb(0 0 0 / 35%);
        color: white;
    }
}

/* En pantallas muy pequeñas, hacer las flechas móviles aún más discretas */
@media (max-width: 480px) {
    .modal-nav-arrow.mobile-nav {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .modal-nav-arrow.mobile-nav.prev {
        left: 8px;
    }
    
    .modal-nav-arrow.mobile-nav.next {
        right: 8px;
    }
}

/* ===============================
   ESTILOS PARA SERIES DE DEMO
   =============================== */

.comic-card-epic.demo-card {
    position: relative;
    cursor: default !important;
    opacity: 0.8;
}

.comic-card-epic.demo-card::after {
    content: '🎨 Demo';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(129, 215, 66, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
}

.comic-card-epic.demo-card:hover {
    transform: none !important;
}
