@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --blau-cecot: #00B9E9;
  --blau-cecot-light: #F3FCFF;
  --blau-cecot-dark: #0079AD;
  --cecot-gray-bg: #F8F9FA;
  --cecot-gray-light: #F5F5F5;
  --cecot-gray-mid: #a7a7a7;
  --cecot-gris-mid-v2: #e1e1e1;
  --cecot-gray-dark: #2C3E50;
  --blanc: #FFFFFF;
  --cecot-success: #10B981;
    --ia-primary: #3459ff;
    --ia-secondary: #b10ceb;
    --gradient-ia: linear-gradient(156deg, var(--ia-primary) 0%, var(--ia-secondary) 100%);
}

* { box-sizing: border-box;
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;


}

body, html {
  margin: 0; padding: 0; height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  /* background: var(--cecot-gray-bg); */
}

.chat-wrapper {
  /* max-width: 820px; */
  
  height: 890px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--blanc);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(28, 130, 225, 0.12);
  overflow: hidden;
}

/* Header i estat */
.chat-header {
  background: var(--gradient-ia);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.header-info {
  flex-grow: 1;
}
.header-title {
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 2px 0;
  color: var(--blanc);
}
.header-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--blanc);
}
.status-dot {
  width: 8px; height: 8px;
  background: var(--cecot-success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Contenidor de missatges */
.messages-container {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--white);
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
}

/* Missatge individual */
.message {
  max-width: 75%;
  margin-bottom: 16px;
  animation: slideIn 0.3s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
  line-height: 1.5;
  word-wrap: break-word;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  border: 1px solid transparent;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Missatges usuari */
.message.user {
  align-self: flex-end;
  background: var(--ia-primary);
  color: var(--blanc);
  border-radius: 18px 18px 4px 18px;
  /* box-shadow: 0 2px 8px rgba(28, 130, 225, 0.25); */
  font-weight: 500;
  /* border-color: var(--ia-primary); */
}

/* Missatges bot */
.message.bot {
  align-self: flex-start;
  background: var(--cecot-gray-light);
  color: var(--cecot-gray-dark);
  border-radius: 18px 18px 18px 4px;
  /* box-shadow: 0 2px 4px rgba(0,0,0,0.04); */
  border-color: var(--cecot-gray-light);
}

/* Timestamp */
.timestamp {
  margin-top: 4px;
  font-size: 11px;
  color: var(--cecot-gray-mid);
}
.message.user .timestamp {
  text-align: right;
}

/* Indicador typing */
.typing-indicator {
  display: flex;
  gap: 10px;
  max-width: 75%;
  align-self: flex-start;
  margin-bottom: 16px;
}

.typing-bubble {
  background: var(--cecot-gray-light);
  /* border: 1px solid var(--cecot-gray-light); */
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  display: flex;
  gap: 4px;
}



.typing-dot {
  width: 8px; height: 8px;
  background: var(--cecot-gray-mid);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
  30% { transform: translateY(-10px); opacity: 1; }
}

/* Zona d'input */
.input-area {
  padding: 16px 20px;
  background: var(--blanc);
  border-top: 1px solid var(--cecot-gris-mid-v2);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

textarea {
  flex-grow: 1;
  border: 1px solid var( --cecot-gris-mid-v2);
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  resize: none;
  outline: none;
  transition: all 0.2s;
  max-height: 120px;
  line-height: 1.4;
}
textarea:focus {
  border-color: var(--ia-secondary);
  /* box-shadow: 0 0 0 3px rgba(28, 130, 225, 0.1); */
}

.info {
    
    padding: 0px 16px  20px;
    color: #6f6f6f;
    font-size: 14px;
    text-align: center;
}

.info a {
    color: var(--ia-primary);
    
}

.send-button {
  width: 44px; height: 44px;
  background: var(--gradient-ia);
  border: none;
  border-radius: 50%;
  color: var(--blanc);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* transition: all 0.2s; */
  flex-shrink: 0;
}
.send-button:hover {
  background: var(--ia-secondary);
  /* transform: scale(1.05); */
}
/* .send-button:active {
  transform: scale(0.95);
} */
.send-button:disabled {
  background: #e7a2ff;
  cursor: not-allowed;
  transform: none;
}

/* Quick replies */
.quick-replies {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 20px 12px;
  /* background: var(--cecot-gray-bg); */
}
.quick-reply-btn {
  background: var(--blanc);
  border: 1px solid var(--ia-primary);
  color: var(--ia-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  /* font-weight: 500; */
}
.quick-reply-btn:hover {
  background: var(--cecot-gray-light);
}

/* Scrollbar personalitzat */
.messages-container::-webkit-scrollbar {
  width: 6px;
}
.messages-container::-webkit-scrollbar-track {
  background: transparent;
}
.messages-container::-webkit-scrollbar-thumb {
  background: var(--cecot-gray-light);
  border-radius: 3px;
}
.messages-container::-webkit-scrollbar-thumb:hover {
  background: var(--cecot-gray-mid);
}

.poweredcecot {
    padding: 16px  10px;
    color: #ffffff;
    font-size: 14px;
    text-align: center;
    background-color:var(--ia-primary);
}

.poweredcecot a {
    color: #ffffff;
   
}


button.recover-thread {
  /* position: absolute;right: 30px;  */

      background: #0000;
    border: 1px solid white;
    border-radius: 60px;
    /* display: flex; */
    /* flex-direction: row; */
    /* align-items: center; */
    font-size: 14px;
    color: white;
    padding: 8px 16px !important;
}

button.recover-thread:hover { 
  background: white;
  color: var(--ia-primary);
}

div.recover-thread {
     display: flex;
    flex-direction: row;
    align-items: center; 

        gap: 8px;
}


@media (max-width: 768px) {
.chat-header {
    display: flex;
    align-items: flex-start;
    flex-direction: column;

}
}