/* Ashley AI Assistant - CLEAN VERSION */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #1a1a1a;
  --text-secondary: #6c757d;
  --border: #dee2e6;
  --accent: #0d6efd;
  --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --radius: 0.5rem;
}

[data-bs-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3c3c3c;
  --text-primary: #ffffff;
  --text-secondary: #adb5bd;
  --border: #495057;
}

/* Reset & Base */
.ai-assistant {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  z-index: 10000;
}

.ai-assistant * {
  box-sizing: border-box;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.close-sidebar {
  display: none;
  position: absolute;
  right: 1rem;
  top: 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.375rem;
}

.logo {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--text-primary);
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 0.875rem;
}

.brand h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.brand p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

.sidebar-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Buttons */
.btn-new-chat {
  background: var(--text-primary);
  border: none;
  color: var(--bg-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}

.btn-new-chat:hover {
  opacity: 0.9;
}

.btn-menu, .btn-theme {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-menu:hover, .btn-theme:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}

/* Quick Actions */
.quick-section h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.quick-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quick-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.2s;
}

.quick-btn:hover {
  background: var(--bg-tertiary);
}

.quick-btn i {
  font-size: 0.875rem;
  width: 1rem;
}

/* History */
.history-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
}

.btn-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.25rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.7;
}

.history-list {
  flex: 1;
  overflow-y: auto;
}

.empty-history {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.empty-history i {
  font-size: 1.5rem;
  opacity: 0.5;
}

/* Main Chat */
.main-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
}

.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-info h1 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status i {
  color: #198754;
  font-size: 0.5rem;
}

.btn-menu {
  display: none;
}

/* Messages Container */
.messages-container {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-content {
  text-align: center;
  max-width: 600px;
  padding: 2rem;
}

.welcome-avatar {
  width: 5rem;
  height: 5rem;
  background: var(--text-primary);
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 auto 1.5rem;
}

.welcome-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.welcome-content p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.action-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.action-item:hover {
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

.action-icon {
  width: 3rem;
  height: 3rem;
  background: var(--text-primary);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
  font-size: 1.125rem;
  margin: 0 auto 1rem;
}

.action-text h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.action-text p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

.welcome-tip {
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 500px;
  margin: 0 auto;
}

.welcome-tip p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

.welcome-tip strong {
  color: var(--text-primary);
}

/* Messages - NO TYPING ANIMATION */
.message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  max-width: 85%;
}

.message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.message-content {
  background: var(--bg-secondary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.message.user .message-content {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.message-text {
  line-height: 1.5;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Input Area */
.input-area {
  padding: 1.25rem 1.5rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.input-box {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  display: flex;
  align-items: flex-end;
  padding: 0.75rem 1rem;
  transition: all 0.2s;
}

.input-box:focus-within {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.1);
}

#user-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0;
  resize: none;
  min-height: 1.5rem;
  max-height: 7.5rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  outline: none;
}

#user-input::placeholder {
  color: var(--text-secondary);
}

.input-buttons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-left: 0.5rem;
}

.btn-attach {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.375rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-attach:hover {
  background: var(--bg-secondary);
}

.btn-send {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  transform: scale(1.05);
}

.btn-send:disabled {
  background: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.input-note {
  text-align: center;
  margin-top: 0.75rem;
}

.input-note span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Typing Indicator - FIXED & PROPERLY ALIGNED */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  max-width: 200px;
  width: fit-content;
}

.typing-indicator.visible {
  display: flex;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: pulse 1.5s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { 
    opacity: 0.4; 
    transform: scale(0.8); 
  }
  50% { 
    opacity: 1; 
    transform: scale(1); 
  }
}

.typing-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
/* Copy Button */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
}

.message-content:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* History Items */
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.history-item:hover {
  background: var(--bg-secondary);
}

.history-item.active {
  background: var(--bg-tertiary);
}

.history-title {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-delete {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
}

.history-item:hover .btn-delete {
  opacity: 1;
}

.btn-delete:hover {
  background: var(--bg-tertiary);
  color: #dc3545;
}

/* Mobile Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
}

.overlay.active {
  display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 9999;
    transform: translateX(-100%);
    width: 100%;
    max-width: 280px;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .close-sidebar {
    display: flex;
  }
  
  .btn-menu {
    display: flex;
  }
  
  .chat-header {
    padding: 0.75rem 1rem;
  }
  
  .messages-container {
    padding: 1rem;
  }
  
  .welcome-content {
    padding: 1.25rem 0;
  }
  
  .welcome-avatar {
    width: 3.75rem;
    height: 3.75rem;
    font-size: 1.25rem;
  }
  
  .welcome-content h1 {
    font-size: 1.5rem;
  }
  
  .action-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .action-item {
    padding: 1.25rem;
  }
  
  .message {
    max-width: 90%;
    gap: 0.5rem;
  }
  
  .input-area {
    padding: 1rem;
  }
}

/* Scrollbar */
.ai-assistant ::-webkit-scrollbar {
  width: 0.375rem;
}

.ai-assistant ::-webkit-scrollbar-track {
  background: transparent;
}

.ai-assistant ::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 0.1875rem;
}

.ai-assistant ::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
/* Style untuk sambutan AI yang singkat */
.ai-greeting {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ai-greeting .message-avatar {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.ai-greeting .message-text {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.9;
}

.ai-greeting .message-text strong {
  color: white;
  opacity: 1;
}

/* Dark mode support */
[data-bs-theme="dark"] .ai-greeting {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}