/* ====================================
   ESTILOS ESPECÍFICOS PARA INDEX.PHP
   ==================================== */

/* === LAZY LOADING === */
.lazy-img {
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background-color: #f8f9fa;
    transform: scale(0.95);
}

.lazy-loaded {
    opacity: 1;
    transform: scale(1);
}

/* Placeholder mejorado */
.lazy-img[src*="data:image/svg"] {
    filter: blur(2px);
}

/* === COMPARADOR DE IMÁGENES === */
.image-compare-container {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

.image-compare {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.img-before, .img-after {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
}

.img-after {
    position: absolute;
    top: 0;
    left: 0;
    clip-path: inset(0 0 0 50%);
    transition: clip-path 0.1s ease;
}

.slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: #fff;
    cursor: ew-resize;
    transform: translateX(-50%);
    z-index: 10;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.slider-line {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #fff, #f8d568, #fff);
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: #fff;
    border: 3px solid #f8d568;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    cursor: ew-resize;
}

.slider-handle-icon {
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

.label-before, .label-after {
    position: absolute;
    top: 20px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.label-before {
    left: 20px;
}

.label-after {
    right: 20px;
}

/* === PORTFOLIO === */
.portfolio-box {
    position: relative;
    transition: transform 0.3s ease;
}

.portfolio-box:hover {
    transform: scale(1.05);
}

.portfolio-box:hover .portfolio-box-caption {
    opacity: 1;
}

/* === MEJORAS VISUALES PARA PORTFOLIO === */

/* Badge de comparación - REPOSICIONADO */
.portfolio-compare-badge {
    position: absolute;
    bottom: 70px; /* CAMBIO: Ahora va abajo, arriba del caption */
    right: 15px;
    background: linear-gradient(135deg, #f8d568, #ffa726);
    color: #333;
    padding: 8px 12px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(248, 213, 104, 0.4);
    transform: translateY(10px); /* CAMBIO: Viene desde abajo */
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
    pointer-events: none;
}

.portfolio-box:hover .portfolio-compare-badge {
    transform: translateY(0);
    opacity: 1;
}

/* Texto de instrucción flotante - REPOSICIONADO */
.portfolio-instruction {
    position: absolute;
    bottom: 20px; /* CAMBIO: Más abajo aún */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
    pointer-events: none;
}

.portfolio-box:hover .portfolio-instruction {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* Icono de comparación flotante - ARROW ICON POR DEFECTO */
.portfolio-box::after {
    
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.95);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 2;
    pointer-events: none;
    border: 3px solid #f8d568;
}

.portfolio-box:hover::after {
    transform: translate(-50%, -50%) scale(1);
    animation: pulse 2s infinite;
}

/* Variaciones de iconos para diferentes proyectos - SI QUIERES VARIEDAD */
.portfolio-box[data-icon="search"]::after {
    content: '🔍';
}

.portfolio-box[data-icon="compare"]::after {
    content: '⚡';
}

.portfolio-box[data-icon="magic"]::after {
    content: '✨';
}

.portfolio-box[data-icon="arrow"]::after {
    content: 'Click para ver el resultado';
}

.portfolio-box[data-icon="before-after"]::after {
    content: '🔄';
}

.portfolio-box[data-icon="zoom"]::after {
    content: '🔎';
}

/* Responsive - móviles */
@media (max-width: 768px) {
    .portfolio-compare-badge {
        font-size: 10px;
        padding: 6px 10px;
        bottom: 60px;
        right: 10px;
        /* En móviles, mostrar siempre el badge */
        opacity: 1;
        transform: translateY(0);
    }
    
    .portfolio-instruction {
        font-size: 12px;
        padding: 8px 16px;
        bottom: 15px;
    }
    
    .portfolio-box::after {
        font-size: 2rem;
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .slider-handle {
        width: 45px;
        height: 45px;
    }
    
    .slider-handle-icon {
        font-size: 12px;
    }
    
    .label-before, .label-after {
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* === NAVBAR MEJORADA === */

/* Override para navbar más visible al hacer scroll */
#mainNav {
    transition: all 0.4s ease;
}

/* Estado inicial transparente en desktop */
@media (min-width: 992px) {
    #mainNav {
        background: rgba(255, 255, 255, 0.1) !important;
        box-shadow: none !important;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }
    
    /* Estado cuando hace scroll - VISIBLE Y LEGIBLE */
    #mainNav.navbar-scrolled {
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    /* Links del navbar */
    #mainNav .navbar-nav .nav-item .nav-link {
        transition: all 0.3s ease;
        position: relative;
    }
    
    /* Efecto underline animado */
    #mainNav .navbar-nav .nav-item .nav-link::after {
        content: '';
        position: absolute;
        bottom: -5px;
        left: 50%;
        width: 0;
        height: 2px;
        background: linear-gradient(90deg, #f8d568, #ffa726);
        transition: all 0.3s ease;
        transform: translateX(-50%);
    }
    
    #mainNav .navbar-nav .nav-item .nav-link:hover::after,
    #mainNav .navbar-nav .nav-item .nav-link.active::after {
        width: 100%;
    }
    
    /* Cambio de color más legible al hacer scroll */
    #mainNav.navbar-scrolled .navbar-nav .nav-item .nav-link {
        color: #333 !important;
        font-weight: 600;
    }
    
    #mainNav.navbar-scrolled .navbar-nav .nav-item .nav-link:hover {
        color: #f8d568 !important;
    }
    
    #mainNav.navbar-scrolled .navbar-brand {
        color: #333 !important;
    }
    
    #mainNav.navbar-scrolled .navbar-brand:hover {
        color: #f8d568 !important;
    }
}

/* Para móviles - siempre visible */
@media (max-width: 991px) {
    #mainNav {
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    #mainNav.navbar-scrolled {
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    }
}

/* Animación suave para el logo */
#mainNav .navbar-brand img {
    transition: all 0.3s ease;
}

#mainNav.navbar-scrolled .navbar-brand img {
    transform: scale(0.95);
}