:root {
    --purple-light: #ede9fe;
    --purple-main: #6f42c1;
    --purple-dark: #6d28d9;
    --purple-gradient: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
    --text-light: #fff;
    --text-dark: #333;
    --bg-body: #f5f3fa;

    --avatar-size: 40px;
    --status-size: 10px;
    --status-color: #28a745;
    --status-border: 1px;
}

html, body {
  /* height: calc(var(--vh,1vh) * 100); */
  /* height: 100vh; */
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background-color: purple;
}

.no-shadow { box-shadow: none !important; }
.btn.btn-xs { padding: .20rem .4rem; font-size: .725rem; border-radius: .1rem; }

.chat {
    display: flex;
    margin-bottom: 1rem;
}
.chat .bubble {
    padding: .5rem;
    max-width: 90%;
    border-radius: .25rem;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075)
}
.question { justify-content: flex-end; }
.question .bubble { background-color: #cfe2ff; }
.answer .bubble { background-color: #fff; }
.chat .attachment {
    padding: .5rem;
    border-radius: .25rem;
}
.chat .attachment figure.file {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 0;
}
.chat .attachment figure.file img {
    width: 50px;
    height: 50px;
}
.chat .minimap figcaption * { margin: 0; }
/* .question .attachment, .question pre { background-color: #c1d7f7; } */
/* .answer .attachment, .answer pre { background-color: white; } */
.chat .message,
.chat .message * {
    /* white-space: pre-wrap; */      /* Mantiene saltos de línea y permite ajustar texto */
    overflow-wrap: break-word;  /* Rompe palabras largas si exceden el ancho */
    word-break: break-word;     /* Compatibilidad adicional con navegadores antiguos */
    max-width: 100%;            /* Evita que el texto crezca más allá de la burbuja */
    box-sizing: border-box;     /* Asegura que los márgenes y bordes no inflen el ancho real */
}
.chat .message pre {
    /* white-space: pre-wrap; */
    padding: .25rem;
    border-radius: .25rem;
}
.chat .message img,
.chat .message table {
    max-width: 100%;
    height: auto;
}
.chat .message :last-child { margin-bottom: 0; }
.chat:has(.greating-qa)
{
    justify-content: center;

    & .bubble {
        padding: 0;
    }
}
.btn-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    height: 36px;
    width: 36px;
    padding: .25rem;
    border-radius: 50%;
}

.dialog {
    border: 1px solid #dee2e6;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
    margin: 1.75rem auto;
    width: 100%;
}
.dialog-centered {
    margin: revert;
}

#view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
#chat-navbar {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
#chat-navbar img { max-height: 40px; }
#chat-navbar .avatar {
    --s: var(--avatar-size);
    display: inline-grid;
    place-items: center;
    width: var(--s);
    height: var(--s);
    overflow: hidden;
    position: relative;
    /* background-color: #f8f9fa; */   /* fallback cuando no hay imagen */
    /* box-shadow: 0 1px 3px rgba(0,0,0,0.12); */
}
#chat-navbar .avatar img {
    border-radius: 50%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
}
#chat-navbar .avatar_status {
    --st: var(--status-size);
    position: absolute;
    right: calc((var(--s) - var(--st)) * 0.06); /* pequeño ajuste para que quede pegado pero centrado visualmente */
    bottom: calc((var(--s) - var(--st)) * 0.06);
    width: var(--st);
    height: var(--st);
    border-radius: 50%;
    background: var(--status-color);
    box-shadow: 0 0 0 var(--status-border) #fff; /* borde blanco alrededor del punto */
    border: solid 1px rgba(0,0,0,0.06);
    transform-origin: center;
    pointer-events: none;
}
#chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: env(safe-area-inset-bottom);
    transition: height 0.2s ease;
    background-color: darkgray;
}
#chat-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

#txt-message {
    resize: none;
    height: 36px;
    min-height: 31px;
    max-height: 220px;
    box-shadow: none;
}

#preview-gallery {
    width: 100%;
    overflow-x: auto; /* Habilita el scroll horizontal */
    white-space: nowrap; /* Evita el salto de línea dentro del contenedor */
    display: flex;
}
#preview-gallery:has(div) { margin-bottom: .5rem; }
#preview-gallery div { margin-left: 10px; }
#preview-gallery div:last-child { margin-right: 10px; }
#preview-gallery figure {
    display: inline-block; /* Permite que los elementos se alineen horizontalmente */
    width: 150px;
    height: 150px;
    padding: 6px;
    margin: 0;
    background-color: #E1E6ED;
    position: relative;
    text-align: center;
}
#preview-gallery .item-action-bar {
    display: flex;
    align-items: center;
    justify-content: end;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    background-color: #585A5C;
}
#preview-gallery button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D6D9DC;
    outline: none;
    box-shadow: none;
}
#preview-gallery button:hover { color: #FFF; }
#preview-gallery img {
    max-height: 110px;
    width: auto;
}
#preview-gallery figcaption {
    position: absolute;
    width: 100%;
    bottom: 0;
    left: 0;
    text-align: left;
    padding: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



@media (min-width:576px) {
    .dialog {
        max-width: 500px;
    }

    .dialog-sm {
        max-width: 300px
    }
}

@media (min-width:992px) {

    .dialog-lg,
    .dialog-xl {
        max-width: 800px
    }
}

@media (min-width:1200px) {
    .dialog-xl {
        max-width: 1140px
    }
}