/* AI.css */

.ai-chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #f9fafc;
}

/* Header */
.chat-header2 {
  background-color: transparent;
  margin: 0;
  padding: 20px 20px 0;
  position: relative;
}

.chat-header2 h2 {
  font-size: 2rem;
  color: #2d3748;
  text-align: left;
  margin: 0;
}

/* Main Chat Area */
.chat-main {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1rem;
  background: #f9fafc;
  margin-left: 15%;
  margin-right: 15%;
  border-radius: 50px;
}

/* Starter Page */
.starter-page {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.starter-content {
  text-align: center;
  padding: 2rem;
}

.starter-content svg path {
  fill: #8e44ad !important;
  stroke: #fff !important;
  stroke-width: 0.5px !important;
  stroke-linejoin: round !important;
  stroke-linecap: round !important;
  paint-order: fill stroke !important;
  vector-effect: non-scaling-stroke;
}

.starter-content h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: #111827;
  font-weight: 600;
}

.starter-content .subtitle {
  color: #6b7280;
  font-size: 1.1rem;
  margin-bottom: 0;
}

/* Chat Container */
.chat-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Message Containers */
.message-container {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  align-items: flex-start;
}

.ai-container {
  flex-direction: row;
}

.user-container {
  flex-direction: row-reverse;
}

.chat-avatar,
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
}

/* Chat message bubbles */
.chat-message {
  max-width: 70%;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  line-height: 1.5;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-message {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
  border-radius: 1rem 1rem 1rem 0.25rem;
}

.user-message {
  background: #4dabf7;
  color: white;
  border-radius: 1rem 1rem 0.25rem 1rem;
}

/* Footer */
.chat-footer {
  background: #f9fafc;
  padding: 1.5rem 2rem;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 20px;
  margin-bottom: 1rem;
  justify-content: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  background: #f3f4f6;
  border-radius: 12px;
  color: #374151;
  font-size: 0.9rem;
  cursor: pointer;
  border: 0.5px solid #4dabf7;
  transition: all 0.2s ease-in-out;
}

.action-btn .search-icon,
.action-btn .action-icon,
.action-icon2 {
  color: #0052d4;
}

.action-btn:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
  box-shadow: 0 0px 20px rgba(0, 82, 212, 0.2);
}

.action-btn:active {
  background: #e5e7eb;
  transform: scale(0.95);
  border: 1px solid #4dabf7;
  box-shadow: 0 0px 10px rgba(0, 82, 212, 0.4);
}

/* Selected state */
.action-btn.selected {
  background: #0052d4;
  color: white;
  box-shadow: 0 0px 20px rgba(0, 82, 212, 0.8);
}

.action-btn.selected .search-icon,
.action-btn.selected .action-icon {
  color: white;
}

/* Input Bar */
.input-container {
  max-width: 800px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}

.outer-input-bar {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px;
  background: white;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease-in-out;
}

.outer-input-bar:hover {
  border-color: hsla(207, 91%, 64%, 0.3);
  box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.1);
}

.outer-input-bar:focus-within {
  border-color: #4dabf7;
  box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.2);
}

.input-add-button {
  background: #0052d4;
  color: white;
  border: none;
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.input-add-button:hover {
  background: #0041ac;
  transform: scale(1.05);
}

.input-add-button svg {
  height: 18px;
  width: 18px;
}

.task-input {
  flex: 1;
  border: none;
  padding: 0.5rem;
  font-size: 1rem;
  background: transparent;
  min-width: 0;
}

.task-input:focus {
  outline: none;
  box-shadow: none;
}

.task-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

/* Enhanced Send Button */
.send-button {
  right: 1rem;
  top: 15%;
  font-size: 1.1rem;
  transition: transform 0.2s, color 0.2s;
  position: static;
  background: none;
  border: none;
  padding: 0.5rem;
  color: #0052d4;
  cursor: pointer;
  flex-shrink: 0;
}

.send-button:hover {
  color: #003c9f;
  transform: scale(1.1);
}

/* Rotating AI Icon */
.rotating-ai-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
  margin-top: 4px;
  z-index: 100;
}

.rotating-ai-icon:hover {
  opacity: 0.8;
}

.rotating-ai-icon svg {
  transition: filter 0.3s ease;
}

.rotating-ai-icon svg path {
  fill: #8e44ad !important;
  stroke: #fff !important;
  stroke-width: 0.5px !important;
  stroke-linejoin: round !important;
  stroke-linecap: round !important;
  paint-order: fill stroke !important;
  vector-effect: non-scaling-stroke;
}

.rotating-ai-icon:hover svg {
  filter: brightness(1.1);
}

/* Header Content */
.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6b7280;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1000;
}

.info-button:hover {
  background: #4b5563;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 82, 212, 0.2);
}

/* Tooltip */
.tooltip {
  position: absolute;
  left: 50%;
  top: 150%;
  transform: translateX(-50%);
  width: 260px;
  padding: 1.2rem;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  color: black;
  text-align: left;
}

.tooltip-header {
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 0.8rem;
  margin-bottom: 0.8rem;
}

.tooltip-title {
  display: block;
  font-weight: 700;
  color: #111827;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.main-feature {
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: #374151;
  position: relative;
}

.additional-capabilities {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f3f4f6;
  text-align: center;
  font-size: 0.85rem;
  color: #8e44ad;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sparkle-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.tooltip .additional-capabilities,
.tooltip .tooltip-header {
  text-align: center;
}

/* Sidebar Toggle Button */
.sidebar-toggle-icon {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #0052d4;
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  font-size: 1.4rem;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 6px 20px rgba(0, 82, 212, 0.4);
}

.sidebar-toggle-icon:hover {
  transform: scale(1.1);
  background: #0041ac;
  box-shadow: 0px 0px 20px rgba(0, 81, 212, 0.8);
}

.sidebar-toggle-icon:active {
  transform: scale(0.9);
}

.sidebar-toggle-icon.sidebar-toggle-small {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  margin-top: 0.4%;
  color: #0052d4;
  background-color: white;
  border: 2px solid #0052d4;
  box-shadow: 0 3px 10px rgba(0, 82, 212, 0.4);
}

.sidebar-toggle-icon.sidebar-toggle-small:hover {
  color: white;
  background: #0041ac;
  box-shadow: 0 6px 20px rgba(0, 82, 212, 0.4);
}

/* Right Sidebar */
.right-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 280px;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 82, 212, 0.2);
  border: 1px solid #e5e7eb;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  z-index: 2500;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  scrollbar-width: none; /* Firefox */
}

.right-sidebar::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.right-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.previous-chats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto; /* If the menu is clipped, you might need overflow: visible */
  scrollbar-width: none;
}

.previous-chats-list::-webkit-scrollbar {
  display: none;
}

/* Each chat item is relative so its menu can stack above subsequent items */
.previous-chat-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.2s ease-in-out, color 0.2s;
  border-radius: 12px;
  margin-left: 0.1rem;
  margin-right: 0.1rem;
}

.previous-chat-item:hover {
  background: #f1f5f9;
  color: #0052d4;
}

/* Minimally keep a smaller transform on active if you like; or remove. */
.previous-chat-item:active {
  transform: scale(0.98);
}

.previous-chat-item:last-child {
  border-bottom: none;
}

.chat-item-name {
  font-size: 1rem;
  color: #2d3748;
}

/* Chat item actions and drop-down menu */
.chat-item-actions {
  position: relative;
  display: inline-block;
}

.chat-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #718096;
  font-size: 1.2rem;
  padding: 4px;
  transition: all 0.2s ease-in-out;
}

.chat-menu-btn:hover {
  color: #0052d4;
  transform: scale(1.2);
}

/* Position the menu directly below the 3-dot button */
.chat-item-menu {
  position: absolute;
  top: -100%;
  right: -50%;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.5rem 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: opacity 0.2s ease-in-out;
  z-index: 9999; /* Must be high so it floats above other items */
}

.chat-item-menu button {
  background: none;
  border: none;
  border-radius: 12px;
  color: #2d3748;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  text-align: left;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s;
}

.chat-item-menu button:hover {
  background: #f1f5f9;
}

/* Default Chat Item */
.previous-chat-item.default-chat {
  background: #e2e8f0;
  font-weight: 600;
  text-align: center;
  border-radius: 12px;
  margin-top: 0.5rem;
  padding: 0.8rem;
  margin-bottom: 2rem;
}

.task-edit-input2,
.task-create-input2 {
  padding: 0.8rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  color: #2d3748;
}

/* The small Save buttons next to rename/new chat inputs */
.save-button3,
.save-button4 {
  background: #4dabf7;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  position: absolute;
  width: 25px;
  height: 45px;
  top: 15%;
  right: 3%;
}

.save-button4 {
  top: 18%;
}

.previous-chat-item.active-chat {
  background: #e3f2fd;
  font-weight: 600;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  width: 300px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-btn {
  background: #ef4444;
  color: white;
}

.confirm-btn:hover {
  background: #dc2626;
}

.cancel-btn {
  background: #e2e8f0;
  color: #1e293b;
}

.cancel-btn:hover {
  background: #cbd5e0;
}

/* Prevent wide content from spilling out of the chat message container */
.chat-message {
  max-width: 100%;
  overflow-wrap: break-word; /* Or use word-wrap: break-word; */
}

/* Ensures code blocks and wide text don't overflow */
.ai-markdown pre {
  background: #f5f5f5;
  padding: 0.75rem;
  border-radius: 4px;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

.ai-markdown code {
  font-family: monospace;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
}

/* Actions dialog above the input bar */
.actions-dialog {
  position: absolute;
  bottom: 110%; /* positions dialog just above the input bar */
  left: 82%;
  transform: translateX(-50%);
  width: 200px; /* decreased width */
  background: transparent;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  z-index: 200;
}

.actions-dialog button {
  background: none;
  border: none;
  padding: 0.5rem;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  background: #f3f4f6;
  color: #374151;
  border: 0.5px solid #4dabf7;
  display: flex;
  align-items: center;
  border-radius: 12px;
  margin-bottom: 10px;
  transition: all 0.2s ease-in-out;
}

.actions-dialog button svg {
  color: #0052d4;
}

.actions-dialog button:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
  box-shadow: 0 0px 20px rgba(0, 82, 212, 0.2);
}

.actions-dialog button:active {
  background: #e5e7eb;
  transform: scale(0.95);
  border: 1px solid #4dabf7;
  box-shadow: 0 0px 10px rgba(0, 82, 212, 0.4);
}

/* Action Button - Consolidated Styles */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f3f4f6; /* default background */
  border: 1px solid #4dabf7; /* default border */
  border-radius: 12px;
  color: #374151; /* default text color */
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.action-btn:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.action-btn:active {
  background: #e5e7eb;
  transform: scale(0.95);
  border: 1px solid #4dabf7;
}

/* Selected/Enabled state */
.action-btn.selected,
.action-btn.enabled {
  background: #0052d4;
  color: white;
  box-shadow: 0 0px 20px rgba(0, 82, 212, 0.8);
}

/* Icon colors */
.action-btn .search-icon,
.action-btn .action-icon {
  /* For the default state, you can set these as desired.
     In our example, we leave them to follow the parent color or set explicitly. */
  color: #0052d4;
}

.action-btn.selected .search-icon,
.action-btn.selected .action-icon,
.action-btn.enabled .search-icon,
.action-btn.enabled .action-icon {
  color: white;
}

/* Rotating AI Icon - fixed size */
.rotating-ai-icon {
  max-width: 48px;
  max-width: 48px;
  min-width: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
  margin-top: 4px;
  z-index: 100;
}

.rotating-ai-icon:hover {
  opacity: 0.8;
}

.rotating-ai-icon svg {
  transition: filter 0.3s ease;
}

.rotating-ai-icon svg path {
  fill: #8e44ad !important;
  stroke: #fff !important;
  stroke-width: 0.5px !important;
  stroke-linejoin: round !important;
  stroke-linecap: round !important;
  paint-order: fill stroke !important;
  vector-effect: non-scaling-stroke;
}

.rotating-ai-icon:hover svg {
  filter: brightness(1.1);
}
