.chat-container {
  border-radius: 8px;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-family: sans-serif;
}

.msg {
  clear: both;
    float: left;
    padding: 6px 10px 7px;
    border-radius: 10px 10px 10px 0;
    background: #001536;
    margin: 8px 0;
    line-height: 1.4;
    margin-left: 35px;
    position: relative;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);


  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.msg::before {
    content: "";
    position: absolute;
    bottom: -5px;
    border-top: 6px solid #001536;
    left: 0;
    border-right: 7px solid transparent;
}

.msg.loading::before {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  content: "";
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  z-index: 2;
  margin-top: 4px;
  -webkit-animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
          animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
  border: none;
  -webkit-animation-delay: 0.15s;
          animation-delay: 0.15s;
}
.msg.loading span {
  display: block;
  font-size: 0;
  width: 20px;
  height: 10px;
  position: relative;
}
.msg.loading span::before {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  content: "";
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  z-index: 2;
  margin-top: 4px;
  -webkit-animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
          animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
  margin-left: -7px;
}
.msg.loading span::after {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  content: "";
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  z-index: 2;
  margin-top: 4px;
  -webkit-animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
          animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
  margin-left: 7px;
  -webkit-animation-delay: 0.3s;
          animation-delay: 0.3s;
}

.msg.user {

  float: right;
    color: #fff;
    text-align: right;
    background: linear-gradient(120deg, #0c2b6c, #0d6c86);
    border-radius: 10px 10px 0 10px;
  
}

.msg.user::before {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 5px solid transparent;
    border-top: 4px solid #0d6c86;
    bottom: -4px;
}

.msg.bot {
  align-self: flex-start;
}

.msg .avatar{
    position: absolute;
    z-index: 1;
    bottom: -15px;
    left: -35px;
    border-radius: 30px;
    width: 30px;
    height: 30px;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.24);
}
.msg .avatar img{
    width: 100%;
    height: auto;
}


.chat-input {
  display: flex;
    align-items: center;
    border-top: 1px solid #eee;
    padding: 8px;
    background: #fff;
}
#chat-input{
  flex: 1;
    border: none;
    outline: none;
    padding: 10px 12px;
    border-radius: 20px;
    background: #f1f1f1;
    font-size: 14px;
    margin-bottom: 0px;
} 
.chat-input input {
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
}

.chat-input button {
  padding: 10px;
  border: none;
  background: #0149ff;
  color: #fff;
  cursor: pointer;
}

.chat-header {
    background: #0149ff;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.chat-header span{
  font-family: AktivGroteskW01-Bold;
}  
  .chat-header .chat-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #fff;
    cursor: pointer;
  }

  .send-btn {
    background: #0073aa;
    border: none;
    border-radius: 50%;
    margin-left: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
  }
  .send-btn:hover {
    background: #005f8d;
  }

.gpt-chat-bubble-wrapper {
            position: fixed;
            top: 50%;
            right: 0;
            z-index: 9999;
        }

        .gpt-chat-toggle {
            background: #e62b58;
            color: #fff;
            border: none;
            border-radius: 5px 0 0 5px;
            width: 35px;
            height: 145px;
            transform: translateY(-50%); /* corregge l'allineamento verticale */
            display: none;               /* per centrare il contenuto */
            justify-content: center;
            align-items: center;
            font-size: 18px;
            cursor: pointer;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
            transition: background 0.3s;
        }

        .gpt-chat-toggle.visible{
          display:flex;
        }
        .gpt-chat-toggle span{
          display: inline-block;
          transform: rotate(-90deg);
          white-space: nowrap; 
        }

        .gpt-chat-toggle:hover {
            background: #d0254e;
        }

        .gpt-chat-popup {
            position: fixed;
            bottom: 90px;
            right: 20px;
            width: 0;
            height: 0;
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.3);
            overflow: hidden;
            opacity: 0;
            transition: 
                width 0.4s ease,
                height 0.4s ease,
                opacity 0.3s ease;
        }

        .gpt-chat-popup.open {
            width: 350px;   /* larghezza finale */
            height: 450px;  /* altezza finale */
            opacity: 1;
        }

        /* contenuto interno prende tutto lo spazio */
        #gpt-chat-root {
            width: 100%;
            height: 100%;
        }


@keyframes ball {
  from {
    transform: translateY(0) scaleY(0.8);
  }
  to {
    transform: translateY(-10px);
  }
}