/* ============================================
   Crecer Digital - Lightbox Modal + Filter 3D Transitions
   ============================================ */

/* ---- PORTFOLIO GRID - Perspectiva 3D habilitada ---- */
.portfolio-grid {
    perspective: 1200px;
    perspective-origin: 50% 40%;
}

.portfolio-item {
    transform-style: preserve-3d;
    will-change: transform, opacity;
    cursor: pointer;
}

/* ---- FILTER BUTTONS - Estilo premium mejorado ---- */
.filter-btn {
    position: relative;
    overflow: hidden;
}

.filter-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-cta);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50px;
    z-index: -1;
}

.filter-btn.active::after,
.filter-btn:hover::after {
    opacity: 1;
}

.filter-btn.active {
    animation: filterActivePulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes filterActivePulse {
    0% { transform: scale(0.92); }
    60% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* ---- VIDEO en tarjetas de portafolio ---- */
.portfolio-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #050a1a;
}

/* ---- LIGHTBOX OVERLAY ---- */
#portfolio-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

#portfolio-lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 26, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.lightbox-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: min(90vw, 960px);
    width: 100%;
    padding: 1rem;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#portfolio-lightbox.active .lightbox-container {
    transform: scale(1) translateY(0);
}

/* ---- BOTÓN CERRAR ---- */
.lightbox-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 44px;
    height: 44px;
    background: rgba(0, 87, 255, 0.2);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(0, 87, 255, 0.6);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
}

/* ---- BOTONES PREV / NEXT ---- */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(13, 27, 62, 0.85);
    border: 1px solid rgba(0, 87, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.lightbox-prev { left: -24px; }
.lightbox-next { right: -24px; }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 87, 255, 0.5);
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 87, 255, 0.4);
}

/* ---- MEDIA WRAPPER ---- */
.lightbox-media-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    border: 1px solid rgba(0, 87, 255, 0.2);
    border-bottom: none;
}

.lightbox-media {
    width: 100%;
    height: 100%;
    max-height: 60vh;
    object-fit: contain;
    display: block;
}

/* ---- LOADER ---- */
.lightbox-loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(0, 87, 255, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: lightboxSpin 0.8s linear infinite;
}

@keyframes lightboxSpin {
    to { transform: rotate(360deg); }
}

/* ---- INFO PANEL ---- */
.lightbox-info {
    width: 100%;
    background: rgba(13, 27, 62, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 87, 255, 0.2);
    border-top: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 0 0 16px 16px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.lightbox-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-display);
    background: rgba(0, 87, 255, 0.25);
    color: var(--color-accent);
    border: 1px solid rgba(0, 229, 255, 0.3);
    width: fit-content;
}

/* Colores por categoría en el lightbox */
.lightbox-badge.branding-badge,
.lightbox-badge.ads-badge {
    background: rgba(255, 107, 0, 0.2);
    color: #FF9500;
    border-color: rgba(255, 107, 0, 0.35);
}

.lightbox-badge.video-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}

.lightbox-badge.software-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.35);
}

.lightbox-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0;
}

.lightbox-desc {
    font-size: 0.88rem;
    color: var(--color-muted);
    line-height: 1.6;
    margin: 0;
}

/* ---- RESPONSIVE LIGHTBOX ---- */
@media (max-width: 768px) {
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
    .lightbox-close { top: 8px; right: 8px; }
    .lightbox-container { padding: 0.5rem; }
    .lightbox-media-wrapper { max-height: 45vh; min-height: 200px; }
}

/* ---- BADGE COLORES en tarjetas (referencia) ---- */
.portfolio-category-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
    background: rgba(0, 87, 255, 0.2);
    color: var(--color-accent);
    border: 1px solid rgba(0, 229, 255, 0.25);
}

.branding-badge, .ads-badge {
    background: rgba(255, 107, 0, 0.15);
    color: #FF9500;
    border-color: rgba(255, 107, 0, 0.3);
}

.video-badge {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.software-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.web-badge {
    background: rgba(0, 87, 255, 0.2);
    color: var(--color-accent);
    border-color: rgba(0, 229, 255, 0.25);
}

/* ============================================
   LIGHTBOX PROJECT CAROUSEL / SLIDER
   ============================================ */

.lightbox-carousel {
    position: relative;
    width: 100%;
}

.lightbox-counter {
    position: absolute;
    top: 10px;
    right: 14px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
    background: rgba(5, 10, 26, 0.7);
    border: 1px solid rgba(0,229,255,0.25);
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 1px;
    z-index: 5;
    backdrop-filter: blur(6px);
    pointer-events: none;
}

.lightbox-slides-container {
    position: relative;
    width: 100%;
    min-height: 240px;
    max-height: 60vh;
    overflow: hidden;
    background: #050a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lightbox-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-slide.active-slide {
    opacity: 1;
    pointer-events: all;
}

.lightbox-slide img,
.lightbox-slide video {
    width: 100%;
    height: 100%;
    max-height: 60vh;
    object-fit: contain;
    display: block;
}

.lightbox-thumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    background: rgba(5, 10, 26, 0.85);
    border: 1px solid rgba(0,87,255,0.15);
    border-top: none;
    border-bottom: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,87,255,0.4) transparent;
}

.lightbox-thumbs::-webkit-scrollbar { height: 3px; }
.lightbox-thumbs::-webkit-scrollbar-thumb {
    background: rgba(0,87,255,0.4);
    border-radius: 2px;
}

.lightbox-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    background: rgba(13,27,62,0.8);
    position: relative;
}

.lightbox-thumb img,
.lightbox-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.lightbox-thumb:hover {
    border-color: rgba(0,229,255,0.5);
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(0,229,255,0.25);
}

.lightbox-thumb.active-thumb {
    border-color: var(--color-accent);
    box-shadow: 0 0 14px rgba(0,229,255,0.5);
    transform: scale(1.12);
}

.lightbox-thumb.is-video::after {
    content: '▶';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 0 6px rgba(0,0,0,0.8);
    pointer-events: none;
}

.lb-carousel-prev,
.lb-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(5, 10, 26, 0.85);
    border: 1px solid rgba(0, 87, 255, 0.4);
    border-radius: 50%;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s ease;
    backdrop-filter: blur(8px);
    z-index: 6;
    line-height: 1;
}

.lb-carousel-prev { left: 10px; }
.lb-carousel-next { right: 10px; }

.lb-carousel-prev:hover,
.lb-carousel-next:hover {
    background: rgba(0, 87, 255, 0.6);
    border-color: rgba(0, 229, 255, 0.7);
    box-shadow: 0 0 18px rgba(0, 87, 255, 0.45);
}

@media (max-width: 768px) {
    .lightbox-thumb { width: 46px; height: 34px; }
    .lb-carousel-prev { left: 4px; }
    .lb-carousel-next { right: 4px; }
    .lightbox-slides-container { max-height: 42vh; }
    .lightbox-slide img, .lightbox-slide video { max-height: 42vh; }
}
