/* ===========================
   main css.css (versión corregida)
   Compatibilidad: iOS Safari, Chrome, Firefox, Edge, Opera
   Manteniendo tu estructura anidada original
   =========================== */

/* Variables y resets mínimos */
:root{
  --color--primary: #0d6efd;
  --color--secundary: #1b274a;
}

*,
*::before,
*::after{ box-sizing: border-box; }

html{
  height: 100%;
  height: -webkit-fill-available; /* iOS */
}

body{
  margin: 0;
  color: #333;
  background: #fff;
  min-height: 100vh;
  min-height: 100svh; /* iOS moderno */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Accesibilidad: si el usuario prefiere menos animación */
@media (prefers-reduced-motion: reduce){
  *{
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Spinner */
@keyframes spinner{
  0%{ transform: rotate(0deg); }
  100%{ transform: rotate(360deg); }
}

.wrapper{
    width: 100%;
    /* Altura y scroll seguros para iOS */
    min-height: 100vh;
    min-height: 100svh;
    position: relative;
    /* Importante: evitar overflow:auto aquí para que position: sticky funcione en hijos */
    overflow-x: hidden;
    overflow-y: visible;
    display: block;
    scroll-behavior: smooth;

    .loading-page{
        width: 100%;
        height: 100%;
        position: fixed;left: 0px;top: 0px;z-index: 1001;
        background-color: white;
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 1;
        transition: opacity ease-in-out 0.2s;

        &.hide{
            opacity: 0;
        }

        .content{
            /* fit-content mejora compatibilidad amplia, manteniendo intención */
            width: fit-content; height: fit-content;
            position: relative;

            .logo{
                width: fit-content;height: 60px;
                img{
                    width: auto;height: 100%;
                    display: block;
                }
            }
            span{
                width: 100%;
                position: absolute;
                top: calc( 100% + 20px);
                display: block;
                text-align: center;
                font-size: 14px;

                i.spinner{
                    width: 14px;height: 14px;
                    margin-left: 4px;
                    animation: spinner ease-in-out 0.5s infinite;
                    border: solid 4px var(--color--primary);
                    border-left: solid 4px transparent;
                    border-radius: 100%;
                    display: inline-block;
                }
            }
        }
        a{
            width: fit-content;max-width: 100%;
            position: absolute;bottom: 20px;
            font-size: 16px;
            font-weight: 600;
            color: #333;
            opacity: 0.5;
        }
    }

    .button-float{
        width: 40px;height: 40px;
        position: fixed;bottom: 80px;right: 40px;z-index: 10;
        background-color: var(--color--primary);
        border: none;
        border-radius: 40px;
        cursor: pointer;
        display: flex;
        justify-content: center;align-items: center;
        -webkit-tap-highlight-color: transparent;
        transition: transform .2s ease-in-out;

        .icon{
            color: white;
        }

        &::before{
            content: "Ir arriba";
            width: 40px;height: 40px;
            padding-left: 20px;
            position: absolute;
            right: 0px;
            background-color: rgb(70, 70, 70);
            border-radius: 40px;
            display: flex;
            align-items: center;
            overflow: hidden;
            opacity: 0;
            color: white;
            transition: all ease-in-out 0.2s;
            pointer-events: none;
            white-space: nowrap;
        }

        &:hover{
            transform: scale(1.05);
            &::after{
                content: "";
                width: 100px;height: 40px;
                position: absolute;right: 0px;
            }
            &::before{
                width: 100px;
                right: calc(100% + 10px);
                opacity: 1;
            }
        }
    }
    .button-float-chatbot{
        width: 40px;height: 40px;
        position: fixed;bottom: 30px;right: 40px;z-index: 10;
        background-color: var(--color--primary);
        border: none;
        border-radius: 40px;
        cursor: pointer;
        display: flex;
        justify-content: center;align-items: center;
        -webkit-tap-highlight-color: transparent;
        transition: transform .2s ease-in-out;

        .icon{
            color: white;
        }

        &::before{
            content: "Chatea con nuestro agente";
            width: 40px;height: 40px;
            padding-left: 20px;
            position: absolute;
            right: 0px;
            background-color: rgb(70, 70, 70);
            border-radius: 40px;
            display: flex;
            align-items: center;
            overflow: hidden;
            opacity: 0;
            color: white;
            transition: all ease-in-out 0.2s;
            pointer-events: none;
            white-space: nowrap;
        }

        &:hover{
            transform: scale(1.05);
            &::after{
                content: "";
                width: 260px;height: 40px;
                position: absolute;right: 0px;
            }
            &::before{
                width: 260px;
                right: calc(100% + 10px);
                opacity: 1;
            }
        }
    }

    .hamburguesa{
        width: 100dvw;height: 100dvh;
        position: fixed;left: 0px;top: 0px;z-index: 1000;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        display: none;

        &.active{
            display: flex;
        }

        button{
            width: 40px;height: 40px;
            position: absolute;top: 80px;right: 80px;z-index: 1;
            border: none;
            border-radius: 40px;
            cursor: pointer;
            background-color: var(--color--secundary);
            color: #fff;
        }

        .content{
            width: fit-content;max-width: 100%;
            height: fit-content;max-height: 100%;
            padding: 10px;
            display: block;

            .row{
                width: 100%;height: max-content;
                margin-bottom: 4px;
                display: flex;flex-wrap: wrap;gap: 10px;

                a{
                    width: 100%;
                    margin-bottom: 10px;
                    display: flex;flex-wrap: wrap;gap: 10px;
                    text-decoration: none;
                    cursor: pointer;
                    color: #333;
                    font-size: 20px;
                    &:hover{
                        transform: scale(1.05);
                    }
                }

                &.top{
                    margin-bottom: 4px;
                    img{
                        height: 60px;
                        display: block;
                    }
                }
                &.locations{
                    margin-bottom: 20px;
                    a{
                        width: fit-content;
                        img{
                            height: 24px;
                            display: block;
                            border-radius: 4px;
                            &:hover{
                                transform: scale(1.05);
                            }
                        }
                    }
                }
                &.about{
                    margin-bottom: 40px;
                }

                &.social{
                    margin-top: 10px;
                    display: flex;gap: 10px;

                    a{
                        width: 36px;height: 36px;
                        display: flex;
                        justify-content: center;align-items: center;
                        background-color: var(--color--primary);
                        border-radius: 100%;
                        font-size: 20px;
                        color: white;
                    }
                }
            }
        }
    }

    nav{
        width: calc(100% - 12px);
        padding-top: 10px;padding-bottom: 10px;
        position: fixed;left: 0px;top: 0px;z-index: 10;
        background-color: white;
        display: flex; flex-wrap: wrap; gap: 20px;
        align-items: center;

        .logo{
            width: fit-content;height: 34px;
            margin-right: auto;

            img{
                width: auto;height: 100%;
                display: block;
            }
        }
        ul{
            width: fit-content;max-width: 100%;
            display: flex;flex-wrap: wrap;gap: 20px;
            align-items: center;
            a{
                width: fit-content;
                display: flex;gap: 4px;
                font-size: 18px;
                text-decoration: none;
                color: #333;
                cursor: pointer;
                border-bottom: solid 2px transparent;

                &:hover{
                    border-bottom: solid 2px var(--color--primary);
                }
            }
        }
        button{
            width: 40px;height: 40px;
            background-color: var(--color--primary);
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 22px;
            color: white;

            &:hover{
                box-shadow: #333 0px 0px 2px;
            }
        }
    }

    header, nav, section, footer{
        padding-left: 10%;
        padding-right: 10%;
    }

    header{
        width: 100%;height: max-content;
        padding-top: 20px;
        padding-bottom: 20px;
        display: block;
        position: relative;z-index: 11;
        background-color: white;

        .top{
            width: 100%;height: max-content;
            display: flex;flex-wrap: wrap;gap: 20px;
            align-items: center;
            
            .logo{
                width: fit-content;height: 60px;
                margin-right: auto;

                img{
                    width: auto;height: 100%;
                    display: block;
                }
            }
            ul{
                width: fit-content;max-width: 100%;
                display: flex;flex-wrap: wrap;gap: 20px;
                align-items: center;

                a{
                    display: flex;gap: 4px;
                    font-size: 18px;
                    text-decoration: none;
                    color: #333;
                    cursor: pointer;
                    border-bottom: solid 2px transparent;

                    &:hover{
                        border-bottom: solid 2px var(--color--primary);
                    }
                }
            }
            button{
                width: 40px;height: 40px;
                background-color: var(--color--primary);
                border: none;
                border-radius: 4px;
                cursor: pointer;
                font-size: 22px;
                color: white;

                &:hover{
                    box-shadow: #333 0px 0px 2px;
                }
            }
        }
        hr{
            width: 100%;height: 0.5px;
            margin-top: 10px;
            margin-bottom: 20px;
            background-color: #7f7f7f;
            border: none;
            outline: none;
        }
        .bottom{
            width: 100%;
            display: flex;flex-wrap: wrap; gap: 20px;
            align-items: center;

            .social{
                width: fit-content;max-width: 100%;
                margin-right: auto;
                display: flex;flex-wrap: wrap;gap: 14px;

                a{
                    width: fit-content;height: max-content;
                    display: flex;flex-wrap: wrap;gap: 4px;
                    font-size: 16px;
                    cursor: pointer;
                    text-decoration: none;
                    color: #333;

                    &:hover{
                        color: var(--color--primary);
                    }
                }
            }
            .locations{
                width: fit-content;height: max-content;
                display: flex;flex-wrap: wrap;gap: 10px;

                a{
                    width: fit-content;height: max-content;
                    display: block;
                    cursor: pointer;
                    &:hover{
                        transform: scale(1.05);
                    }
                    
                    img{
                        width: auto;
                        height: 20px;
                        display: block;
                        border-radius: 2px;
                        background-color: #333;
                        box-shadow: #333 0px 0px 2px;
                    }
                }
            }
            a{
                cursor: pointer;
            }
        }
    }

    .video-home{
        width: 100%;height: max-content;
        margin-bottom: 40px;
        position: relative;

        .details{
            width: 100%;
            height: max-content; min-height: 100dvh;
            display: flex;flex-wrap: wrap; gap: 40px;
            align-items: center;
            justify-content: center;
            position: relative;z-index: 1;
            background-color: rgba(0, 0, 0, 0.5);

            img{
                width: 500px;max-width: 100%;
                height: auto;
                display: block;
                border-radius: 10px;
            }
            .about{
                width: 500px;max-width: 100%;
                padding: 20px;

                h2, p{
                    width: 100%;
                    display: block;
                }
                h2{
                    margin-bottom: 20px;
                    font-size: clamp(28px, 4vw, 40px);
                    color: white;
                }
                p{
                    margin-bottom: 20px;
                    font-size: clamp(16px, 2.6vw, 20px);
                    color: rgb(219, 219, 219);
                }
                a{
                    width: fit-content;height: max-content;
                    padding: 10px 40px;
                    background-color: var(--color--primary);
                    border: none;
                    border-radius: 40px;
                    display: flex;flex-wrap: wrap;gap: 10px;
                    cursor: pointer;
                    color: white;
                    text-decoration: none;
                }
            }
            .bottom{
                width: 100%;
                padding: 10px;
                display: flex;
                justify-content: center;
            }
        }

        video.video-bg{
            width: 100%;height: 100%;
            display: block;
            object-fit: cover;
            position: absolute;left: 0px;top: 0px;z-index: 0;
        }

    }

    section{
        width: 100%;
        margin-bottom: 40px;
        height: max-content;min-height: 100dvh;

        h2{
            width: 100%;
            margin-bottom: 20px;
            font-size: 30px;
        }

        &.moment{
            .flex{
                width: 100%;
                display: flex;flex-wrap: wrap;gap: 40px;
                justify-content: center;

                .details{
                    width: 400px;max-width: 100%;
                    
                    p{
                        width: 100%;
                        margin-bottom: 20px;
                        font-size: 40px;
                        color: black;
                    }
                    span{
                        font-size: 16px;
                        color: #333;
                    }
                }
                img{
                    width: 400px;max-width: 100%;
                    height: auto;
                    object-fit: cover;
                    display: block;
                    border-radius: 8px;
                    box-shadow: black 0px 0px 4px, var(--color--secundary) 20px 20px 0px 2px;
                }
            }
        }

        &.client{
            padding: 40px;
            position: relative;

            h3{
                margin-bottom: 40px;
                font-size: 40px;
                text-align: center;
                position: relative;z-index: 1;
                color: white;
            }
            .bg{
                width: 100%;height: 100%;
                position: absolute;left: 0px;top: 0px;z-index: 0;
                
                
                background-image: url('../media/picture1.jpg');
                background-size: cover;
                        
                &::after {
                    content: '';
                    width: 100%; height: 10%;
                    position: absolute; left: 0px;
                    top: 0px;
                    background: linear-gradient(0deg,rgba(255, 255, 255, 0) 0%, rgb(255, 255, 255) 100%);
                }
            }
        }

        .flex{
            width: 100%;height: max-content;
            display: flex;flex-wrap: wrap;gap: 40px;
            justify-content: space-evenly;
            position: relative;z-index: 1;

            article{
                width: 240px;max-width: 100%;
                display: block;

                .top{
                    width: 100%;
                    padding: 10px 0px;
                    margin-bottom: 40px;
                    display: flex;
                    justify-content: center;
                    color: #ffffff;
                    font-size: 20px;
                    span{
                        width: 100%;
                        display: flex;flex-wrap: wrap; gap: 4px;
                        justify-content: center;
                        text-align: center;
                    }
                }
                .pin{
                    width: 100%;height: max-content;
                    position: relative;
                    display: block;
                    cursor: pointer;
                    &:hover{
                        transform: scale(1.01);
                        button{
                            transform: scale(1.1);
                        }
                    }

                    img{
                        width: 100%;height: auto;
                        margin-bottom: 20px;
                        border-radius: 50%;
                        display: block;
                        border: solid 4px white;
                    }
                    button{
                        width: 50px;height: 50px;
                        position: absolute;left: 20px;bottom: 20px;
                        background-color: var(--color--primary);
                        cursor: pointer;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        border: solid 1px white;
                        border-radius: 50%;
                        color: white;
                    }
                }
                p{
                    width: 100%;
                    margin-bottom: 20px;
                    text-align: center;
                    font-size: 20px;
                    font-weight: 600;
                    color: white;
                }
                span.message{
                    width: 100%;
                    padding: 10px 20px;
                    margin-bottom: 10px;
                    display: block;
                    background-color: var(--color--secundary);
                    color: white;
                    border-radius: 10px;
                    position: relative;

                    &::before{
                        content: "";
                        width: 10px;height: 10px;
                        position: absolute;left: -5px;top: 14px;
                        transform: rotate(45deg);
                        background-color: var(--color--secundary);
                    }
                }
            }
        }

        &.bottom{
            width: 100%;
            margin-bottom: 40px;
            display: flex;flex-wrap: wrap;
            row-gap: 40px;
            justify-content: space-between;
            position: relative;top: 0px;

            .main{
                width: 600px;max-width: 100%;
                height: max-content;
                padding: 10px;
                display: flex; flex-wrap: wrap; gap: 10px;
                /* position: sticky; top: 60px; */

                .about{
                    width: 500px;max-width: 100%;
                    height: max-content;
                    margin-bottom: 20px;

                    .about-media{
                        width: 100%;max-width: 100%;
                        margin-bottom: 20px;
                        aspect-ratio: 16/9;
                        position: relative;
                        border-radius: 10px;
                        overflow: hidden;
                        display: flex;
                        justify-content: center;
                        align-items: center;

                        img{
                            width: 100%;height: 100%;
                            display: block;
                            object-fit: cover;
                        }

                        button{
                            width: 80px;height: 80px;
                            position: absolute;
                            display: flex;
                            justify-content: center;align-items: center;
                            background-color: white;
                            border-radius: 50%;
                            color: #333;
                            font-size: 30px;
                            cursor: pointer;
                            border: none;
                        }

                        iframe{
                            width: 100%;height: 100%;
                            display: block;
                            border: none;
                        }
                    }

                    p{
                        width: 100%;
                        font-size: 20px;
                        margin-bottom: 20px;
                        color: #333;
                    }
                }

                .afiliados{
                    width: 100%;
                    margin-bottom: 20px;

                    .pin{
                        width: 800px;max-width: 100%;
                        height: max-content;
                        position: relative;
                        display: flex;flex-wrap: wrap;
                        justify-content: center;
                        align-items: center;
                        overflow: hidden;
                        border-radius: 10px;
                        box-shadow: #333 0px 0px 4px;

                        img{
                            width: 100%;height: 100%;
                            display: block;
                            object-fit: cover;
                            position: absolute;
                        }
                        
                        p, a, span{
                            position: relative;
                        }
                        span{
                            width: fit-content;max-width: 100%;
                            height: max-content;
                            display: block;
                            padding: 40px 20px;
                            padding-bottom: 10px;
                            color: white;
                            font-size: 40px;
                            text-align: center;
                            font-weight: 700;
                            text-shadow: black 0px 2px 2px;
                        }
                        p{
                            width: 100%;
                            margin-bottom: 100px;
                            color: white;
                            text-shadow: black 0px 0px 2px;
                            font-size: 18px;
                            text-align: center;
                            display: block;
                        }
                        a{
                            width: fit-content;height: max-content;
                            padding: 20px 40px;
                            font-size: 18px;
                            text-align: center;
                            color: var(--color--primary);
                            cursor: pointer;
                            display: block;
                            background-color: var(--color--secundary);
                            position: absolute;bottom: 20px;
                            border-radius: 10px;
                            color: white;
                            display: flex;gap: 10px;
                            box-shadow: #333 0px 0px 2px;
                            text-decoration: none;
                        }
                    }
                }

                h3{
                    width: 100%;
                    display: block;
                }
                .btn-whatsapp{
                    width: fit-content;
                    padding: 10px 30px;
                    margin-bottom: 40px;
                    background-color: var(--color--secundary);
                    border-radius: 40px;
                    color: white;
                    text-decoration: none;
                    display: flex;flex-wrap: wrap;gap: 10px;
                    align-items: center;
                }

                form{
                    width: 360px;max-width: 100%;
                    height: max-content;
                    padding: 20px;
                    display: block;
                    background-color: var(--color--secundary);
                    border-radius: 10px;
                    box-shadow: black 0px 0px 4px, #333 -10px 20px 2px;

                    label{
                        width: 100%;
                        margin-bottom: 10px;
                        display: block;
                    }
                    input, textarea{
                        width: 100%;height: max-content;
                        margin-bottom: 20px;
                        padding: 10px 20px;
                        background-color: white;
                        border: solid 1px #2d2d2d;
                        border-radius: 4px;
                        color: #333;
                    }
                    textarea{
                        resize: vertical;
                    }

                    button{
                        width: 100%;
                        padding: 10px 20px;
                        border-radius: 20px;
                        background-color: var(--color--primary);
                        cursor: pointer;
                        border: none;
                        color: white;
                        font-size: 16px;
                        box-shadow: #333 0px 0px 2px;
                    }
                }
            }
            .aside{
                width: 100%;max-width: 100%;
                height: max-content;
                display: flex; flex-wrap: wrap; gap: 20px;
                justify-content: center;
                /* position: sticky; top: 60px; */

                img{
                    width: 200px;
                    display: block;
                    border-radius: 4px;
                }
            }
        }
    }

    footer{
        width: 100%;height: max-content;
        padding-top: 40px;
        padding-bottom: 40px;
        display: block;
        position: relative;z-index: 0;
        display: flex; flex-wrap: wrap;

        .about{
            width: 300px;max-width: 100%;
            margin-right: auto;
            img{
                width: auto;height: 60px;
                margin-bottom: 10px;
                display: block;
            }
            p{
                width: 100%;
                margin-bottom: 20px;
                display: block;
                font-size: 16px;
                color: #333;
            }
            & > a{
                display: block;
                margin-bottom: 20px;
                color: var(--color--secundary);
                text-decoration: none;
            }
            .flex{
                width: 100%;
                margin-bottom: 40px;
                display: flex;flex-wrap: wrap;gap: 10px;

                a{
                    width: 30px;height: 30px;
                    font-size: 22px;
                    color: white;
                    text-decoration: none;
                    border-radius: 6px;
                    cursor: pointer;
                    background-color: var(--color--primary);
                    display: flex;
                    justify-content: center;
                    align-items: center;
                }
            }
        }
        .location{
            width: 260px;max-width: 100%;
            margin-right: auto;
            display: block;

            h2{
                display: block;
                margin-bottom: 10px;
                color: black;
                font-size: 22px;
            }
            p{
                margin-bottom: 20px;
                display: block;
                font-size: 16px;
                color: #333;
            }

            iframe{
                width: 100%;height: 260px;
                display: block;
                border: none;
                border-radius: 10px;
                box-shadow: #333 0px 0px 2px;
            }
        }

        hr{
            width: 100%;height: 0.5px;
            margin-top: 20px;
            margin-bottom: 10px;
            border: none;
            outline: none;
            background-color: #333;
        }
    }
}

.wrapper{
    nav{
        width: 100%;

        ul{
            span{
                display: none;
            }
        }
    }

    header{
        .top{
            .logo{
                height: 40px;
            }
            ul span{
                display: none;
            }
        }
        .bottom{
            .social{
                span{
                    display: none;
                }
            }
        }
    }

    section.bottom{
        .main{
            width: 100%;
        }
        .aside{
            width: 100%;
        }
    }
}


/* Tablet - 768px en adelante */
@media screen and (min-width: 768px) {

    .wrapper{
        nav{
            width: 100%;

            ul{
                span{
                    display: block;
                }
            }
        }

        header{
            .top{
                .logo{
                    height: 40px;
                }
                ul span{
                    display: block;
                }
            }
            .bottom{
                .social{
                    span{
                        display: block;
                    }
                }
            }
        }
    }

    .wrapper{
        nav{
            width: calc(100% - 12px);
        }
        section.bottom{
            .main, .aside{
                position: sticky;top:60px;
            }
            .main{
                width: calc(100% - 300px);
            }
            .aside{
                width: 300px;
            }
        }
    }
}

/* Desktop - 1024px en adelante */
@media screen and (min-width: 1124px) {
    .wrapper section.bottom{
        .main{
            width: calc(100% - 300px);
        }
        .aside{
            width: 300px;
        }
    }
    .wrapper section.bottom {
        .main, .aside{
            position: sticky;top:60px;
        }
        .aside{
            width: 200px;
            img{
                width: 100%;
            }
        }
    }
}
