html{
    scroll-behavior: smooth;
}

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body{
    height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

.gallery_background{
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -100;
    overflow: hidden;
}

.gallery_background img{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    opacity: 0;
    animation: animationFade 45s infinite;
}

.gallery_background img:nth-child(1){animation-delay: 0s;}
.gallery_background img:nth-child(2){animation-delay: 10s;}
.gallery_background img:nth-child(3){animation-delay: 20s;}
.gallery_background img:nth-child(4){animation-delay: 35s;}

@keyframes animationFade {
    0% {opacity: 0;}
    10% {opacity: 1;}
    25% {opacity: 1;}
    35% {opacity: 1;}
    100% {opacity: 0;}
}

#up_bar1{
    position: fixed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    height: 50px;
    width: 97%;
    z-index: 10;
}

#up_bar2{
    width: 100vw;   
    display: flex;
    justify-content: space-between;
    z-index: 11px;
}

.vertical_separator{
    width: 1px;
    height: 30px;
    background-color: rgb(255, 255, 255);
    align-self: center;
    margin-right: 10px;
    margin-left: 10px;
}

#company_logo{
    color: white;
    display: flex;
    align-items: center;
    height: 20px;
    width: 130px;
    margin-left: 2%
}


#home_button{
    border: 0;
    display:flex;
    justify-content: center;
    align-items: center;
    margin-left: 6px;
    height: 25px;
    width: 30px
}

#home_button {
    background-color: transparent; 
    border: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    
    width: 35px;  
    height: 35px; 
    
    padding: 0;    
    cursor: pointer;
}

#home_icon {
    width: 100% !important; 
    height: 100% !important; 
    fill: none;
    stroke: white;
    transition: stroke 0.1s ease;
}

#home_button:hover #home_icon {
    stroke: rgb(49, 200, 255) !important;
    fill: rgb(49, 200, 255) !important;
}

#right_menu{
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap:-10px;
    width: 300px;
    height: 20px;
}

#chat_button{
    border: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 33px;
    height: 33px;
    background-color: transparent;
    margin-left: 5px;
}

#chat_icon{
    width: 100% !important;
    height: 100% !important;
    fill: none;
    stroke: rgb(255, 255, 255);
    transition: stroke 0.1s ease, fill 0.1s ease;
}

#chat_icon:hover {
    stroke: rgb(49, 200, 255) !important;
    fill: rgb(49, 200, 255) !important;
}


#user{  
    position: relative;  
    background: transparent;
    border: none;
    cursor: pointer;

    width: 80px;
    height: 30px;
}


#user_name{
    font-size: larger;
    margin-top: 4px;
    transform: scale(1);
    color: white;
}

#user_menu{
    display: none;
    position: absolute;
    top: 100%;
    right: -10px;
    z-index: 50;

    /* El padding superior hace de "puente" para que el hover no se pierda al bajar el ratón */
    padding-top: 10px;
    width: max-content;
    min-width: 130px;
    height: auto;
    flex-direction: column;
    align-items: stretch;
}

.user_menu_button{
    position: static;
    margin: 0;
    padding: 10px 18px;

    background: rgb(228, 228, 228);
    color: rgb(12, 36, 61);
    font-family: sans-serif;
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.user_menu_button:hover{
    background: rgb(49, 200, 255);
    color: white;
}

#user:hover #user_menu,
#user:focus-within #user_menu,
#user.open #user_menu{
    display: flex;
}

#ig{
    display:flex;
    justify-content: center;
    align-items: center;
    border: none;
    background: transparent;
    height: 35px;
    width: 35px;
}

#ig_icon path{
    fill: white;

    transition: stroke 0.2s ease, fill 0.2s ease;
}

#ig:hover #ig_icon path{
    fill: rgb(49, 200, 255);
}

#center_content{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#company_name{
    color: white;
    font-size: 3em;
    margin-bottom: 20px;
}

#company_description{
    color: white;
    margin-bottom: 30px;
}

#company_description span{
    font-size: 1em;
    font-weight: bold;
}

#explore_button{
    display: flex;
    justify-content: center;
    align-items: center;

    background-color: transparent;
    border-style:solid;
    border-color: white;
    border-radius: 30px;
    color: white;

    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

#explore_button:hover{
    background-color: rgb(49, 200, 255);
    border-color: rgb(49, 200, 255);
}

#explore_arrow{
    position:absolute;
    color: transparent;
    z-index: -1;

    transition: color 0.3s ease, transform 0.4s ease;
}

#explore_button:hover #explore_arrow{
    color: rgb(49, 200, 255);
    transform: translateY(200%);
}

.product_container{
    display:flex;
    justify-content: center;
    position: absolute;
    min-height: 100vh;
    width: 100vw;
    margin-top: 100vh;
    background-color: rgb(37, 42, 47)
    
}

#product_grid{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 80%;
    margin-top: 40px;
    margin-bottom: 40px;
}

.card {
    position: relative; 
    height: 290px;
    width: 220px;
    background-color: white;
    border-radius: 12px;
    overflow: hidden; 
    transition: transform 0.3s ease;
}

.card:hover {
    transform: scale(1.08);
}

.card-img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.card-text-fade {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%;
    height: 45%; 
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 1;
}

.card-info {
    font-family: sans-serif;
    font-size:75%;
    position: absolute;
    top: 12px; 
    left: 12px;
    color: white;   
    z-index: 2; 
}

.card-button{
    position:absolute;
    bottom: 0;
    right: 0;

    display: flex;
    justify-content: right;
    align-items: center;
    margin-bottom: 10px;
    margin-right: 10px;
    height: 25px;
    width: 25px;

    background: transparent;
    border-color: rgb(255, 255, 255);
    border-style:solid;
    border-radius: 15px;

    transition: background-color 0.2s ease, border-color 0.2s ease, width 0.2s ease;
}

.card-button-text{
    font-family: sans-serif;
    font-size:smaller;
    position: absolute;
    top: 1;
    right: 1;
    width: 76px;
    color: transparent;

    transition: color 0.1s ease;
}

.card-button-x{
    display: inline-block;
    margin-right: 3px;
    width: 15px;
    height: 15px;
    transform: rotate(45deg);
    stroke: white;

    transition: width 0.2s ease, height 0.2s ease;
}

.img-arrows {
    position: absolute;
    display: flex;
    justify-content: space-between;
    align-items: center;

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 90%; 
    height: 50px;
    
    opacity: 0;
    pointer-events: none; 
    transition: opacity 0.2s ease; 
}

.card:hover .img-arrows {
    opacity: 1; 
    pointer-events: auto; 
}

.img-arrow-circle {
    display: flex;
    justify-content: center;
    align-items: center;

    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;

    width: 25px;
    height: 25px;
    min-width: 25px;  
    min-height: 25px; 
    overflow: hidden; 
    
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease; 
}

.img-arrow-circle:hover {
    transform: scale(1.2); 
    background: rgb(49, 200, 255); 
}

.img-arrow-circle svg {
    width: 16px; 
    height: 16px;
    display: block;
}

#img-arrow-R {
    fill: white;
    transform: rotate(-90deg);
}

#img-arrow-L {
    fill: white;
    transform: rotate(90deg);
}


.card-button:hover{
    background-color: rgb(49, 200, 255);
    border-color: rgb(49, 200, 255);
    width: 80px;
}

.card-button:hover .card-button-text{
    color: white;
}

.card-button:hover .card-button-x{
    width: 0px;
    height: 0px;
}

/*----------Chat Page----------*/
#chat_page{
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    background: rgb(245, 244, 242);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Franja oscura detrás de la barra superior (sus iconos son blancos) */
#chat_page::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: #0C243D;
}

#chat_layout{
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    height: 100vh;
    padding-top: 90px;
}

/* ---- Conversación ---- */
#conversation{
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

#conversation_header{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid #E1E5E9;
}

.chat_avatar{
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #D8E0E6;
}

#conversation_title{
    font-size: 1.05rem;
    color: #0C243D;
}

#conversation_subtitle{
    font-size: 0.85rem;
    color: #6B7A87;
}

#message_list{
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 20px 28px;
    overflow-y: auto;
    list-style: none;
    scrollbar-width: thin;
}

.message{
    display: flex;
    flex-direction: column;
    max-width: 70%;
    margin-top: 14px;
}

.message.new{
    animation: bubbleIn 0.18s ease-out;
}

@keyframes bubbleIn{
    from{ opacity: 0; transform: translateY(6px); }
    to{ opacity: 1; transform: translateY(0); }
}

.message.mine{
    align-self: flex-end;
    align-items: flex-end;
}

.message.theirs{
    align-self: flex-start;
    align-items: flex-start;
}

/* Mensajes seguidos de la misma persona: más pegados, y solo la hora del último */
.message.mine + .message.mine,
.message.theirs + .message.theirs{
    margin-top: 3px;
}

.message.mine:has(+ .message.mine) .message_time,
.message.theirs:has(+ .message.theirs) .message_time{
    display: none;
}

.bubble{
    padding: 9px 14px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.mine .bubble{
    color: white;
    background: #0B76C2;
    border-bottom-right-radius: 5px;
}

.theirs .bubble{
    color: #1B2A38;
    background: #E3E6EA;
    border-bottom-left-radius: 5px;
}

.message_time{
    margin-top: 3px;
    padding: 0 4px;
    font-size: 0.7rem;
    color: #7A8894;
}

.chat_hint{
    margin: auto;
    max-width: 280px;
    text-align: center;
    font-size: 0.9rem;
    color: #6B7A87;
}

/* Indicador "escribiendo..." */
.typing .bubble{
    display: flex;
    gap: 4px;
    padding: 14px 16px;
}

.typing .bubble span{
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8896A2;
    animation: typingDot 1.2s infinite;
}

.typing .bubble span:nth-child(2){ animation-delay: 0.15s; }
.typing .bubble span:nth-child(3){ animation-delay: 0.3s; }

@keyframes typingDot{
    0%, 60%, 100%{ opacity: 0.35; transform: translateY(0); }
    30%{ opacity: 1; transform: translateY(-3px); }
}

/* ---- Barra de escribir ---- */
#chat-bar{
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 14px 20px 20px 20px;
    padding: 5px 6px;

    background: rgb(244, 253, 255);
    border: 1px solid #C5D3DB;
    border-radius: 30px;

    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#chat-bar:focus-within{
    border-color: rgb(49, 200, 255);
    box-shadow: 0 0 0 3px rgba(49, 200, 255, 0.25);
}

#chat-bar-text{
    flex: 1;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    max-height: 150px;
    padding: 7px 6px;

    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;

    font-family: inherit;
    font-size: 16px;
    line-height: 22px;
    color: #0C243D;
}

#send_button{
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;

    color: white;
    background: #0B76C2;
    border: none;
    border-radius: 50%;
    cursor: pointer;

    transition: background-color 0.2s ease, transform 0.1s ease;
}

#send_button svg{
    width: 18px;
    height: 18px;
}

#send_button:hover:not(:disabled){
    transform: scale(1.08);
}

#send_button:disabled{
    background: #C5D3DB;
    cursor: default;
}

#add-file-menu{
    position: absolute;
    bottom: 100%;
    left: 26px;
    margin-bottom: 15px;
    height: 150px;
    width: 35px;
    background: white;
    border-radius: 30px;

    transform: translateX(-50%) scale(0.9);
    transform-origin: bottom center; 
    opacity: 0;
    pointer-events: none;

    transition: opacity 0.1s ease;
}

#add-file-button{
    flex-shrink: 0;
    height: 25px;
    width: 25px;
    margin: 0 0 5px 8px;

    background: transparent;
    border-style: solid;
    border-radius: 20px;
    border-width: 1.5px;
    cursor: pointer;

    display: flex;
    justify-content: center;
    align-items: center;

    transition: transform 0.1s ease;
}

#add-file-button:hover{
    transform: scale(1.1);
}

#add-file-button:focus{
    transform: scale(1.1);
}

#add-file-button:focus #add-file-x{
    transform: rotate(180deg);
}

#add-file-button:focus #add-file-menu{
    opacity: 1;
    pointer-events: auto;
}

#add-file-x{    
    stroke-width: 5px;
    height: 70%;
    width: 70%;

    transform: rotate(45deg);

    transition: transform 0.4s ease;
}

/* ---- Columna de chats (derecha) ---- */
#chat_list_panel{
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: white;
    border-left: 1px solid #E1E5E9;
}

#chat_list_header{
    padding: 18px 20px 14px 20px;
    border-bottom: 1px solid #E1E5E9;
}

#chat_list_header h2{
    font-size: 1.15rem;
    color: #0C243D;
}

#chat_list{
    flex: 1;
    overflow-y: auto;
    list-style: none;
    scrollbar-width: thin;
}

.chat_item{
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;

    text-align: left;
    font-family: inherit;
    color: inherit;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;

    transition: background-color 0.15s ease;
}

.chat_item:hover{
    background: #F3F7FA;
}

.chat_item[aria-current="true"]{
    background: #EAF6FD;
    border-left-color: rgb(49, 200, 255);
}

.chat_item .chat_avatar{
    width: 48px;
    height: 48px;
}

.chat_item_text{
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.chat_item_title,
.chat_preview{
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.chat_item_title{
    font-size: 0.95rem;
    color: #0C243D;
}

.chat_preview{
    font-size: 0.85rem;
    color: #6B7A87;
}

.chat_item_meta{
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.chat_time{
    font-size: 0.72rem;
    color: #7A8894;
}

.chat_badge{
    min-width: 20px;
    padding: 2px 6px;
    font-size: 0.72rem;
    font-weight: bold;
    text-align: center;
    color: white;
    background: #0B76C2;
    border-radius: 10px;
}

/* ---- Pantallas estrechas: la columna de chats se queda solo con las fotos ---- */
@media (max-width: 760px){
    #chat_layout{
        grid-template-columns: minmax(0, 1fr) 72px;
    }

    .message{
        max-width: 85%;
    }

    #message_list{
        padding: 16px;
    }

    #chat-bar{
        margin: 10px;
    }

    #chat_list_header{
        display: none;
    }

    .chat_item{
        grid-template-columns: 48px;
        justify-content: center;
        padding: 12px 0;
    }

    .chat_item_text,
    .chat_time{
        display: none;
    }

    .chat_item_meta{
        position: absolute;
        top: 6px;
        right: 4px;
    }
}

@media (prefers-reduced-motion: reduce){
    .message.new,
    .typing .bubble span{
        animation: none;
    }
}

/*----------Media de las tarjetas (imagen o modelo 3D)----------*/
.card-media{
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, #f6efe6 0%, #d9cab7 100%);
}

.card-media .card-img{
    display: block;
}

.card-media canvas{
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.model-loading{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
    font-size: 0.8rem;
    color: #6b5a47;
    pointer-events: none;
}

.badge-3d{
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 2px 8px;
    font-family: sans-serif;
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    color: white;
    background: rgba(49, 200, 255, 0.85);
    border-radius: 10px;
    display: none;
    pointer-events: none;
}

.card.is-3d .badge-3d{
    display: block;
}

.arrow-prev svg{ transform: rotate(90deg); }
.arrow-next svg{ transform: rotate(-90deg); }

#user_menu .user_menu_button[hidden]{
    display: none;
}
