/* Chat History Panel */
.chat-history {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  height: calc(100vh - 250px);
  overflow-y: auto;
  border-radius: 8px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn 0.3s ease-in-out;
}

/* Highlight style for found messages when searching */
.chat-message.highlight-found {
  position: relative;
  animation: pulse 2s infinite;
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.5);
  transition: all 0.3s ease;
}

.chat-message.highlight-found::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: calc(100% + 20px);
  background-color: rgba(13, 110, 253, 0.1);
  border-radius: 8px;
  pointer-events: none;
  z-index: -1;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
  }
}

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

.user-message {
  align-self: flex-end;
}

.bot-message {
  align-self: flex-start;
}

.message-content {
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  word-wrap: break-word;
  line-height: 1.5;
}

.user-message .message-content {
  background: linear-gradient(135deg, #00A39A 0%, #302B87 100%);
  color: white;
  margin-left: 2rem;
}

.bot-message .message-content {
  background: white;
  color: #333;
  margin-right: 2rem;
  border: 1px solid rgba(0,0,0,0.1);
}

.message-time {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
  padding: 0 1rem;
}

/* Make sure chat content formatting looks good */
.message-content h1,
.message-content h2,
.message-content h3 {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.message-content p {
  margin-bottom: 0.75rem;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul,
.message-content ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.message-content code {
  background-color: rgba(0,0,0,0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: monospace;
}

.message-content pre {
  background-color: rgba(0,0,0,0.05);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.user-message .message-content code,
.user-message .message-content pre {
  background-color: rgba(255,255,255,0.1);
}

/* Custom scrollbar for chat history */
.chat-history::-webkit-scrollbar {
  width: 12px;
}

.chat-history::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 5px;
}

.chat-history::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
  border: 2px solid #f1f1f1;
}

.chat-history::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Chat history scroll buttons */
.chat-scroll-buttons {
  position: absolute;
  right: 20px;
  bottom: 60px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
}

.chat-scroll-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.chat-scroll-button:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

.chat-scroll-button i {
  font-size: 18px;
}

/* Conversation List */
.conversation-list {
  max-height: 600px;
  overflow-y: auto;
}

.conversation-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 0.85rem;
}

.conversation-item:hover {
  background-color: #f8f9fa;
}

.conversation-item.active {
  background-color: #e9ecef;
}

/* Notes Section */
.notes-section textarea {
  width: 100%;
  min-height: 100px;
  margin-bottom: 0.5rem;
}

/* Feedback Message */
.feedback-message {
  z-index: 9999;
  position: fixed;
  top: 20px;
  right: 20px;
  animation: fadeOut 0.5s ease-in-out 2.5s forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Chart Styling */
.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
  margin: 20px 0;
}

.chart-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  height: 100%;
  overflow: hidden;
}

.chart-card .card-body {
  padding: 20px;
}

.chart-card .card-title {
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
}

/* Period selector styling */
.btn-group[role="group"] {
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.btn-group .btn {
  padding: 0.5rem 1.5rem;
  font-weight: 500;
  border: none;
  transition: all 0.2s ease;
}

.btn-group .btn:not(:last-child) {
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-group .btn.active {
  background-color: #0d6efd;
  color: white;
}

.btn-group .btn:hover:not(.active) {
  background-color: #f8f9fa;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .chart-container {
    height: 300px;
  }

  .btn-group .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .chart-container {
    height: 250px;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
    border-right: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }
}

/* Add styles for search highlights */
mark {
    background-color: #fff3cd;
    padding: 0.1em 0.2em;
    border-radius: 2px;
    color: #856404;
}

.matching-message {
    background: rgba(0, 0, 0, 0.03);
    padding: 0.5rem;
    border-left: 3px solid #6c757d;
    margin: 0.5rem 0;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem !important;
}


/* Make chat messages searchable */
.chat-message .message-content mark {
    background-color: #fff3cd;
    color: inherit;
}

/* Add refresh button styles */
.refresh-conversations {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
}

.refresh-conversations:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.refresh-conversations i {
    transition: transform 0.2s ease-in-out;
}

.refresh-conversations i.fa-spin {
    animation: rotate 1s linear infinite;
}

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

/* Removed continuous-spin animation */

/* Repair Modal Tab Styles */
#repairTabs .nav-link {
    color: #495057;
    font-weight: 500;
}

#repairTabs .nav-link.active {
    color: var(--primary-color, #00A39A);
    font-weight: 600;
}

/* Session Marker Styling */
.session-marker {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 0;
    animation: fadeIn 0.3s ease-in-out;
}

.session-marker-line {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.session-marker-line::before,
.session-marker-line::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    background-color: #dee2e6;
    margin: 0 10px;
}

.session-marker-text {
    padding: 5px 10px;
    background-color: #f8f9fa;
    border-radius: 20px;
    color: #495057;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
    min-width: 150px;
    text-align: center;
}

.session-marker-date {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Toast message styling */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-size: 1rem;
    display: none;
    animation: fadeInOut 3s forwards;
}

.toast.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.toast.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.toast.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

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

/* Progress Bar Styles */
.progress-container {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 30px;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-fill.messages.green {
    background-color: #28a745;
}

.progress-fill.messages.orange {
    background-color: #fd7e14;
}

.progress-fill.messages.red {
    background-color: #dc3545;
}

.progress-text {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    line-height: 30px;
    font-weight: 500;
    color: #333;
    text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.8);
}

/* Loading state for progress bar */
.progress-bar.loading {
    background-color: #f5f5f5;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Success Toast Notification */
.success-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background-color: #4caf50;
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
    font-weight: 500;
    animation: fadeIn 0.3s ease-out;
}

.success-toast.show {
    display: flex;
    align-items: center;
}

.success-toast i {
    margin-right: 8px;
}

/* Fallback toast for cases where the standard one is not available */
.toast.success {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background-color: #4caf50;
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    font-weight: 500;
    animation: fadeIn 0.3s ease-out;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.nav-link.active {
    background: rgba(255,255,255,0.15);
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}