/** Updated styles for new color theme and modern look **/

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Google Sans', 'Arial', sans-serif;
}

body {
  background: linear-gradient(135deg, #f3f3f3, #e6e6e6);
  min-height: 100vh;
  padding: 0;
  margin: 0;
}

.app-container {
  width: 100%;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
  width: 300px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: -300px;
  top: 0;
  height: 100vh;
  z-index: 1000;
  transition: left 0.3s ease;
}

.sidebar.open {
  left: 0;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.sidebar-title {
  font-size: 1.2em;
  font-weight: 600;
  color: #0066ff;
  margin-bottom: 5px;
}

.sidebar-subtitle {
  font-size: 0.9em;
  color: #666;
}

.projects-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.project-section {
  margin-bottom: 5px;
}

.project-header {
  padding: 12px 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-header:hover {
  background-color: #f0f0f0;
  transform: translateX(5px);
}

.project-header.active {
  background-color: #e3f2fd;
  color: #0066ff;
  font-weight: 500;
}

.project-link {
  font-size: 0.8em;
  color: #666;
}

.chat-container {
  flex: 1;
  margin-left: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.chat-header {
  background: #fff;
  color: #0066ff;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.menu-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #0066ff;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.menu-btn:hover {
  background-color: #f0f0f0;
}

.chat-title {
  font-size: 1.2em;
  font-weight: 600;
}

.current-doc {
  font-size: 0.9em;
  color: #666;
}

.settings-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #0066ff;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.settings-btn:hover {
  background-color: #f0f0f0;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fafafa;
  position: relative;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #666;
}

.empty-state-icon {
  font-size: 3em;
  margin-bottom: 20px;
}

.empty-state h3 {
  margin-bottom: 10px;
  color: #0066ff;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeInUp 0.5s forwards;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: #0066ff;
}

.message.assistant .message-avatar {
  background: #666;
}

.message-content {
  flex: 1;
  padding: 12px 16px;
  border-radius: 18px;
  background: #f0f0f0;
  max-width: 70%;
}

.message.user .message-content {
  background: #e3f2fd;
}

.message p {
  margin: 0;
}

.message h1, .message h2, .message h3 {
  margin: 10px 0;
  font-weight: bold;
}

.message h1 { font-size: 1.5em; }
.message h2 { font-size: 1.3em; }
.message h3 { font-size: 1.1em; }
.message b { font-weight: bold; }
.message i { font-style: italic; }
.message ul, .message ol {
  margin: 10px 0 10px 20px;
}
.message ul { list-style-type: disc; }
.message ol { list-style-type: decimal; }
.message code {
  background: #f0f0f0;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
}

/* Question Recommendations */
.question-recommendations {
  display: flex;
  gap: 15px;
  padding: 20px;
  justify-content: center;
  flex-wrap: wrap;
  animation: slideInFromBottom 0.6s ease-out;
}

@keyframes slideInFromBottom {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-recommendations.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.recommendation-btn {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border: 2px solid #e3f2fd;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  color: #0066ff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.1);
  max-width: 280px;
  text-align: center;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  animation: fadeInBounce 0.6s ease-out forwards;
  position: relative;
  overflow: hidden;
}

.recommendation-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 102, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.recommendation-btn:hover::before {
  left: 100%;
}

@keyframes fadeInBounce {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateY(-5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.recommendation-btn:hover {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-color: #0066ff;
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.2);
}

.recommendation-btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* Loading Animation */
.loading {
  display: flex;
  gap: 4px;
  align-items: center;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0066ff;
  animation: loadingPulse 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0;
}

@keyframes loadingPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Input */
.chat-input-container {
  padding: 20px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #f5f5f5;
  border-radius: 25px;
  padding: 10px 15px;
  transition: background-color 0.2s;
}

.chat-input-wrapper:focus-within {
  background: #f0f0f0;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  font-size: 16px;
  resize: none;
  outline: none;
  min-height: 20px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
}

.chat-input::placeholder {
  color: #888;
}

.send-btn {
  background: #0066ff;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: background-color 0.2s, transform 0.2s;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover {
  background: #0052cc;
  transform: scale(1.1);
}

.send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Settings Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.settings-modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .settings-modal {
  transform: scale(1);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.2em;
  font-weight: 600;
  color: #0066ff;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background-color: #f0f0f0;
}

.modal-content {
  padding: 20px;
}

.settings-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-item {
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.project-item:hover {
  background-color: #f5f5f5;
}

.project-item.selected {
  background-color: #e3f2fd;
  border-color: #0066ff;
}

.project-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-checkbox {
  margin: 0;
}

.project-name {
  font-weight: 500;
  margin-bottom: 5px;
}

.project-stats {
  font-size: 0.9em;
  color: #666;
}

.project-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  background: none;
  border: 1px solid #e0e0e0;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.delete-btn {
  color: #d32f2f;
  border-color: #d32f2f;
}

.delete-btn:hover {
  background-color: #d32f2f;
  color: white;
}

.upload-area {
  border: 2px dashed #0066ff;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover, .upload-area.drag-over {
  background: #e3f2fd;
  border-color: #0052cc;
}

.upload-icon {
  font-size: 3em;
  margin-bottom: 15px;
  color: #0066ff;
}

.upload-text {
  margin-bottom: 15px;
  color: #666;
}

.upload-btn {
  background: #0066ff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.upload-btn:hover {
  background: #0052cc;
}

.file-input {
  display: none;
}

.modal-actions {
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: #0066ff;
  color: white;
}

.btn-primary:hover {
  background: #0052cc;
}

.btn-secondary {
  background: #f5f5f5;
  color: #666;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-danger {
  background: #d32f2f;
  color: white;
}

.btn-danger:hover {
  background: #b71c1c;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Notification */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-weight: 500;
  z-index: 3000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  background: #4caf50;
}

.notification.error {
  background: #f44336;
}

.notification.info {
  background: #2196f3;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 280px;
  }
  
  .chat-header {
    padding: 10px 15px;
  }
  
  .chat-messages {
    padding: 15px;
  }
  
  .question-recommendations {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }
  
  .recommendation-btn {
    max-width: none;
    width: 100%;
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .chat-input-container {
    padding: 15px;
  }
  
  .settings-modal {
    width: 95%;
    margin: 10px;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .modal-actions > div {
    display: flex;
    gap: 10px;
    width: 100%;
  }
  
  .btn {
    flex: 1;
  }
}