/**
 * @file
 * n8n Chat styles.
 */
 
 body.n8n-chat-open {
  overflow: hidden;
  height: 100vh; 
  position: fixed;
  width: 100%;
}
 
.n8n-overlay{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7); 
  z-index: 9998; 
  display: none;
}

.n8n-chat {
  position: fixed;
  z-index: 9999;
  font-family: "Work Sans", Verdana, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Widget positioning */
.n8n-chat.bottom-right {
  bottom: 20px;
  right: 20px;
}

.n8n-chat.bottom-left {
  bottom: 20px;
  left: 20px;
}

.n8n-chat.top-right {
  top: 20px;
  right: 20px;
}

.n8n-chat.top-left {
  top: 20px;
  left: 20px;
}

/* Chat toggle button */
.chat-toggle {
  background: #fcc134;
  color: black;
  padding: 12px 20px;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-toggle:hover {
  background: #fcc134;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-icon {
  background-image: url(../images/setting.gif);
  width: 42px;
  height: 42px;
  background-size: cover;
  background-repeat: no-repeat;
}

.chat-text {
  font-size: 24px;
  font-weight: bold;
  font-family: "Work Sans",Verdana,Arial,sans-serif;
}
@media screen and (max-width: 1200px) {
    .chat-icon{
        width: 32px;
        height: 32px;
    }
    .chat-text{
        font-size: 18px;
    }
}

@media screen and (max-width: 600px) {
    .chat-icon{
        width: 24px;
        height: 24px;
    }
}

/* Chat window */
.chat-window {
  position: fixed;
  z-index: 1000;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 98vw;
  height: 96vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  flex-direction: column;
  overflow: hidden;
}

@media screen and (max-width: 768px) {
    .chat-window{
        width: 100vw;
        height: calc(var(--vh, 1vh) * 100);
        border-radius: 0px;
    }
}

.chat-window-container{
    flex: 1;            
    width: 100%;        
    display: flex;
    flex-direction: column;
    max-width: 890px;
    overflow: hidden;
    padding: 0 20px;
}

@media screen and (max-width: 600px) {
    .chat-window-container{
        padding: 0 10px;
    }
}


/* Chat header */
.chat-header {
  /*background: #fcc134;*/
  color: black;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.chat-header-infos{
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-logo {
    width: 150px;
    height: 40px;             
    background-image: url(/modules/custom/n8n_chat/images/8p-logo-chat-bot.png);
    background-size: contain;  /* This ensures the logo fits inside the box */
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;     /* Ensures it sits next to your title */
    vertical-align: middle;    /* Aligns it vertically with the text */
}
@media screen and (max-width: 600px) {
    .chat-logo{
        width: 130px;
    }
}

.chat-title {
font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.4px;
    position: relative;
    padding-left: 14px;
    padding-top: 2px;
}

.chat-title:before {
  content: "|";
    font-weight: 600;
    font-size: 22px;
    /* padding-right: 6px; */
    position: absolute;
    left: 0;
    margin-top: -2px;
}

@media screen and (max-width: 992px) {
    .chat-title, .chat-title:before{
        font-size: 18px;
    }
    .chat-title{
        padding-top: 3px;
    }
}


.chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}


.chat-new-conversation,.chat-new-conversation:hover , .chat-close{
   display: flex;
   align-items: center;
   gap: 8px;
   font-size: 14px;
   font-weight: 400;
   background-color: white;
   color: black;
   padding: 10px 20px;
   border-radius: 100px;
}

.chat-new-conversation{
    background-color: white;
    border: 1px solid #e1e5e9; 
}


.chat-new-conversation::before {
  content: "";
  background-image: url(../images/trash-icon.svg);
  background-repeat: no-repeat;
  background-size: contain;
  width: 16px;
  height: 16px;
}

.chat-close{
    padding: 10px 10px !important;
    background-color: #fcc134;
    border: 1px solid #fcc134;
}

.chat-close::before {
  content: "";
  background-image: url(../images/cross.svg);
  background-repeat: no-repeat;
  background-size: contain;
  width: 16px;
  height: 16px;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}


/* Responsive for chat header */
@media screen and (max-width: 768px) {
    .chat-header{
         padding: 16px 10px;
    }
    .chat-title{
        display: none;
    }
    
    .chat-new-conversation, .chat-new-conversation:hover{
        padding: 10px 12px;
    }
    .chat-new-conversation::before{
        content: none;
    }
}


/* Chat messages */
.chat-messages {
    flex: 1;
    padding-right: 40px;
    padding-left: 40px;
    overflow-y: auto;
    /* Scrollbar styling for Firefox */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

@media screen and (max-width: 768px) {
    .chat-messages{
        padding-right: 15px;
        padding-left: 15px;
    }
}

.chat-message {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.chat-message.user {
  align-items: flex-end;
}

.chat-message.bot {
  align-items: flex-start;
}

.message-content {
  max-width: 80%;
  padding: 12px 18px;
  border-radius: 18px;
  line-height: 1.3em;
  font-size: 15px;
  word-wrap: break-word;
}

.chat-message.user .message-content {
  background: #fcc134;
  color: black;
  border-bottom-right-radius: 4px;
}

.chat-message.bot .message-content {
  background: white;
  color: #333;
  border: 1px solid #e1e5e9;
  border-bottom-left-radius: 4px;
  max-width: 80%;
  line-height: 1.4em;
}

.chat-message.bot .message-content a {
    text-decoration: underline;
}

.chat-message.system {
  align-items: center;
}

.chat-message.system .message-content {
  background: #f0f8ff;
  color: #0066cc;
  border: 1px solid #b3d9ff;
  border-radius: 12px;
  font-size: 13px;
  font-style: italic;
  max-width: 90%;
}

.message-time {
  font-size: 11px;
  color: #ababab;
  margin-top: 4px;
  padding: 0 4px;
}

.welcome-message {
  text-align: left;
  color: #666;
  font-style: italic;
  margin-bottom: 20px;
}

.welcome-message a {
    text-decoration: underline;
    font-weight: 500;
}


/* Typing indicator */
.typing-indicator .message-content {
  padding: 16px;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

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

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat input */
.chat-input-container {
  position: relative;
  padding-bottom: 34px;
  background: white;
  /*border-top: 1px solid #e1e5e9;*/
  display: flex;
  gap: 12px;
}

@media screen and (max-width: 768px) {
    .chat-input-container{
        padding-bottom: 14px;
    }
}

#chat-input {
  flex: 1;
  padding: 20px 120px 20px 20px;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  outline: none;
  font-size: 16px;
  height: 100px;
}

@media screen and (max-width: 768px) {
    #chat-input{
        padding: 20px 75px 20px 20px;
    }
}

#chat-input:focus {
  border-color: #fcc134;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

#chat-send {
  background: #fcc134;
  color: black;
  border: none;
  padding: 12px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease;
  position: absolute;
  right: 10px;
  bottom: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media screen and (max-width: 768px) {
    #chat-send {
        font-size: 0; /* Cache le texte "Envoyer" */
        padding: 0;   /* On réinitialise le padding pour faire un cercle/carré parfait */
        width: 45px;  /* Largeur fixe pour l'icône */
        height: 45px; /* Hauteur fixe pour l'icône */
        border-radius: 50%; /* Rend le bouton rond */
        bottom: 24px;
    }
    
    #chat-send:after{
        content: "";
        background-image: url(../images/send.svg);
        background-size: cover;
        background-repeat: no-repeat;
        width: 17px;
        height: 16px;
    }
}

#chat-send:hover {
  background: #fcc134;
}

#chat-send:active {
  transform: translateY(1px);
}

#chat-send:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Dark theme */
.n8n-chat.dark .chat-window {
  background: #2d3748;
  color: white;
}

.n8n-chat.dark .chat-messages {
  background: #1a202c;
}

.n8n-chat.dark .chat-message.bot .message-content {
  background: #4a5568;
  color: white;
  border-color: #2d3748;
}

.n8n-chat.dark .chat-input-container {
  background: #2d3748;
  border-color: #4a5568;
}

.n8n-chat.dark #chat-input {
  background: #4a5568;
  color: white;
  border-color: #2d3748;
}

.n8n-chat.dark #chat-input::placeholder {
  color: #a0aec0;
}


/************** CHAT BUBBLE STYLING ****************/
.suggestions-wrapper {
  margin: 12px 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-bubble {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;              /* pill shape */
  background: linear-gradient(180deg, #f6f8ff 0%, #eef2ff 100%);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 2px 6px rgba(16,24,40,0.06);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
  color: #0f172a;
}

#n8n-chat .suggestion-bubble {
    text-align: left;
}

.suggestion-bubble:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(16,24,40,0.12);
  color: #0f172a;
}

.suggestion-bubble:active {
  transform: translateY(0);
  opacity: .9;
}


/* petit style responsive */
@media (max-width: 480px) {
  .suggestion-bubble { font-size: 13px; padding: 8px 12px; }
}


/* Restart chat modal style */
.chat-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px; /* Match your chat window radius */
}

.chat-confirm-modal .modal-content {
    background: #fff;
    padding: 30px 40px;
    margin: 0 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
    border: 1px solid #e1e5e9;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

@media screen and (max-width: 768px) {
    .chat-confirm-modal .modal-content{
        padding: 26px 12px;
    }
}

#modal-text{
    max-width: 400px;
    -webkit-font-smoothing: antialiased: 0px;
}

.modal-buttons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.chat-confirm-modal-button{
    padding: 12px 16px !important;
    border-radius: 100px !important;
    font-weight: 400 !important;
}

.btn-cancel, .btn-cancel:hover{
    background-color: white !important;
    border: 1px solid #e1e5e9 !important;
    color: black !important;
}

.btn-confirm, .btn-confirm:hover{
    background-color: #fcc134 !important;
    border: 1px solid #fcc134 !important;
    color: black !important;
}




/********************** durpal formating **************************/

.chat-conversation {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  font-family: sans-serif;
}

.chat-user {
  text-align: right;
  margin-bottom: 0.5rem;
  color: #007bff;
}

.chat-bot {
  text-align: left;
  margin-bottom: 0.5rem;
  color: #333;
}

.chat-time {
  font-size: 0.8em;
  color: #888;
  margin-left: 5px;
}

#chat-stop{
    background: black;
    color: black;
    padding: 12px 12px;
    border-radius: 5px;
    position: absolute;
    right: 10px;
    bottom: 60px;
    width: 40px;
    height: 40px;
    display: none;
}
