:root {
  --primary: #2b7a78;
  --primary-hover: #205f5c;
  --secondary: #def2f1;
  --accent: #fecea8;
  --text-dark: #333;
  --bg-light: #f4f9f9;
  --bg-chat: #ffffff;
  --bg-user: #c7ecee;
  --bg-agent: #dff9fb;
  --border-color: #ddd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
}

.logo {
  height: 40px;
}

.chat-title {
  font-size: 18px;
  margin: 0;
  flex: 1;
  text-align: center;
}

.home-btn {
  color: white;
  font-size: 20px;
  text-decoration: none;
}

.chat-app {
  display: flex;
  height: calc(100vh - 60px);
}

.sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid var(--border-color);
  padding: 15px;
  overflow-y: auto;
}

.new-chat-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  background: linear-gradient(23deg, #001759, #a63618);
  color: white;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
}

.new-chat-btn:hover {
  background: linear-gradient(23deg, #001759, #a63618);
}

/*.edit-icon {
  font-size: 14px;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.edit-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}*/

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

.empty-state {
  margin: auto;
  font-size: 20px;
  color: #888;
  text-align: center;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background-color: var(--bg-chat);
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0,0,0,0.05);
}

/*.message-wrapper {
  margin-bottom: 12px;
}*/

.message-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 12px;
}

/*.user-message-wrapper .chat-timestamp {
  text-align: right;
      padding: 4px;
}*/
.user-message-wrapper {
  align-items: flex-end; /* right aligned */
}


.agent-message-wrapper {
  align-items: flex-start; /* left aligned */
}

.user-message {
  background: linear-gradient(23deg, #514a9a, #060321);
  color: #fff;
 color: white;
  padding: 10px 15px;
  border-radius: 15px;
  max-width: 75%;
  align-self: flex-end;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
  white-space: pre-wrap;
  text-align: left;
  font-size: 15px;
}

.agent-message {
  background: linear-gradient(23deg, #ffffff, #eeeeee);
  color: var(--text-dark);
  padding: 10px 15px;
  border-radius: 15px;
  max-width: 75%;
  align-self: flex-start;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
  white-space: pre-wrap;
  text-align: left;
  font-size: 15px;
}

.agent-message ul {
  margin: 8px 0;
  padding-left: 20px;
  list-style: disc;
}

.agent-message ul ul {
  margin: 4px 0;
  padding-left: 16px;
  list-style: circle;
}

.chat-input-area {
  padding: 12px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

#user-input {
  width: 100%;
  min-height: 60px;
  max-height: 150px;
  padding: 12px 110px 12px 16px;
  border-radius: 25px;
  border: 1px solid var(--border-color);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
}

.send-btn {
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  position: absolute;
  background-color: #151515;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.send-btn:hover {
  background-color: #cc5200;
}

.d-none {
  display: none !important;
}

.typing-indicator {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.typing-indicator .dot {
  height: 8px;
  width: 8px;
  margin: 0 2px;
  background-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

.user-menu {
  position: relative;
}

.profile-btn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  min-width: 180px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
}

.dropdown a {
  display: block;
  padding: 10px;
  color: var(--text-dark);
  text-decoration: none;
}

.dropdown a:hover {
  background-color: var(--secondary);
}

.mic-btn {
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  position: absolute;
  background-color: #382143;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.mic-btn:hover {
  background-color: #205f5c;
}

.mic-btn.listening {
  background-color: #ff4d4d;
  animation: micPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(255, 77, 77, 0.6);
}

@keyframes micPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(255, 77, 77, 0);
    transform: scale(1.08);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
    transform: scale(1);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(23deg, #333e5c, #240a03c7);
  color: white;
  padding: 10px 20px;
  height: 60px;
}

.header-logo img {
  height: 40px;
}

.header-right {
  display: flex;
  align-items: center;
}

.user-img {
  display: inline-block;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: white;
  cursor: pointer;
  margin-right: 10px;
  display: none;
}

.floating-new-chat-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(23deg, #001759, #a63618);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 2000;
  cursor: pointer;
}

.back-to-topics-btn {
  display: none;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.chat-timestamp {
    font-size: 12px;
    color: #777;
    margin-top: 3px;
    text-align: right;
    padding-right: 10px;
    font-style: italic;
    display: block;
        padding-bottom: 1px;
}

.agent-message-wrapper .chat-timestamp {
  text-align: left;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  gap: 10px;
}

.copy-btn,
.speak-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.copy-btn:hover,
.speak-btn:hover {
  opacity: 1;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: #666;
  cursor: pointer;
  transition: color 0.2s ease;
}

.icon-btn:hover {
  color: var(--primary);
}

.lang-selector {
  margin-top: 6px;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
}

@media (max-width: 768px) {
  .chat-app {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    left: -300px;
    top: 60px;
    height: calc(100vh - 60px);
    z-index: 1001;
    transition: left 0.3s ease-in-out;
  }

  .sidebar.active {
    left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .floating-new-chat-btn {
    display: block;
  }

  .sidebar .new-chat-btn {
    display: none;
  }

  .back-to-topics-btn {
    display: inline-block;
  }

  .agent-message,
  .user-message {
    max-width: 85%;
    font-size: 13px;
    padding: 10px 14px;
  }

  .agent-message ul {
    margin: 6px 0;
    padding-left: 16px;
  }

  .agent-message ul ul {
    margin: 3px 0;
    padding-left: 12px;
  }

  .chat-timestamp {
    font-size: 11px;
    margin: 3px 0 6px 0;
  }

  .chat-box {
    padding: 10px;
  }



  #user-input {
    font-size: 14px;
    padding: 10px 100px 10px 14px;
  }

  .send-btn,
  .mic-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .mic-btn {
    right: 55px;
  }
}

@media (max-width: 400px) {
  .agent-message,
  .user-message {
    max-width: 90%;
    font-size: 12px;
  }

  .agent-message ul {
    margin: 4px 0;
    padding-left: 12px;
  }

  .agent-message ul ul {
    margin: 2px 0;
    padding-left: 10px;
  }

  .chat-timestamp {
    font-size: 10px;
  }

  .chat-box {
    padding: 8px;
  }
}

/***************/
.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.topic-list li {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: linear-gradient(23deg, #aeaeae, #e9e8ef);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
  box-sizing: border-box;
}

.topic-list li:hover,
.topic-list li.active {
  background-color: var(--primary);
  color: #333;
  font-weight: 600;
}

.topic-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: normal;
    text-overflow: ellipsis;
    padding-right: 10px;
    line-height: 19px;
}

/* Styles for topic editing input and buttons */
.topic-edit-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-dark);
  background: linear-gradient(23deg, #ffffff, #f9f9f9);
  outline: none;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-edit-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 4px rgba(43, 122, 120, 0.3);
}

.topic-edit-buttons {
  display: flex;
  gap: 2px;
  justify-content: center;
  margin-top: 4px;
}

.topic-edit-btn {
     display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font-size: 15px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.2s ease, color 0.2s ease;
/*  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  border: none;
  border-radius: 6px;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;*/
}

.topic-edit-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.topic-edit-btn:active {
  transform: scale(0.95);
}

.topic-save-btn.btn-primary {
  background: linear-gradient(23deg, var(--primary), var(--primary-hover));
    color: #ffffff;
}

.topic-save-btn.btn-primary:hover {
  background: linear-gradient(23deg, var(--primary-hover), var(--primary));
  border: none;
}

.topic-save-btn.btn-primary:active,
.topic-save-btn.btn-primary:focus {
  background: linear-gradient(23deg, var(--primary-hover), var(--primary));
  border: none;
  box-shadow: 0 0 4px rgba(43, 122, 120, 0.3);
}

/* Optional: Cancel button style */
.topic-cancel-btn {
    background: #fe0000;
    color: #ffffff;
}

.topic-cancel-btn:hover {
  background: #bbbbbb;
}

.topic-cancel-btn:active {
  background: #aaaaaa;
}

/* Base style for icon buttons with no background */
.topic-pncl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font-size: 15px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.2s ease, color 0.2s ease;
}

/* Icon style inside */
.topic-pncl-btn i {
  font-size: 16px;
  pointer-events: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* Hover effect highlights icon */
.topic-pncl-btn:hover i {
  transform: scale(1.2);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

/* Press effect */
.topic-pncl-btn:active i {
  transform: scale(1.05);
}

/* Edit icon color */
.topic_edit_pncl_btn i {
  color: #08112f;
}

/* Delete icon color */
.topic_dlt_pncl_btn i {
  color: #f44336;
}


