html, body { height: 100dvh; }

@supports (height: 100dvh) {
  html, body { height: 100dvh; }
  .info-bar { height: 25dvh; }
  .chat-footer { bottom: calc(12dvh + 15px); }
}

/* 1. Fondo */
body {
    margin: 0;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

canvas {
    display: block;
    z-index: 1;
}

/* 2. Botones de animaciones (UI superior) */
#ui {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

#ui button {
    background: #fd6b21;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

#ui button:hover {
    background: #45a049;
}


/* 3. Sidebar vertical de iconos */
.sidebar {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.sidebarr {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.icon-btn {
    background: #fd6b21;
    border: none;
    border-radius: 8px;
    width: 48px;
    height: 48px;
    font-size: 24px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn.grande {
    display: flex;
    flex-direction: column;
    width: auto;
    height: auto;
    padding: 10px;
    gap: 0px;
    justify-content: flex-start;
}

.icon-btn i {
    font-size: 1.25rem;
    /* tamaÃ±o del icono */
    line-height: 1;
    /* centrado vertical */
}

.icon-btn.grande i {
    font-size: 2rem;
    width: 50px;
}

.icon-btn.grande p {
    font-size: 15px;
}

.icon-btn:hover {
    background: #c7a36aeb;
}

/* Cuando el micrÃ³fono estÃ¡ activo */
.icon-btn.active {
    background: #45a049;
    /* verde, por ejemplo */
}

/* 4. Chat footer */
.chat-footer {
    position: absolute;
    bottom: calc(25dvh + 15px);
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 800px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    padding: 8px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    z-index: 10;
}

#chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px;
    font-size: 16px;
    outline: none;
}

#send-btn {
    background: #fd6b21;
    color: white;
    border: none;
    border-radius: 999px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
}

#send-btn:hover {
    background: #c7a36aeb;
}


/* Loading overlay */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    /* o rgba(0,0,0,0.8) para semitransparente */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Spinner circular */
.spinner {
    width: 64px;
    height: 64px;
    border: 8px solid #ccc;
    border-top-color: #fd6b21;
    /* color destacado */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* El video de la cÃ¡mara se mostrarÃ¡ en la esquina inferior derecha */
#cameraPreview {
    position: absolute;
    top: 0px;
    right: 0;
    width: 160px;
    height: 120px;
    z-index: 1000;
    transform: scaleX(-1);
}


.info-bar {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: #fff;
    /* blanco sÃ³lido */
    color: #000;
    /* texto negro */
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 16px;
    box-sizing: border-box;
    font-size: 20px;
    height: 25dvh;
    animation: infoIn 1s linear forwards;
}

.info-bar.hidden {
    animation: infoOut 1s linear forwards;
    pointer-events: none;
}

.info-bar .info-content {
    max-width: 1200px;
    width: 100%;
    text-align: center;
}

.info-content {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 16px;
    /* espacio entre imagen y texto */
}


/* Ventana de info flotante mejorada */
.floating-info {
  position: fixed;
  top: 20px;
  padding: 10px;
  left: 20px;             
  color: #fff;            /* MÃ¡s espacio arriba para el tÃ­tulo */
  border: 1px solid rgba(249, 99, 2, 0.7); /* Borde naranja intenso */
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(249, 99, 2, 0.3); /* Sombra naranja suave */

  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.6s ease, transform 0.6s ease; /* AnimaciÃ³n mÃ¡s lenta */
  z-index: 10000;
}

.floating-info.show {
  opacity: 1;
  transform: scale(1);
}

.floating-info.hide {
  opacity: 0;
  transform: scale(0.8);
}

/* TÃ­tulo */
.toast-container .floating-info .info-title {
  background: linear-gradient(135deg, #c7a36aeb, #c7a266eb);
  color: #ffffff;

  font-family: 'Inter', Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 0;
  padding: 12px 45px 12px 16px;
  border-radius: 13px 13px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}


/* BotÃ³n de cerrar */
.toast-container .floating-info .close-btn {
  color: #ffffff;
  background: transparent;
  border: none;

  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.toast-container .floating-info .close-btn:hover {
  color: #fed7aa;
}

/* Contenedor de contenido: apilar en vertical y alinear a la izquierda */
.toast-container .floating-info .info-content {
  display: block;
  width: 100%;
  min-height: 0;
  max-height: calc(100dvh - 160px);
  overflow-y: auto;
  overscroll-behavior: contain;

  color: #e2e8f0;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.75;
  text-align: left;

  margin-top: 10px;
  padding-right: 8px;

  scrollbar-width: thin;
  scrollbar-color: #64748b transparent;
}

.toast-container .floating-info .info-content::-webkit-scrollbar {
  width: 6px;
}

.toast-container .floating-info .info-content::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 10px;
}


/* Si usas listas, garantizamos que las viÃ±etas queden dentro y verticales */
.floating-info .info-content ul {
  list-style-position: inside;
  padding-left: 1em;
  margin: 0;
}

/* Espacio extra entre pÃ¡rrafos o bloques */
.floating-info .info-content p,
.floating-info .info-content ul,
.floating-info .info-content li {
  margin: 0 0 0.5em 0;
}

.toast-container {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;

  z-index: 10000;

  max-height: calc(100dvh - 40px);
  box-sizing: border-box;
}


/* 2) Anulamos el fixed de .floating-info solo dentro de .toast-container */
.toast-container .floating-info {
  position: relative !important;
  top: auto !important;
  left: auto !important;

  width: 100%;
  
  max-height: calc(100dvh - 60px);
  box-sizing: border-box;

  margin: 0;
  transform-origin: top left;

  /* Fondo oscuro como el loading */
  background: rgba(18, 20, 28, 0.96);
  color: #f1f5f9;

  /* Borde sutil */
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;

  /* Drop shadow profundo */
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.45),
    0 25px 60px rgba(0, 0, 0, 0.30),
    0 0 0 1px rgba(255, 255, 255, 0.03);

  /* Desenfoque detrás */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);


  /* Contenido desplazable */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/*InfoOut */

@keyframes infoOut {
    0% {
        opacity: 1;
        left: 0%;
    }

    80% {
        opacity: 0;
        left: -50%;
    }

    to {
        opacity: 0;
        left: -50%;
    }
}

@keyframes infoIn {
    0% {
        opacity: 0;
        left: 50%;
    }

    80% {
        opacity: 1;
        left: 0%;
    }

    to {
        opacity: 1;
        left: 0%;
    }
}

.dialog-help {
    background-color: #ffffff;
}

.mapadialog {
    background-color: #00000000;
    /*background-color: #0000004a;*/
    backdrop-filter: blur(5px);
    z-index: 20;
    position: fixed;
    width: 100vw;
    height: 100vh;
    display: flex;
    
    animation: modalIn .5s linear forwards;
}

.helpdialog {
    background-color: #00000000;
    /*background-color: #0000004a;*/
    backdrop-filter: blur(5px);
    z-index: 20;
    position: fixed;
    width: 100vw;
    height: 100vh;
    display: flex;
    
    animation: modalIn .5s linear forwards;
}

.mapadialog.hidden {
    animation: modalOut .5s linear forwards;
}

.helpdialog.hidden {
    animation: modalOut .5s linear forwards;
}

.mapadialog div {
    max-width: 700px;
    max-height: 700px;
    overflow: hidden;
    margin: auto;
}

.mapadialog img {
    width: 100%;
    height: 100%;
}

.helpdialog div.main {
    max-width: 700px;
    max-height: 700px;
    overflow: hidden;
    margin: auto;
}

.helpdialog div.main .dialog-help{
    text-align: center;
}

.helpdialog div.main p {
    font-weight: 700;
    padding: 57px;
    font-size: 2.3em;
}

.helpdialog img {
    width: 50%;
    height: 50%;
}


#close-map-btn {
    background: #fd6b21;
    color: white;
    border: none;
    border-radius: 999px;
    padding: 10px;
    font-size: 20px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    z-index: 100;
    margin-bottom: -10px;
    position: relative;
    float: right;
    top: 15px;
    right: 15px;
    filter: drop-shadow(2px 4px 10px rgba(0, 0, 0, .15));
}

#close-help-btn {
    background: #fd6b21;
    color: white;
    border: none;
    border-radius: 999px;
    padding: 10px;
    font-size: 20px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    z-index: 100;
    margin-bottom: -10px;
    position: relative;
    float: right;
    top: 15px;
    right: 15px;
    filter: drop-shadow(2px 4px 10px rgba(0, 0, 0, .15));
}

#close-map-btn:hover {
    background: #c7a36aeb;
}

@keyframes modalIn {
    0% {
        opacity: 0;
        top: 10%;
    }

    to {
        opacity: 1;
        top: 0%;
    }
}

@keyframes modalOut {
    0% {
        opacity: 1;
        top: 0%;
    }

    to {
        opacity: 0;
        top: 100%;
    }
}


 #thinking-loader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;

    background: rgba(5, 5, 12, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  #thinking-loader.active {
    opacity: 1;
    visibility: visible;
  }

  /* Cerebro */
  .brain {
    font-size: 76px;
    line-height: 1;
    animation: brainPulse 1.4s ease-in-out infinite;
    filter: drop-shadow(0 0 15px #a855f7);
  }

  /* Texto */
  .thinking-text {
    color: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 2px;
  }

  /* Puntos animados */
  .dots span {
    display: inline-block;
    color: #c084fc;
    animation: dotBounce 1.2s infinite;
  }

  .dots span:nth-child(2) {
    animation-delay: 0.2s;
  }

  .dots span:nth-child(3) {
    animation-delay: 0.4s;
  }

  @keyframes brainPulse {
    0%, 100% {
      transform: scale(1);
      filter: drop-shadow(0 0 10px #a855f7);
    }
    50% {
      transform: scale(1.12);
      filter: drop-shadow(0 0 28px #d8b4fe);
    }
  }

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

  @media (prefers-reduced-motion: reduce) {
    .brain, .dots span {
      animation: none;
    }
  }

.toast-container .floating-info .info-content h1 {
    text-align: center;
}

.toast-container .floating-info .info-content h2 {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 12px;
}

.toast-container .floating-info .info-content h3 {
  color: #ff9a52;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  margin: 20px 0 8px;
}

/* Párrafos */
.toast-container .floating-info .info-content p {
  color: #e2e8f0;
  margin: 0 0 12px;
}

/* Listas */
.toast-container .floating-info .info-content ul,
.toast-container .floating-info .info-content ol {
  padding-left: 22px;
  margin: 8px 0 16px;
}

.toast-container .floating-info .info-content li {
  color: #e2e8f0;
  margin-bottom: 7px;
}

.toast-container .floating-info .info-content li::marker {
  color: #fd8b48;
}

/* Texto importante */
.toast-container .floating-info .info-content strong,
.toast-container .floating-info .info-content b {
  color: #ffffff;
  font-weight: 700;
}

/* Notas */
.toast-container .floating-info .info-content em {
  color: #cbd5e1;
}

/* Enlaces */
.toast-container .floating-info .info-content a {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 480px) {
  .toast-container {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .toast-container .floating-info {
    max-height: calc(100dvh - 36px);
  }

  .toast-container .floating-info .info-content {
    max-height: calc(100dvh - 130px);
    font-size: 14px;
  }

  .toast-container .floating-info .info-content h2 {
    font-size: 19px;
  }
}