:root {
  --primary-color: #7c4dff;
  --primary-dark: #5e35b1;
  --primary-light: #b388ff;
  --secondary-color: #f5f7ff;
  --bg-color: #ffffff;
  --text-dark: #1a237e;
  --text-light: #5c6bc0;
  --border-color: #d1c4e9;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --border-radius: 16px;
  --sidebar-width: 320px;
  --gradient: linear-gradient(135deg, #7c4dff 0%, #5e35b1 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    sans-serif;
}

body {
  background-color: var(--secondary-color);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  line-height: 1.6;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-color);
  border-right: 1px solid var(--border-color);
  height: 100vh;
  overflow-y: auto;
  transition: all 0.3s ease;
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background: var(--gradient);
  color: white;
}

.sidebar-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

.new-chat-btn {
  background-color: white;
  color: var(--primary-dark);
  border: none;
  border-radius: 20px;
  padding: 8px 15px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.new-chat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.chat-history {
  padding: 10px 0;
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  position: relative;
  margin: 5px 10px;
  border-radius: 10px;
}

.chat-item:hover {
  background-color: rgba(123, 77, 255, 0.1);
}

.chat-item.active {
  background-color: rgba(123, 77, 255, 0.1);
  border-left: 3px solid var(--primary-color);
}

.chat-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(123, 77, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  flex-shrink: 0;
}

.chat-item-content {
  flex: 1;
  overflow: hidden;
}

.chat-item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  color: var(--text-dark);
}

.chat-item-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid var(--border-color);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.username {
  font-weight: 500;
}

.user-email {
  font-size: 0.8rem;
  color: var(--text-light);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background-color: var(--bg-color);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.bot-avatar {
  width: 40px;
  height: 40px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 18px;
}

.chat-title {
  flex: 1;
}

.chat-title h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-dark);
}

.chat-title p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 2px;
}

.menu-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-light);
  cursor: pointer;
  display: none;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background-color: rgba(245, 247, 255, 0.5);
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  position: relative;
  animation: fadeIn 0.3s ease-out;
  box-shadow: var(--shadow);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bot-message {
  align-self: flex-start;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 5px;
}

.user-message {
  align-self: flex-end;
  background: var(--gradient);
  color: white;
  border-bottom-right-radius: 5px;
}

.message-content p {
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 6px;
  text-align: right;
}

.user-message .message-time {
  color: rgba(255, 255, 255, 0.7);
}

.chat-input-area {
  padding: 15px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.input-options {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.option-btn {
  background-color: var(--secondary-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 15px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-dark);
}

.option-btn:hover {
  background-color: rgba(123, 77, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.option-btn i {
  font-size: 0.9rem;
  color: var(--primary-color);
}

.chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-input {
  flex: 1;
  position: relative;
}

.chat-input textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 14px 50px 14px 18px;
  resize: none;
  max-height: 150px;
  background-color: var(--secondary-color);
  outline: none;
  font-size: 1rem;
  transition: all 0.2s;
  line-height: 1.5;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-input textarea:focus {
  border-color: var(--primary-color);
  background-color: var(--bg-color);
  box-shadow: 0 0 0 2px rgba(123, 77, 255, 0.2),
    inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.file-upload-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.2rem;
}

.file-upload-btn:hover {
  color: var(--primary-color);
}

.char-counter {
  text-align: right;
  padding: 5px 5px 0;
  font-size: 0.8rem;
  color: var(--text-light);
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(123, 77, 255, 0.3);
}

.send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(123, 77, 255, 0.3);
}

.send-btn:disabled {
  background: #d1c4e9;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.typing-indicator {
  display: flex;
  padding: 12px 16px;
  gap: 5px;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  background-color: var(--primary-light);
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

.sidebar::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--bg-color);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  padding: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--primary-color);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  color: var(--primary-color);
  transform: rotate(90deg);
}

.file-drop-area {
  border: 2px dashed var(--border-color);
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 15px;
}

.file-drop-area:hover {
  border-color: var(--primary-color);
  background-color: rgba(123, 77, 255, 0.05);
}

.file-drop-area i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.file-drop-area p {
  color: var(--text-light);
  margin-bottom: 5px;
}

.file-drop-area .browse-btn {
  color: var(--primary-color);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.file-input {
  display: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.cancel-btn {
  background-color: var(--secondary-color);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}

.cancel-btn:hover {
  background-color: #e8eaf6;
}

.upload-btn {
  background: var(--gradient);
  border: none;
  color: white;
  box-shadow: 0 2px 5px rgba(123, 77, 255, 0.3);
}

.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(123, 77, 255, 0.3);
}

.upload-btn:disabled {
  background: #d1c4e9;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.file-info {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background-color: var(--secondary-color);
  border-radius: 8px;
  margin-bottom: 15px;
  animation: fadeIn 0.3s ease-out;
}

.file-info i {
  color: var(--primary-color);
  font-size: 1.2rem;
}

.file-details {
  flex: 1;
  overflow: hidden;
}

.file-name {
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.8rem;
  color: var(--text-light);
}

.remove-file {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.remove-file:hover {
  color: #f44336;
  transform: scale(1.1);
}

.copy-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  margin-top: 5px;
  padding: 2px;
  color: var(--primary-color);
  transition: all 0.2s;
}
.copy-btn:hover {
  color: var(--primary-dark);
  transform: scale(1.1);
}

.mobile-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 90;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  display: none;
}

.mobile-fab:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

@media (max-width: 992px) {
  .sidebar {
    left: calc(-1 * var(--sidebar-width));
    top: 0;
    height: 100vh;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }

  .sidebar.active {
    left: 0;
  }

  .main-content {
    margin-left: 0;
  }

  .menu-btn {
    display: block;
  }

  .mobile-fab {
    display: flex;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
    --border-radius: 12px;
  }

  .chat-header {
    padding: 12px 15px;
  }

  .bot-avatar {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .chat-title h2 {
    font-size: 1.1rem;
  }

  .chat-messages {
    padding: 15px;
  }

  .message {
    max-width: 90%;
    padding: 10px 14px;
  }

  .chat-input-area {
    padding: 12px;
  }

  .chat-input textarea {
    padding: 12px 45px 12px 15px;
  }

  .send-btn {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  body {
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
  }

  .main-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
  }

  .chat-header {
    padding: 8px 12px;
    flex-shrink: 0;
  }

  .chat-input-area {
    padding: 8px;
    flex-shrink: 0;
  }

  .chat-input textarea {
    min-height: 40px;
    max-height: 100px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .message {
    max-width: 85%;
  }

  html,
  body {
    overflow-x: hidden;
    position: relative;
  }

  * {
    max-width: 100%;
  }

  .sidebar-header {
    background: var(--primary-color);
  }
}

@media (max-width: 360px) {
  :root {
    --border-radius: 8px;
  }

  .message {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .chat-input textarea {
    font-size: 0.9rem;
  }

  .send-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

#clerk-user-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
}

.cl-component.cl-user-button {
  background: var(--gradient);
  border-radius: 20px;
  padding: 6px 12px;
  color: white;
  border: none;
  cursor: pointer;
}

.cl-component.cl-user-button:hover {
  background: var(--primary-dark);
}

.sign-in-btn {
  background: var(--gradient);
  border: none;
  border-radius: 20px;
  padding: 8px 15px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sign-in-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Clerk Modal Overrides */
.cl-component.cl-modal {
  z-index: 1100 !important;
}

.cl-component.cl-modal-content {
  border-radius: var(--border-radius) !important;
}

.cl-component.cl-card {
  border-radius: var(--border-radius) !important;
  box-shadow: var(--shadow) !important;
}

.cl-component.cl-formButtonPrimary {
  background: var(--gradient) !important;
}

.cl-component.cl-formButtonPrimary:hover {
  background: var(--primary-dark) !important;
}

/* User Profile Container */
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  background-color: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* User Avatar */
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  background: linear-gradient(135deg, #6e00ff, #9e00c7);
  color: white;
  font-weight: 600;
  font-size: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.user-info {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.2;
}

.username {
  font-weight: 600;
  color: #333;
}

.user-email {
  color: #777;
  font-size: 12px;
}

.sign-out-btn {
  background-color: #6e00ff;
  color: white;
  padding: 10px 16px;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
}

.sign-out-btn i {
  font-size: 16px;
}

.sign-out-btn:hover {
  background-color: #6f00ffd0;
}


