/* Chat UI Styles for LLM Chatbot Integration */
/* NoZeroWeek Color Scheme: #492d4c (dark purple), #f4ae6f (orange), #ffffde (cream) */

/* ===========================
   Chat UI Component Styles
   =========================== */

.chat-ui {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 300px;
  background: #492d4c;
  border-radius: 8px;
  overflow: hidden;
}

/* Chat Messages Container */
.chat-messages {
  flex: 1;
  min-height: 150px;
  overflow-y: auto;
  padding: 1rem;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #492d4c;
  scroll-behavior: smooth;
}

/* Custom scrollbar for chat messages */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #5a3d5e;
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #6b4d6f;
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #7a5d7f;
}

/* Individual Chat Message */
.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* User Message (right-aligned) */
.chat-message-user {
  align-self: flex-end;
}

.chat-message-user .chat-message-content {
  background: #f4ae6f;
  color: #492d4c;
  border-radius: 12px 12px 0 12px;
}

/* Bot Message (left-aligned) */
.chat-message-bot {
  align-self: flex-start;
}

.chat-message-bot .chat-message-content {
  background: #5a3d5e;
  color: #ffffde;
  border-radius: 12px 12px 12px 0;
  border: 1px solid #6b4d6f;
}

/* Streaming Message Styles */
.chat-message-streaming .chat-message-content {
  position: relative;
  min-height: 24px;
}

.chat-message-streaming .chat-message-content::after {
  content: '▋';
  color: #f4ae6f;
  animation: blink 1s infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

/* Thinking Message Styles - Less prominent, shows LLM is processing */
.chat-message-thinking {
  opacity: 0.6;
  transform: scale(0.98);
  transition: all 0.3s ease;
}

.chat-message-thinking .chat-message-content {
  background: rgba(90, 61, 94, 0.5);
  border: 1px dashed #6b4d6f;
  font-style: italic;
  color: #b8b89a;
}

.chat-message-thinking .chat-message-content::before {
  content: '💭 ';
  margin-right: 4px;
}

/* Fading out animation */
.chat-message-fading {
  opacity: 0 !important;
  transform: scale(0.95) translateY(-10px) !important;
  transition: all 0.8s ease !important;
}

/* Error Message */
.chat-message-error {
  align-self: center;
  max-width: 90%;
}

.chat-message-error .chat-message-content {
  background: rgba(220, 53, 69, 0.15);
  color: #ffb3ba;
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message-error .error-icon {
  margin-right: 0.5rem;
}

/* Warning Message */
.chat-message-warning {
  align-self: center;
  max-width: 90%;
}

.chat-message-warning .chat-message-content {
  background: rgba(244, 174, 111, 0.15);
  color: #ffffde;
  border: 1px solid rgba(244, 174, 111, 0.4);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.chat-message-warning .warning-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* Info Message */
.chat-message-info {
  align-self: center;
  max-width: 90%;
}

.chat-message-info .chat-message-content {
  background: rgba(23, 162, 184, 0.15);
  color: #ffffde;
  border: 1px solid rgba(23, 162, 184, 0.4);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.chat-message-info .info-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* Stopped Message Indicator */
.chat-message-stopped {
  opacity: 0.7;
}

.chat-message-stopped-indicator {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: rgba(220, 53, 69, 0.2);
  color: #ffb3ba;
  border-radius: 4px;
  font-size: 0.8rem;
  font-style: italic;
  display: inline-block;
}

/* Retry Button */
.chat-retry-button {
  align-self: flex-start;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f4ae6f;
  color: #492d4c;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.chat-retry-button:hover {
  background: #e89d5a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-retry-button:active {
  transform: translateY(0);
}

.chat-retry-button:focus {
  outline: 2px solid #f4ae6f;
  outline-offset: 2px;
}

/* Message Content */
.chat-message-content {
  padding: 0.6rem 0.85rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 0.9rem;
}

.chat-message-content strong {
  font-weight: 600;
}

.chat-message-content em {
  font-style: italic;
}

.chat-message-content code {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

/* Lists in message content */
.chat-message-content ul,
.chat-message-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.chat-message-content li {
  margin: 0.25rem 0;
  line-height: 1.6;
}

.chat-message-content ul {
  list-style-type: disc;
}

.chat-message-content ol {
  list-style-type: decimal;
}

.chat-message-bot .chat-message-content code {
  background: rgba(0, 0, 0, 0.3);
}

.chat-message-user .chat-message-content code {
  background: rgba(73, 45, 76, 0.3);
}

/* Message Timestamp */
.chat-message-timestamp {
  font-size: 0.75rem;
  color: #b8b89a;
  margin-top: 0.25rem;
  padding: 0 0.5rem;
}

.chat-message-user .chat-message-timestamp {
  text-align: right;
}

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

/* Chat Input Container */
.chat-input-container {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #5a3d5e;
  border-top: 2px solid #6b4d6f;
}

/* Chat Input Textarea */
.chat-input {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid #6b4d6f;
  border-radius: 8px;
  background: #492d4c;
  color: #ffffde;
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  transition: border-color 0.3s;
}

.chat-input:focus {
  outline: none;
  border-color: #f4ae6f;
}

.chat-input::placeholder {
  color: #9a8a9e;
}

.chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Chat Send Button */
.chat-send-button {
  padding: 0.6rem 1.25rem;
  background: #f4ae6f;
  color: #492d4c;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-send-button:hover:not(:disabled) {
  background: #e89d5a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-send-button:active:not(:disabled) {
  transform: translateY(0);
}

.chat-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chat Stop Button */
.chat-stop-button {
  padding: 0.6rem 1.25rem;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.chat-stop-button:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-stop-button:active {
  transform: translateY(0);
}

/* Chat Loading Indicator */
.chat-loading {
  padding: 0.75rem 1rem;
  text-align: center;
  color: #f4ae6f;
  font-size: 0.9rem;
  background: #5a3d5e;
  border-top: 1px solid #6b4d6f;
}

.loading-dots::after {
  content: '';
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

/* Chatbot Error State */
.chatbot-error {
  padding: 2rem;
  text-align: center;
  color: #ffb3ba;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 8px;
  margin: 1rem;
}

.chatbot-error p {
  margin-bottom: 0.5rem;
}

.chatbot-error .error-details {
  font-size: 0.875rem;
  color: #e6a0a5;
  font-family: 'Courier New', monospace;
}

/* ===========================
   Onboarding Chatbot Modal
   =========================== */

.chatbot-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
}

.chatbot-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.chatbot-modal-open .chatbot-modal-overlay {
  opacity: 1;
}

.chatbot-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 700px;
  height: 80vh;
  min-height: 400px;
  max-height: 90vh;
  background: #5a3d5e;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: all 0.3s ease;
}

.chatbot-modal-open .chatbot-modal-content {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.chatbot-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #6b4d6f;
  border-bottom: 2px solid #7a5d7f;
  border-radius: 12px 12px 0 0;
}

.chatbot-modal-header h3 {
  color: #f4ae6f;
  font-size: 1.25rem;
  margin: 0;
}

.chatbot-close-button {
  background: transparent;
  border: none;
  color: #ffffde;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.3s;
}

.chatbot-close-button:hover {
  background: rgba(244, 174, 111, 0.2);
  color: #f4ae6f;
}

.chatbot-close-button:focus {
  outline: 2px solid #f4ae6f;
  outline-offset: 2px;
}

/* Modal Body */
.chatbot-modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#onboarding-chatbot-modal-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#onboarding-chatbot-modal-container .chat-ui {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===========================
   Planning Chatbot Section
   =========================== */

.planning-chatbot-section {
  background: #5a3d5e;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Planning Chatbot Header */
.planning-chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #6b4d6f;
  border-bottom: 2px solid #7a5d7f;
  cursor: pointer;
  transition: background 0.3s;
}

.planning-chatbot-header:hover {
  background: #7a5d7f;
}

.planning-chatbot-header h3 {
  color: #f4ae6f;
  font-size: 1.3rem;
  margin: 0;
}

.chatbot-toggle-button {
  background: transparent;
  border: 1px solid #f4ae6f;
  color: #f4ae6f;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chatbot-toggle-button:hover {
  background: rgba(244, 174, 111, 0.1);
}

.chatbot-toggle-button:focus {
  outline: 2px solid #f4ae6f;
  outline-offset: 2px;
}

.toggle-icon {
  font-size: 0.875rem;
  transition: transform 0.3s;
}

/* Planning Chatbot Body */
.planning-chatbot-body {
  display: none;
  height: 500px;
}

#planning-chatbot-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#planning-chatbot-container .chat-ui {
  height: 100%;
}

/* ===========================
   Notifications
   =========================== */

.chatbot-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  background: #5a3d5e;
  color: #ffffde;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  max-width: 350px;
  border-left: 4px solid #f4ae6f;
}

.chatbot-notification-show {
  opacity: 1;
  transform: translateX(0);
}

.chatbot-notification-success {
  border-left-color: #10B981;
  background: #5a3d5e;
}

.chatbot-notification-error {
  border-left-color: #dc3545;
  background: rgba(220, 53, 69, 0.15);
  color: #ffb3ba;
}

.chatbot-notification-info {
  border-left-color: #f4ae6f;
}

/* Saving Indicator */
.chatbot-saving-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 0.75rem 1.25rem;
  background: #5a3d5e;
  color: #ffffde;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  opacity: 0;
  transform: translateY(100px);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-left: 4px solid #f4ae6f;
  font-size: 0.9rem;
}

.chatbot-saving-indicator-show {
  opacity: 1;
  transform: translateY(0);
}

.chatbot-saving-indicator-success {
  border-left-color: #10B981;
}

.saving-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(244, 174, 111, 0.3);
  border-top-color: #f4ae6f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.saving-check {
  color: #10B981;
  font-size: 1.2rem;
  font-weight: bold;
}

/* ===========================
   Activity Highlight Animation
   =========================== */

.activity-highlight {
  animation: activityHighlight 2s ease;
}

@keyframes activityHighlight {
  0%, 100% {
    background: #492d4c;
  }
  50% {
    background: rgba(244, 174, 111, 0.3);
    border-left-color: #10B981;
  }
}

.selector-highlight {
  animation: selectorPulse 2s ease;
}

@keyframes selectorPulse {
  0%, 100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 0 4px rgba(244, 174, 111, 0.4);
  }
}

/* ===========================
   Responsive Design (Mobile)
   =========================== */

@media (max-width: 768px) {
  /* Modal adjustments for mobile */
  .chatbot-modal-content {
    width: 95%;
    height: 90vh;
    max-height: none;
  }

  .chatbot-modal-header {
    padding: 1rem;
  }

  .chatbot-modal-header h3 {
    font-size: 1.25rem;
  }

  /* Chat messages take more width on mobile */
  .chat-message {
    max-width: 90%;
  }

  /* Input container adjustments */
  .chat-input-container {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .chat-send-button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Planning chatbot adjustments */
  .planning-chatbot-header {
    padding: 0.875rem 1rem;
  }

  .planning-chatbot-header h3 {
    font-size: 1.1rem;
  }

  .planning-chatbot-body {
    height: 400px;
  }

  /* Notifications on mobile */
  .chatbot-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .chat-input-container {
    flex-direction: column;
  }

  .chat-send-button {
    width: 100%;
    align-self: stretch;
  }

  .chatbot-modal-content {
    border-radius: 0;
    width: 100%;
    height: 100vh;
  }

  .chatbot-modal-header {
    border-radius: 0;
  }
}

/* ===========================
   Accessibility Enhancements
   =========================== */

/* Focus visible for keyboard navigation */
.chat-input:focus-visible,
.chat-send-button:focus-visible,
.chatbot-close-button:focus-visible,
.chatbot-toggle-button:focus-visible {
  outline: 2px solid #f4ae6f;
  outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .chat-message,
  .chatbot-modal-overlay,
  .chatbot-modal-content,
  .chatbot-notification,
  .activity-highlight,
  .selector-highlight {
    animation: none;
    transition: none;
  }
  
  .loading-dots::after {
    animation: none;
    content: '...';
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .chat-message-bot .chat-message-content {
    border: 2px solid #f4ae6f;
  }
  
  .chat-input {
    border: 2px solid #f4ae6f;
  }
  
  .chatbot-modal-content {
    border: 3px solid #f4ae6f;
  }
}


/* ===========================
   Chatbot-Only Planning View
   =========================== */

.chatbot-only-view {
  padding: 0 !important;
  max-width: none !important;
}

.chatbot-planning-layout {
  display: flex;
  height: calc(100vh - 60px); /* Account for smaller header */
  gap: 0;
}

/* Planning Sidebar */
.planning-sidebar {
  width: 280px;
  background: #5a3d5e;
  border-right: 2px solid #6b4d6f;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
}

.planning-sidebar::-webkit-scrollbar {
  width: 8px;
}

.planning-sidebar::-webkit-scrollbar-track {
  background: #492d4c;
}

.planning-sidebar::-webkit-scrollbar-thumb {
  background: #6b4d6f;
  border-radius: 4px;
}

.sidebar-section {
  background: #492d4c;
  border-radius: 8px;
  padding: 0.75rem;
  border: 1px solid #6b4d6f;
}

.sidebar-section h3 {
  color: #f4ae6f;
  font-size: 0.9rem;
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-section.collapsible h3 {
  cursor: pointer;
  user-select: none;
  justify-content: space-between;
}

.sidebar-section.collapsible h3:hover {
  color: #e89d5a;
}

.toggle-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s;
}

.toggle-arrow.expanded {
  transform: rotate(180deg);
}

/* Variety Score Display */
.variety-score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.variety-score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: conic-gradient(
    #10B981 0deg,
    #10B981 calc(var(--score, 0) * 3.6deg),
    #5a3d5e calc(var(--score, 0) * 3.6deg)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.variety-score-circle::before {
  content: '';
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #492d4c;
}

.variety-score-circle span {
  position: relative;
  z-index: 1;
  font-size: 1.5rem;
  font-weight: bold;
  color: #f4ae6f;
}

.variety-score-label {
  color: #ffffde;
  font-size: 0.8rem;
  text-align: center;
  margin: 0;
}

/* Category Distribution Chart */
.category-chart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.category-label {
  color: #ffffde;
  font-size: 0.8rem;
  min-width: 50px;
}

.category-bar-fill {
  flex: 1;
  height: 16px;
  background: #f4ae6f;
  border-radius: 4px;
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

.category-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.category-count {
  color: #b8b89a;
  font-size: 0.8rem;
  min-width: 25px;
  text-align: right;
}

/* Current Plan Summary */
.plan-summary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.points-tracker-compact {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem;
  background: #5a3d5e;
  border-radius: 6px;
  border: 1px solid #6b4d6f;
}

.points-tracker-compact .points-label {
  color: #b8b89a;
  font-size: 0.8rem;
}

.points-tracker-compact .points-value {
  color: #f4ae6f;
  font-size: 1.1rem;
  font-weight: bold;
}

.points-tracker-compact .points-target {
  color: #9a8a9e;
  font-size: 0.8rem;
}

/* Sidebar Activities List */
.sidebar-activities {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 150px;
  overflow-y: auto;
}

.sidebar-activities::-webkit-scrollbar {
  width: 6px;
}

.sidebar-activities::-webkit-scrollbar-track {
  background: #5a3d5e;
}

.sidebar-activities::-webkit-scrollbar-thumb {
  background: #6b4d6f;
  border-radius: 3px;
}

.sidebar-activity-item {
  padding: 0.4rem;
  background: #5a3d5e;
  border-radius: 4px;
  border-left: 3px solid #f4ae6f;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.sidebar-activity-item.high-frequency {
  border-left-color: #dc3545;
  animation: pulseRed 2s infinite;
}

.sidebar-activity-item.needs-variety {
  border-left-color: #ffc107;
  animation: pulseYellow 2s infinite;
}

@keyframes pulseRed {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1);
  }
}

@keyframes pulseYellow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.1);
  }
}

.sidebar-activity-name {
  color: #ffffde;
  flex: 1;
}

.sidebar-activity-points {
  color: #f4ae6f;
  font-weight: 600;
}

.frequency-indicator {
  font-size: 0.75rem;
  color: #b8b89a;
  margin-left: 0.5rem;
}

.frequency-indicator.warning {
  color: #ffc107;
}

.frequency-indicator.danger {
  color: #dc3545;
}

.empty-state-small {
  color: #9a8a9e;
  font-size: 0.875rem;
  text-align: center;
  margin: 0.5rem 0;
}

/* Activity History Display */
.activity-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0.75rem;
}

.activity-history::-webkit-scrollbar {
  width: 6px;
}

.activity-history::-webkit-scrollbar-track {
  background: #5a3d5e;
}

.activity-history::-webkit-scrollbar-thumb {
  background: #6b4d6f;
  border-radius: 3px;
}

.history-week-group {
  padding: 0.75rem;
  background: #5a3d5e;
  border-radius: 6px;
  border: 1px solid #6b4d6f;
}

.history-week-header {
  color: #f4ae6f;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.history-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-activity-item {
  color: #ffffde;
  font-size: 0.8rem;
  padding: 0.25rem 0;
  display: flex;
  justify-content: space-between;
  transition: background 0.2s;
}

.history-activity-item:hover {
  background: rgba(244, 174, 111, 0.1);
  border-radius: 4px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.history-activity-item.high-frequency {
  border-left: 2px solid #dc3545;
  padding-left: 0.5rem;
}

.history-activity-item .activity-name {
  flex: 1;
}

.history-activity-item .activity-frequency {
  color: #b8b89a;
  font-size: 0.75rem;
}

.show-more-history-btn {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  background: #5a3d5e;
  color: #f4ae6f;
  border: 1px solid #6b4d6f;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.3s;
}

.show-more-history-btn:hover {
  background: #6b4d6f;
  border-color: #f4ae6f;
}

.loading-text {
  color: #9a8a9e;
  font-size: 0.875rem;
  text-align: center;
  margin: 1rem 0;
}

/* Main Chatbot Area */
.planning-chatbot-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #492d4c;
  overflow: hidden;
}

.chatbot-header {
  padding: 1rem 1.5rem;
  background: #5a3d5e;
  border-bottom: 2px solid #6b4d6f;
}

.chatbot-header h2 {
  color: #f4ae6f;
  font-size: 1.4rem;
  margin: 0 0 0.35rem 0;
}

.chatbot-subtitle {
  color: #b8b89a;
  font-size: 0.9rem;
  margin: 0;
}

.chatbot-fullscreen-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatbot-fullscreen-container .chat-ui {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}

.chatbot-fullscreen-container .chat-messages {
  padding: 1rem 1.5rem;
}

.chatbot-fullscreen-container .chat-input-container {
  padding: 1rem 1.5rem;
  background: #5a3d5e;
  border-top: 2px solid #6b4d6f;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .chatbot-planning-layout {
    flex-direction: column;
  }

  .planning-sidebar {
    width: 100%;
    max-height: 300px;
    border-right: none;
    border-bottom: 2px solid #6b4d6f;
  }

  .planning-chatbot-main {
    height: calc(100vh - 380px);
  }
}

@media (max-width: 768px) {
  .planning-sidebar {
    padding: 1rem;
    gap: 1rem;
    max-height: 250px;
  }

  .sidebar-section {
    padding: 0.75rem;
  }

  .variety-score-circle {
    width: 80px;
    height: 80px;
  }

  .variety-score-circle::before {
    width: 64px;
    height: 64px;
  }

  .variety-score-circle span {
    font-size: 1.5rem;
  }

  .chatbot-header {
    padding: 1rem 1.5rem;
  }

  .chatbot-header h2 {
    font-size: 1.5rem;
  }

  .chatbot-fullscreen-container .chat-messages {
    padding: 1rem;
  }

  .chatbot-fullscreen-container .chat-input-container {
    padding: 1rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .planning-sidebar {
    width: 100%;
  }

  .sidebar-section h3 {
    font-size: 0.9rem;
  }

  .chatbot-header h2 {
    font-size: 1.25rem;
  }

  .chatbot-subtitle {
    font-size: 0.875rem;
  }
}


/* ===========================
   Connection Status Indicator
   =========================== */

.connection-status-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: statusSlideIn 0.3s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@keyframes statusSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.connection-status-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-status-icon {
  font-size: 18px;
  font-weight: bold;
  display: inline-block;
  min-width: 20px;
  text-align: center;
}

.connection-status-text {
  font-size: 14px;
  font-weight: 600;
}

.connection-status-detail {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 5px;
}

/* State-specific styles */
.connection-status-connected {
  background: #28a745;
  color: white;
}

.connection-status-connected .connection-status-icon {
  animation: none;
}

.connection-status-connecting {
  background: #ffc107;
  color: #492d4c;
}

.connection-status-connecting .connection-status-icon {
  animation: spin 1s linear infinite;
}

.connection-status-reconnecting {
  background: #ff9800;
  color: white;
}

.connection-status-reconnecting .connection-status-icon {
  animation: spin 1s linear infinite;
}

.connection-status-disconnected {
  background: #6c757d;
  color: white;
}

.connection-status-error {
  background: #dc3545;
  color: white;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .connection-status-indicator {
    top: 10px;
    right: 10px;
    padding: 10px 16px;
  }
  
  .connection-status-text {
    font-size: 13px;
  }
  
  .connection-status-detail {
    font-size: 11px;
  }
}
