* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  height: 100vh;
  width: 100vw;
  display: flex;
  overflow: hidden;
  background: linear-gradient(135deg, #08111A 0%, #132A40 100%);
}

/* SIDEBAR */
.sidebar {
  width: 300px;
  background: linear-gradient(to bottom, #08111A 0%, 50%, #132A40 100%);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(8, 17, 26, 0.3);
  position: relative;
  border-right: 1px solid rgba(77, 169, 255, 0.3);
}

.sidebar-close-mobile {
  display: none;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to right, #08111A 0%, 50%, #265480 100%);
  box-shadow: 0 0 10px rgba(77, 169, 255, 0.5);
}

.sidebarTitle {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #f0f0f0;
}

#history {
  flex: 1;
}

.history-item {
  background: rgba(77, 169, 255, 0.1);
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  word-wrap: break-word;
  border: 1px solid rgba(77, 169, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.history-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: linear-gradient(to bottom, #08111A 0%, 50%, #265480 100%);
  transform: scaleY(0);
  transition: transform 0.3s ease;
  box-shadow: 0 0 8px rgba(77, 169, 255, 0.6);
}

.history-item:hover {
  background: rgba(77, 169, 255, 0.2);
  transform: translateX(4px);
  border-color: rgba(77, 169, 255, 0.5);
  box-shadow: 0 0 15px rgba(77, 169, 255, 0.3);
}

.history-item:hover::before {
  transform: scaleY(1);
}

/* ÁREA PRINCIPAL */
.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

/* HEADER */
.header {
  background: linear-gradient(to right, #08111A 0%, 50%, #132A40 100%);
  padding: 24px 32px;
  color: white;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 20px rgba(8, 17, 26, 0.3);
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(77, 169, 255, 0.3);
}

.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(77, 169, 255, 0.5), transparent);
  box-shadow: 0 0 8px rgba(77, 169, 255, 0.5);
}

.header img {
  height: 80px;
  width: auto;
  max-width: 350px;
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  object-fit: contain;
}

.header-texts {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.header-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* CHAT */
#messages {
  flex: 1;
  padding: 48px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Custom Scrollbar */
#messages::-webkit-scrollbar {
  width: 8px;
}

#messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#messages::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #08111A 0%, 50%, #265480 100%);
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(77, 169, 255, 0.5);
}

#messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #0a1520 0%, 50%, #397FBF 100%);
  box-shadow: 0 0 12px rgba(77, 169, 255, 0.7);
}

.msg {
  max-width: 75%;
  padding: 16px 20px;
  border-radius: 18px;
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 1.6;
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.user {
  background: #4DA9FF;
  color: #08111A;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(77, 169, 255, 0.3);
  font-weight: 500;
}

.bot {
  background: #f0f8ff;
  color: #08111A;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(77, 169, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bot::before {
  content: '🤖';
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  opacity: 0.6;
}

.user::after {
  content: '👤';
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  opacity: 0.6;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* INPUT */
#input-area {
  display: flex;
  padding: 20px 32px;
  background: linear-gradient(to top, #08111A 0%, #132A40 100%);
  border-top: 1px solid rgba(77, 169, 255, 0.3);
  box-shadow: 0 -4px 20px rgba(8, 17, 26, 0.2);
  gap: 12px;
}

#message {
  flex: 1;
  padding: 16px 20px;
  border-radius: 16px;
  border: 2px solid rgba(77, 169, 255, 0.4);
  outline: none;
  font-size: 15px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: inherit;
}

#message::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#message:focus {
  border-color: #4DA9FF;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 4px rgba(77, 169, 255, 0.2), 0 0 15px rgba(77, 169, 255, 0.3);
}

button {
  padding: 16px 32px;
  background: #4DA9FF;
  color: #08111A;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(8, 17, 26, 0.3);
  position: relative;
  overflow: hidden;
  min-width: 120px;
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:hover {
  background: #397FBF;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8, 17, 26, 0.4);
}

button:active {
  transform: translateY(0);
}

button:active::before {
  width: 300px;
  height: 300px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* FOOTER */
.footer {
  background: linear-gradient(to right, #08111A 0%, 50%, #132A40 100%);
  color: rgba(255, 255, 255, 0.9);
  padding: 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-top: 1px solid rgba(77, 169, 255, 0.3);
  box-shadow: 0 -4px 20px rgba(8, 17, 26, 0.2);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666666;
  text-align: center;
  padding: 40px;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state-text {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #333333;
}

.empty-state-subtext {
  font-size: 14px;
  color: #666666;
  opacity: 0.8;
}

/* Loading Animation */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4DA9FF;
  animation: typing 1.4s infinite;
  box-shadow: 0 0 8px rgba(77, 169, 255, 0.6);
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
  background: #4DA9FF;
  box-shadow: 0 0 8px rgba(77, 169, 255, 0.6);
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
  background: #4DA9FF;
  box-shadow: 0 0 8px rgba(77, 169, 255, 0.6);
}

@keyframes typing {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }

  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* MOBILE */
@media (max-width: 900px) {
  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-width: 80%;
    width: 260px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(8, 17, 26, 0.6);
  }

  .sidebar-close-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    margin-left: auto;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 18px;
  }

  .header {
    padding: 20px;
  }

  .header img {
    height: 60px;
    max-width: 250px;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  #messages {
    padding: 20px;
  }

  #input-area {
    padding: 10px 14px;
  }

  .msg {
    max-width: 85%;
  }

  .bot::before,
  .user::after {
    display: none;
  }
}

@media (max-width: 600px) {
  .header-title {
    font-size: 20px;
  }


  button {
    padding: 10px 18px;
    min-width: auto;
    font-size: 14px;
  }

  #message {
    padding: 10px 12px;
    font-size: 14px;
  }
}