/* Filter Tabs */
.filter-tab {
    padding: 8px 24px;
    border-radius: 100px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-tab:hover {
    color: var(--text-color);
}

.filter-tab.active {
    background: var(--primary-color);
    color: white;
}

/* Gallery Masonry Grid */
.gallery-masonry {
    columns: 1;
    column-gap: 1.5rem;
}

@media (min-width: 640px) {
    .gallery-masonry { columns: 2; }
}

@media (min-width: 1024px) {
    .gallery-masonry { columns: 3; }
}

@media (min-width: 1280px) {
    .gallery-masonry { columns: 4; }
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
    border-color: var(--card-hover-border);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 24px 16px 16px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    transform: translateY(0);
}

.gallery-item-title {
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}

.gallery-item-meta {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.7);
}

/* MODAL MEJORADO con mejor responsividad */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(30, 30, 35, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(217, 116, 71, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1002;
}

.modal-close-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1) rotate(90deg);
}

.modal-content {
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    gap: 2rem;
    position: relative;
}

.modal-image-section {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.modal-main-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 50px -20px rgba(0,0,0,0.8);
}

.modal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(30, 30, 35, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.modal-arrow:hover {
    opacity: 1;
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.modal-arrow.left { left: 20px; }
.modal-arrow.right { right: 20px; }

.modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 35, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 100px;
    font-size: 0.875rem;
    color: white;
    border: 1px solid rgba(217, 116, 71, 0.3);
}

.modal-info-section {
    width: 350px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    padding: 32px;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 24px;
    line-height: 1.3;
}

.modal-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* MEJORADO: Mejor centrado de iconos y contenido */
.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.detail-row i {
    font-size: 1.1rem;
    margin-top: 4px;
    min-width: 20px;
    text-align: center;
    color: var(--primary-color);
    opacity: 0.8;
}

.detail-row > div {
    flex: 1;
    min-width: 0;
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.detail-row p {
    color: var(--text-color);
    line-height: 1.5;
    margin: 0;
}

.detail-link {
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.detail-link:hover {
    color: var(--primary-hover);
    transform: translateX(4px);
}

.detail-link i {
    font-size: 0.9rem;
    margin-top: 0;
    min-width: auto;
}

/* RESPONSIVIDAD MEJORADA para dispositivos móviles */
@media (max-width: 1024px) {
    .modal-content {
        flex-direction: column;
        max-height: calc(100vh - 40px);
        gap: 0;
    }
    
    .modal-image-section {
        flex: 0 1 auto;
        max-height: 55vh;
        min-height: 250px;
    }
    
    .modal-main-image {
        max-height: 55vh;
    }
    
    .modal-info-section {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        border-radius: 24px 24px 0 0;
        padding: 24px;
        max-height: 45vh;
        min-height: 200px;
    }
    
    .modal-arrow {
        width: 44px;
        height: 44px;
        font-size: 0.9rem;
    }
    
    .modal-arrow.left { left: 15px; }
    .modal-arrow.right { right: 15px; }
}

/* MEJORADO: Mejor soporte para móviles pequeños */
@media (max-width: 640px) {
    .modal-overlay {
        padding: 0;
    }
    
    .modal-close-btn {
        width: 44px;
        height: 44px;
        top: 15px;
        right: 15px;
        font-size: 1.1rem;
    }
    
    .modal-content {
        height: 100vh;
        max-height: 100vh;
        width: 100%;
    }
    
    .modal-image-section {
        padding: 60px 15px 15px;
        max-height: 50vh;
        min-height: 200px;
    }
    
    .modal-main-image {
        border-radius: 8px;
        max-height: 45vh;
    }
    
    .modal-info-section {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 20px 20px 0 0;
        padding: 20px 20px 30px;
        max-height: 50vh;
        min-height: auto;
        width: 100%;
        margin: 0;
    }
    
    .modal-title {
        font-size: 1.25rem;
        margin-bottom: 20px;
        line-height: 1.2;
    }
    
    .modal-details {
        gap: 16px;
    }
    
    .detail-row {
        gap: 12px;
    }
    
    .detail-row i {
        font-size: 1rem;
        margin-top: 2px;
        min-width: 18px;
    }
    
    .detail-label {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .detail-row p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .detail-link {
        font-size: 0.9rem;
        gap: 6px;
    }
    
    .modal-counter {
        bottom: 15px;
        padding: 6px 16px;
        font-size: 0.8rem;
    }
    
    .modal-arrow {
        width: 40px;
        height: 40px;
        font-size: 0.85rem;
    }
    
    .modal-arrow.left { left: 10px; }
    .modal-arrow.right { right: 10px; }
}

/* NUEVOS: Dispositivos muy pequeños (320px y menos) */
@media (max-width: 400px) {
    .modal-image-section {
        padding: 55px 10px 10px;
        max-height: 45vh;
    }
    
    .modal-main-image {
        max-height: 40vh;
    }
    
    .modal-info-section {
        max-height: 55vh;
        padding: 16px 16px 25px;
        border-radius: 16px 16px 0 0;
    }
    
    .modal-title {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }
    
    .modal-details {
        gap: 14px;
    }
    
    .detail-row {
        gap: 10px;
    }
    
    .detail-row i {
        font-size: 0.95rem;
        min-width: 16px;
    }
    
    .detail-label {
        font-size: 0.65rem;
    }
    
    .detail-row p {
        font-size: 0.85rem;
    }
    
    .detail-link {
        font-size: 0.85rem;
    }
    
    .modal-close-btn {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
        font-size: 1rem;
    }
    
    .modal-counter {
        bottom: 10px;
        padding: 5px 12px;
        font-size: 0.75rem;
    }
    
    .modal-arrow {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
}

/* Touch gesture hint mejorado */
@media (hover: none) {
    .modal-image-section::after {
        content: attr(data-hint);
        position: absolute;
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.7);
        padding: 8px 16px;
        border-radius: 100px;
        font-size: 0.875rem;
        color: white;
        opacity: 0;
        animation: hintFade 3s ease-in-out;
        pointer-events: none;
        z-index: 10;
    }
    
    @keyframes hintFade {
        0%, 100% { opacity: 0; }
        20%, 80% { opacity: 1; }
    }
}

/* Mejor scroll en modal info para dispositivos pequeños */
.modal-info-section {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.modal-info-section::-webkit-scrollbar {
    width: 4px;
}

.modal-info-section::-webkit-scrollbar-track {
    background: transparent;
}

.modal-info-section::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}
