/* NYLA AI Assistant Styles */

/* NYLA Tab Content */
#nylaTab {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.nyla-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(26, 26, 26, 0.3);
  border-radius: 16px;
  border: 1px solid #333333;
  overflow: hidden;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Messages Container */
.nyla-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 250px;
  max-height: 350px; /* Base mobile max-height */
  scroll-behavior: smooth;
}

/* Ensure conversation doesn't grow infinitely on all screen sizes */
@media (max-height: 600px) {
  .nyla-messages {
    max-height: 250px; /* Smaller screens get less height */
  }
}

@media (min-height: 800px) {
  .nyla-messages {
    max-height: 450px; /* Larger screens can have more height */
  }
}

.nyla-messages::-webkit-scrollbar {
  width: 6px;
}

.nyla-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.nyla-messages::-webkit-scrollbar-thumb {
  background: #FF6B35;
  border-radius: 3px;
}

/* Individual Messages */
.nyla-message {
  margin-bottom: 16px;
  animation: messageSlideIn 0.3s ease-out;
}

/* Consecutive NYLA Messages */
.nyla-message.consecutive-message {
  margin-top: -8px; /* Reduce gap between consecutive messages */
}

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

.message-header {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.message-avatar {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 107, 53, 0.2);
}

.nyla-message-user .message-avatar {
  background: rgba(136, 136, 136, 0.2);
}

.nyla-message-user .message-header {
  justify-content: flex-end; /* Align user header to right */
  margin-right: 0;
  margin-left: auto;
  max-width: 80%; /* Match content width */
}

/* NYLA Avatar Image Styling */
.nyla-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.message-sender {
  font-weight: 600;
  color: #FF6B35;
  font-size: 16px;
}

.nyla-message-user .message-sender {
  color: #888888;
}

.message-time {
  font-size: 12px;
  color: #666666;
  margin-left: auto;
}

.message-content {
  background: rgba(42, 42, 42, 0.8);
  border: 1px solid #555555;
  border-radius: 12px;
  padding: 12px 16px;
  color: #ffffff;
  line-height: 1.5;
  font-size: 16px;
  margin-left: 36px;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.nyla-message-user .message-content {
  background: rgba(255, 107, 53, 0.1);
  border-color: #FF6B35;
  margin-left: auto; /* Push to right */
  margin-right: 0; /* Remove right margin */
  max-width: 80%; /* Limit width for better chat appearance */
}

.message-content .bullet {
  color: #FF6B35;
  font-weight: bold;
  margin-right: 4px;
}

.message-content a {
  color: #FF6B35;
  text-decoration: none;
}

.message-content a:hover {
  text-decoration: underline;
}

.message-content strong {
  color: #FF6B35;
}

.message-content em {
  color: #cccccc;
  font-style: italic;
}

/* Typing Indicator */
.nyla-typing-indicator {
  display: none;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  background: rgba(42, 42, 42, 0.5);
  border-top: 1px solid #333333;
}

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

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #FF6B35;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

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

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

.typing-text {
  color: #888888;
  font-size: 13px;
  font-style: italic;
}

/* Question Buttons Container */
.nyla-questions {
  padding: 16px;
  border-top: 1px solid #333333;
  background: rgba(26, 26, 26, 0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: none;
  overflow-y: visible;
  transition: all 0.3s ease;
}

.nyla-questions.processing {
  position: relative;
}

.nyla-questions.processing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  z-index: 0;
  pointer-events: none;
}

.nyla-question-btn {
  background: rgba(42, 42, 42, 0.8);
  border: 1px solid #555555;
  border-radius: 12px;
  padding: 12px 16px;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  line-height: 1.4;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  position: relative;
  z-index: 1;
}

.nyla-question-btn:hover {
  background: rgba(255, 107, 53, 0.1);
  border-color: #FF6B35;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.nyla-question-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.nyla-question-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
  z-index: 1;
  transform: scale(0.98);
  transition: all 0.3s ease;
}

.nyla-question-btn.disabled::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2); /* 20% transparency for better visibility */
  border-radius: 12px;
  z-index: 3;
  pointer-events: none;
  backdrop-filter: none;
}

.nyla-question-btn.disabled::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.4));
  border-radius: 14px;
  z-index: 0;
  pointer-events: none;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Ensure button text remains visible above the overlay */
.nyla-question-btn.disabled > * {
  position: relative;
  z-index: 4;
}

.nyla-question-btn[data-action="changeTopic"] {
  background: rgba(136, 136, 136, 0.2);
  border-color: #888888;
  color: #cccccc;
  font-style: italic;
}

.nyla-question-btn[data-action="changeTopic"]:hover {
  background: rgba(136, 136, 136, 0.3);
  border-color: #aaaaaa;
}

/* Tab Switch Button Styling */
.nyla-question-btn.tab-switch-btn {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(255, 140, 90, 0.1));
  border: 1px solid rgba(255, 107, 53, 0.3);
  color: #FF6B35;
  font-weight: 600;
  position: relative;
}

.nyla-question-btn.tab-switch-btn::before {
  content: '🚀';
  position: absolute;
  left: 12px;
  opacity: 0.8;
}

.nyla-question-btn.tab-switch-btn::after {
  content: '→';
  position: absolute;
  right: 12px;
  font-size: 16px;
  font-weight: bold;
  color: #FF6B35;
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.nyla-question-btn.tab-switch-btn {
  padding-left: 35px; /* Make room for emoji */
  padding-right: 35px; /* Make room for arrow */
}

.nyla-question-btn.tab-switch-btn:hover {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.25), rgba(255, 140, 90, 0.15));
  border-color: #FF6B35;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.3);
}

.nyla-question-btn.tab-switch-btn:hover::after {
  transform: translateX(3px); /* Arrow moves right on hover */
}

.nyla-question-btn.tab-switch-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

/* Sticker Container */
.nyla-sticker-container {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  animation: stickerBounce 0.5s ease-out;
}

@keyframes stickerBounce {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotate(5deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.nyla-sticker {
  width: 160px;
  height: 160px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid #FF6B35;
}

/* Info Panel */
.nyla-info-panel {
  background: rgba(26, 26, 26, 0.6);
  border-top: 1px solid #333333;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nyla-stats {
  display: none; /* Hidden from UI - stats still work in background for LLM */
  gap: 16px;
  align-items: center;
}

.stats-text {
  font-size: 16px;
  color: #888888;
  display: flex;
  align-items: center;
  gap: 4px;
}

#conversationCount {
  color: #FF6B35;
  font-weight: 600;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  #nylaTab {
    max-height: calc(100vh - 180px);
  }
  
  .nyla-messages {
    max-height: 350px;
    padding: 12px;
  }
  
  .message-content {
    font-size: 16px;
    padding: 10px 12px;
    margin-left: 32px;
  }
  
  .nyla-message.consecutive-message .message-content {
    margin-left: 36px; /* Slightly less margin on mobile */
  }
  
  .nyla-message-user .message-content {
    margin-right: 32px;
  }
  
  .message-avatar {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
  
  .nyla-question-btn {
    font-size: 16px;
    padding: 10px 12px;
    min-height: 40px;
  }
  
  .nyla-questions {
    padding: 12px;
    gap: 8px;
  }
  
  .nyla-sticker {
    width: 120px;
    height: 120px;
  }
  
  .nyla-sticker-container {
    top: 12px;
    right: 12px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .nyla-messages {
    max-height: 300px;
    min-height: 250px;
  }
  
  .message-content {
    margin-left: 28px;
    font-size: 15px;
  }
  
  .nyla-message-user .message-content {
    margin-right: 28px;
  }
  
  .nyla-question-btn {
    font-size: 15px;
    padding: 8px 10px;
    min-height: 36px;
  }
}

/* Dark theme enhancements */
@media (prefers-color-scheme: dark) {
  .nyla-chat-container {
    background: rgba(16, 16, 16, 0.8);
    border-color: #444444;
  }
  
  .message-content {
    background: rgba(32, 32, 32, 0.9);
    border-color: #666666;
  }
  
  .nyla-question-btn {
    background: rgba(32, 32, 32, 0.9);
    border-color: #666666;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .nyla-chat-container {
    border-width: 2px;
  }
  
  .message-content,
  .nyla-question-btn {
    border-width: 2px;
  }
  
  .nyla-question-btn:hover {
    border-width: 3px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .nyla-message,
  .nyla-sticker-container,
  .nyla-question-btn {
    animation: none;
  }
  
  .typing-dots span {
    animation: none;
    opacity: 0.7;
  }
  
  .nyla-question-btn {
    transition: none;
  }
}

/* Focus styles for accessibility */
.nyla-question-btn:focus {
  outline: 2px solid #FF6B35;
  outline-offset: 2px;
}

.nyla-messages:focus {
  outline: 2px solid #FF6B35;
  outline-offset: -2px;
}

/* Loading states */
.nyla-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ===== STREAMING RESPONSE STYLES ===== */

/* Streaming Message */
.nyla-message.streaming {
  animation: streamingPulse 2s ease-in-out infinite;
}

.streaming-content {
  background: rgba(255, 107, 53, 0.05);
  border-left: 3px solid #FF6B35;
  position: relative;
}

.streaming-text {
  display: inline;
}

.streaming-cursor {
  display: inline-block;
  color: #FF6B35;
  font-weight: bold;
  animation: streamingBlink 0.8s infinite;
  margin-left: 2px;
}

@keyframes streamingPulse {
  0%, 100% {
    border-left-color: #FF6B35;
  }
  50% {
    border-left-color: #ff8c5a;
  }
}

@keyframes streamingBlink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* Mobile responsive streaming */
@media (max-width: 768px) {
  .streaming-cursor {
    font-size: 14px;
  }
}

/* Reduced motion for streaming */
@media (prefers-reduced-motion: reduce) {
  .nyla-message.streaming,
  .streaming-cursor {
    animation: none;
  }
  
  .streaming-cursor {
    opacity: 0.7;
  }
}

/* ===== PHASE 2: ENHANCED V2 STYLES ===== */

/* Enhanced Header */
.nyla-enhanced-header {
  background: rgba(42, 42, 42, 0.8);
  border-bottom: 1px solid #333333;
  padding: 12px 16px;
  margin: -16px -16px 16px -16px;
}

.nyla-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 36px;
}

.nyla-debug-toggle {
  flex-shrink: 0;
}

.nyla-debug-close {
  flex-shrink: 0;
}

/* Feature Indicators */
.nyla-feature-indicators {
  display: flex;
  gap: 8px;
  align-items: center;
}

.feature-indicator {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(136, 136, 136, 0.2);
}

.feature-indicator.enabled {
  background: rgba(255, 107, 53, 0.2);
  color: #FF6B35;
  border: 1px solid rgba(255, 107, 53, 0.3);
}

.feature-indicator.disabled {
  background: rgba(136, 136, 136, 0.1);
  color: #666666;
  opacity: 0.5;
}

.feature-indicator:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

/* Timezone Display */
.nyla-timezone {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #888888;
}

.timezone-text {
  background: rgba(136, 136, 136, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid rgba(136, 136, 136, 0.2);
}

/* Personal Care Container */
.nyla-personal-care-container {
  background: rgba(255, 107, 53, 0.1);
  border: 1px solid rgba(255, 107, 53, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  animation: slideInFromBottom 0.3s ease-out;
}

.personal-care-prompt {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.care-message {
  color: #FF6B35;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  margin-bottom: 8px;
}

.care-input-area {
  display: flex;
  gap: 8px;
  align-items: center;
}

.care-input-area input {
  flex: 1;
  background: rgba(26, 26, 26, 0.6);
  border: 1px solid #333333;
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.care-input-area input:focus {
  border-color: #FF6B35;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.care-input-area input::placeholder {
  color: #888888;
}

.care-submit-btn {
  background: #FF6B35;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  min-width: 44px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.care-submit-btn:hover {
  background: #e55a2b;
  transform: scale(1.05);
}

.care-submit-btn:active {
  transform: scale(0.95);
}

/* Quick Care Response Buttons */
.care-quick-responses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

/* WebLLM Loading Screen */
.nyla-llm-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  padding: 20px;
  overflow: hidden !important; /* Hide scrollbars - force override */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  /* Additional scrollbar hiding */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbars on WebKit browsers for loading screen container */
.nyla-llm-loading::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Hide scrollbars on parent containers when loading screen is present */
*:has(.nyla-llm-loading) {
  overflow: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*:has(.nyla-llm-loading)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Alternative: Hide scrollbars on any container with loading screen */
.nyla-chat-messages:has(.nyla-llm-loading),
.messages-container:has(.nyla-llm-loading),
[class*="messages"]:has(.nyla-llm-loading) {
  overflow: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.nyla-chat-messages:has(.nyla-llm-loading)::-webkit-scrollbar,
.messages-container:has(.nyla-llm-loading)::-webkit-scrollbar,
[class*="messages"]:has(.nyla-llm-loading)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Direct class-based scrollbar hiding for loading screen */
.loading-screen-active {
  overflow: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.loading-screen-active::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.llm-loading-content {
  text-align: center;
  max-width: 500px;
  width: 100%;
  overflow: hidden; /* Hide scrollbars on content */
  /* Hide scrollbars on all browsers */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbars on WebKit browsers (Chrome, Safari, Edge) */
.llm-loading-content::-webkit-scrollbar {
  display: none;
}

/* Mobile-specific: Ensure no scrollbars on Android/iOS */
@media screen and (max-width: 768px) {
  .nyla-llm-loading {
    overflow: hidden !important;
    height: auto; /* Auto height for mobile */
    min-height: 350px; /* Minimum height for mobile */
    max-height: calc(100vh - 100px); /* Prevent overflow on mobile */
    padding: 16px; /* Reduce padding on mobile */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  
  .nyla-llm-loading::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  
  .nyla-llm-loading .llm-loading-content {
    overflow: hidden !important;
    max-height: none; /* Remove height restriction */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    padding: 16px; /* Add padding for mobile */
  }
  
  .nyla-llm-loading .llm-loading-content::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  
  /* Mobile-specific loading content sizing */
  .llm-loading-content h3 {
    font-size: 20px;
    margin: 16px 0 8px;
  }
  
  .llm-loading-content .nyla-avatar.loading img {
    width: 60px;
    height: 60px;
  }
  
  .loading-status {
    font-size: 14px;
    margin-bottom: 16px;
  }
  
  .loading-progress {
    margin: 16px 0;
  }
  
  .progress-bar {
    height: 16px;
  }
  
  .progress-text {
    font-size: 13px;
    margin: 8px 0;
  }
  
  .loading-info,
  .loading-tip {
    font-size: 13px;
    margin: 8px 0;
  }
}

/* Extra small mobile devices - specific loading screen fixes */
@media screen and (max-width: 480px) {
  .nyla-llm-loading {
    min-height: 300px;
    padding: 12px;
  }
  
  .nyla-llm-loading .llm-loading-content {
    padding: 12px;
  }
  
  .llm-loading-content h3 {
    font-size: 18px;
    margin: 12px 0 6px;
  }
  
  .llm-loading-content .nyla-avatar.loading img {
    width: 50px;
    height: 50px;
  }
  
  .loading-status {
    font-size: 13px;
    margin-bottom: 12px;
  }
  
  .loading-progress {
    margin: 12px 0;
  }
  
  .progress-bar {
    height: 14px;
  }
  
  .progress-text {
    font-size: 12px;
    margin: 6px 0;
  }
  
  .loading-info,
  .loading-tip {
    font-size: 12px;
    margin: 6px 0;
    line-height: 1.4;
  }
}

/* Loading animation for NYLA avatar */
.nyla-avatar.loading {
  /* Removed pulsing animation for cleaner appearance */
  border-radius: 50%;
  padding: 10px;
}

.nyla-avatar.loading img {
  filter: drop-shadow(0 0 10px rgba(255, 107, 53, 0.3));
}

/* Alternative: bounce animation for avatar */
.nyla-avatar.loading.bounce {
  animation: bounce 1.5s ease-in-out infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Spinning animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Pulsing glow animation */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.6);
    transform: scale(1.05);
  }
}

/* Loading dots animation removed for cleaner loading experience */

.llm-loading-content h3 {
  color: #FF6B35;
  margin: 20px 0 10px;
  font-size: 24px;
}

.loading-status {
  color: #ccc;
  margin-bottom: 20px;
  font-size: 16px;
}

.loading-progress {
  margin: 20px 0;
}

.progress-bar {
  background: #2a2a2a;
  border-radius: 10px;
  height: 20px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  background: linear-gradient(90deg, #FF6B35 0%, #FF8F65 100%);
  height: 100%;
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

/* Animated shimmer effect on progress bar */
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.progress-text {
  color: #888;
  font-size: 14px;
  margin: 10px 0;
}

.loading-info {
  color: #666;
  font-size: 14px;
  margin: 10px 0;
}

.loading-tip {
  color: #888;
  font-size: 14px;
  font-style: italic;
}

.care-quick-btn {
  background: rgba(42, 42, 42, 0.8);
  border: 1px solid #555555;
  border-radius: 16px;
  padding: 6px 12px;
  color: #CCCCCC;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.care-quick-btn:hover {
  background: rgba(255, 107, 53, 0.2);
  border-color: #FF6B35;
  color: #FF6B35;
  transform: translateY(-1px);
}

.care-quick-btn:active {
  transform: translateY(0) scale(0.95);
}

/* Naughty/Playful Response Button Styling */
.care-quick-btn[data-naughty="true"] {
  background: rgba(255, 107, 53, 0.15);
  border: 1px solid rgba(255, 107, 53, 0.4);
  color: #FF6B35;
  position: relative;
  animation: subtleGlow 2s ease-in-out infinite alternate;
}

.care-quick-btn[data-naughty="true"]:hover {
  background: rgba(255, 107, 53, 0.25);
  border-color: #FF6B35;
  color: #FF6B35;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.care-quick-btn[data-naughty="true"]:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

@keyframes subtleGlow {
  0% {
    box-shadow: 0 0 5px rgba(255, 107, 53, 0.2);
  }
  100% {
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.4);
  }
}

/* Enhanced Animations */
@keyframes slideInFromBottom {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 107, 53, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
  }
}

/* Enhanced Message Styles */
.nyla-message.enhanced {
  position: relative;
}

.nyla-message.enhanced::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(135deg, #FF6B35, #ff8c5a);
  border-radius: 2px;
  opacity: 0.7;
}

.nyla-message.personal-care {
  background: rgba(255, 107, 53, 0.05);
  border-left: 3px solid #FF6B35;
  padding-left: 16px;
}

/* Status Messages */
.nyla-temp-status {
  animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
  0% {
    opacity: 0;
    transform: translateX(100px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Enhanced Sticker Styles */
.nyla-sticker-container.enhanced {
  animation: bounceInWithGlow 0.6s ease-out;
}

@keyframes bounceInWithGlow {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(-90deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Mobile Responsive Enhancements */
@media (max-width: 768px) {
  .nyla-enhanced-header {
    padding: 8px 12px;
    margin: -16px -16px 12px -16px;
  }
  
  .nyla-status-bar {
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .nyla-feature-indicators {
    gap: 6px;
    order: 2;
    flex: 1;
    justify-content: center;
  }
  
  .nyla-timezone {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
  }
  
  .nyla-debug-toggle {
    order: 1;
  }
  
  .nyla-debug-close {
    order: 4;
  }
  
  .feature-indicator {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 10px;
  }
  
  .timezone-text {
    font-size: 11px;
    padding: 3px 6px;
  }
  
  .debug-close-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }
  
  .nyla-personal-care-container {
    padding: 12px;
    margin: 12px 0;
  }
  
  .care-input-area {
    gap: 6px;
  }
  
  .care-input-area input {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .care-quick-responses {
    gap: 6px;
  }
  
  .care-quick-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .nyla-status-bar {
    flex-direction: row;
    gap: 6px;
    align-items: center;
    justify-content: space-between;
  }
  
  .nyla-feature-indicators {
    gap: 4px;
    order: 2;
    flex: 1;
    justify-content: center;
  }
  
  .nyla-timezone {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
    margin-top: 4px;
  }
  
  .debug-toggle-btn {
    font-size: 9px;
    padding: 3px 6px;
    margin-left: 2px;
  }
  
  .debug-close-btn {
    width: 18px;
    height: 18px;
    font-size: 11px;
  }
  
  .care-quick-responses {
    flex-direction: column;
    align-items: stretch;
  }
  
  .care-quick-btn {
    text-align: center;
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  .nyla-enhanced-header {
    background: rgba(26, 26, 26, 0.9);
    border-bottom-color: #404040;
  }
  
  .care-input-area input {
    background: rgba(42, 42, 42, 0.8);
    border-color: #404040;
  }
  
  .care-quick-btn {
    background: rgba(26, 26, 26, 0.8);
    border-color: #404040;
  }
}

/* High contrast mode enhancements */
@media (prefers-contrast: high) {
  .feature-indicator.enabled {
    border-width: 2px;
  }
  
  .nyla-personal-care-container {
    border-width: 2px;
  }
  
  .care-submit-btn {
    border: 2px solid #FF6B35;
  }
}

/* Reduced motion enhancements */
@media (prefers-reduced-motion: reduce) {
  .slideInFromBottom,
  .bounceInWithGlow,
  .slideInFromRight {
    animation: none;
  }
  
  .feature-indicator:hover,
  .care-submit-btn:hover,
  .care-quick-btn:hover {
    transform: none;
  }
}

/* Debug Toggle Button */
.debug-toggle-btn {
  background: rgba(42, 42, 42, 0.8);
  border: 1px solid #555555;
  border-radius: 8px;
  padding: 6px 12px;
  color: #CCCCCC;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
  white-space: nowrap;
}

.debug-toggle-btn:hover {
  background: rgba(255, 107, 53, 0.2);
  border-color: #FF6B35;
  color: #FF6B35;
  transform: translateY(-1px);
}

.debug-toggle-btn:active {
  transform: translateY(0) scale(0.95);
}

.debug-toggle-btn.active {
  background: rgba(255, 107, 53, 0.15);
  border-color: #FF6B35;
  color: #FF6B35;
}

.debug-close-btn {
  background: rgba(136, 136, 136, 0.2);
  border: 1px solid #555555;
  border-radius: 6px;
  padding: 4px 8px;
  color: #CCCCCC;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.debug-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

/* Mobile responsive debug toggle */
@media (max-width: 768px) {
  .debug-toggle-btn {
    font-size: 10px;
    padding: 4px 8px;
    margin-left: 6px;
  }
}

@media (max-width: 480px) {
  .debug-toggle-btn {
    font-size: 9px;
    padding: 3px 6px;
    margin-left: 4px;
  }
}

/* ===== ENGAGEMENT SYSTEM STYLES ===== */

/* Engagement Action Buttons */
.engagement-positive {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 140, 90, 0.1));
  border: 1px solid rgba(255, 107, 53, 0.4);
  color: #FF6B35;
  font-weight: 600;
  position: relative;
  animation: engagementPulse 3s ease-in-out infinite;
}

.engagement-positive:hover {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.3), rgba(255, 140, 90, 0.2));
  border-color: #FF6B35;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
}

.engagement-soft-reject {
  background: rgba(136, 136, 136, 0.1);
  border: 1px solid rgba(136, 136, 136, 0.3);
  color: #AAAAAA;
  font-weight: 400;
}

.engagement-soft-reject:hover {
  background: rgba(136, 136, 136, 0.15);
  border-color: #888888;
  color: #CCCCCC;
  transform: translateY(-1px);
}

@keyframes engagementPulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 107, 53, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
  }
}

/* Work Break Display */
.nyla-work-break-container {
  background: rgba(42, 42, 42, 0.8);
  border: 1px solid #333333;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  text-align: center;
  animation: slideInFromBottom 0.5s ease-out;
}

.work-break-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.work-break-icon {
  font-size: 48px;
  animation: workBreakBounce 2s ease-in-out infinite;
}

.work-break-text {
  color: #FF6B35;
  font-weight: 600;
  font-size: 16px;
}

.work-break-progress {
  width: 100%;
  height: 4px;
  background: rgba(136, 136, 136, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #FF6B35, #ff8c5a);
  width: 100%;
  transform-origin: left;
}

@keyframes countdown {
  0% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

@keyframes workBreakBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Knowledge Progress Display Enhancement */
.nyla-info-panel .nyla-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.stats-text {
  text-align: center;
  line-height: 1.4;
}

.stats-text small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
}

/* Enhanced Message Styles for Engagement */
.nyla-message.engagement {
  position: relative;
  background: rgba(255, 107, 53, 0.05);
  border-left: 3px solid #FF6B35;
  padding-left: 16px;
}

.nyla-message.engagement::after {
  content: '🎯';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  opacity: 0.7;
}

/* Mobile Responsive Engagement Styles */
@media (max-width: 768px) {
  .work-break-icon {
    font-size: 36px;
  }
  
  .work-break-text {
    font-size: 14px;
  }
  
  .engagement-positive,
  .engagement-soft-reject {
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .nyla-work-break-container {
    padding: 16px;
    margin: 12px 0;
  }
  
  .work-break-icon {
    font-size: 32px;
  }
  
  .work-break-text {
    font-size: 13px;
  }
  
  .engagement-positive,
  .engagement-soft-reject {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* High contrast mode for engagement */
@media (prefers-contrast: high) {
  .engagement-positive {
    border-width: 2px;
  }
  
  .engagement-soft-reject {
    border-width: 2px;
  }
  
  .nyla-work-break-container {
    border-width: 2px;
  }
}

/* Reduced motion for engagement */
@media (prefers-reduced-motion: reduce) {
  .engagementPulse,
  .workBreakBounce,
  .countdown {
    animation: none;
  }
  
  .engagement-positive:hover,
  .engagement-soft-reject:hover {
    transform: none;
  }
}

.nyla-loading .nyla-question-btn {
  background: rgba(42, 42, 42, 0.4);
  cursor: wait;
}

/* Error states */
.nyla-error .message-content {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.nyla-error .message-avatar {
  background: rgba(239, 68, 68, 0.2);
}

/* Success states */
.nyla-success .message-content {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

/* Welcome message styling */
.nyla-message.welcome .message-content {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 107, 53, 0.05));
  border-color: #FF6B35;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

.nyla-message.welcome .message-avatar {
  background: linear-gradient(135deg, #FF6B35, #ff8c5a);
  color: white;
}

/* NYLA Loading Placeholder */
.nyla-loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #CCCCCC;
  min-height: 200px;
}

.nyla-loading-placeholder .nyla-avatar img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #FF6B35;
  padding: 4px;
  background: rgba(26, 26, 26, 0.8);
  margin-bottom: 16px;
}

.nyla-loading-placeholder p {
  margin: 8px 0 16px 0;
  font-size: 16px;
  color: #BBBBBB;
}

/* Spinner removed - using loading dots instead */

/* iOS-specific NYLA message styling */
.nyla-ios-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  padding: 20px;
}

.nyla-ios-message {
  max-width: 500px;
  text-align: center;
  background: rgba(42, 42, 42, 0.8);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 12px;
  padding: 24px;
  color: #EEEEEE;
}

.nyla-ios-message h3 {
  margin: 0 0 16px 0;
  color: #FF6B35;
  font-size: 20px;
}

.nyla-ios-message p {
  margin: 12px 0;
  line-height: 1.5;
}

.ios-explanation,
.ios-alternatives {
  margin: 16px 0;
  padding: 16px;
  background: rgba(255, 107, 53, 0.1);
  border-radius: 8px;
  text-align: left;
}

.ios-explanation p,
.ios-alternatives p {
  margin: 0 0 8px 0;
  font-weight: 600;
  color: #FF6B35;
}

.ios-explanation ul,
.ios-alternatives ul {
  margin: 8px 0;
  color: #CCCCCC;
}

.ios-explanation li,
.ios-alternatives li {
  margin: 4px 0;
}

@media (max-width: 480px) {
  .nyla-ios-container {
    padding: 16px;
    min-height: 250px;
  }
  
  .nyla-ios-message {
    padding: 20px;
  }
  
  .ios-explanation,
  .ios-alternatives {
    padding: 12px;
  }
}

/* RAG Metadata Styles - As_of badges and source pills */
.rag-metadata {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.as-of-badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(75, 85, 99, 0.6);
  color: #D1D5DB;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  align-self: flex-start;
}

.as-of-badge.volatile {
  background: rgba(251, 191, 36, 0.6);
  color: #1F2937;
}

.source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.source-pill {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  cursor: default;
  transition: opacity 0.2s ease;
}

.source-pill:hover {
  opacity: 0.8;
}

/* Source pill types */
.source-pill.facts {
  background: rgba(34, 197, 94, 0.6);
  color: #1F2937;
}

.source-pill.integration {
  background: rgba(59, 130, 246, 0.6);
  color: #1F2937;
}

.source-pill.marketing {
  background: rgba(168, 85, 247, 0.6);
  color: #1F2937;
}

.source-pill.howto {
  background: rgba(251, 191, 36, 0.6);
  color: #1F2937;
}

.source-pill.policy {
  background: rgba(239, 68, 68, 0.6);
  color: white;
}

.source-pill.ecosystem {
  background: rgba(20, 184, 166, 0.6);
  color: #1F2937;
}

.source-pill.info,
.source-pill.more {
  background: rgba(107, 114, 128, 0.6);
  color: #D1D5DB;
}

/* Verification indicators */
.source-pill.verified {
  border: 1px solid rgba(34, 197, 94, 0.8);
}

.source-pill.unverified {
  border: 1px solid rgba(251, 191, 36, 0.8);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .rag-metadata {
    font-size: 11px;
  }
  
  .source-pill,
  .as-of-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .source-pills {
    gap: 3px;
  }
}

/* ============================================
   URL LINK BUTTONS
   ============================================ */

/* Container for link buttons - if used */
.message-content .link-buttons-container {
  margin-top: 8px;
  margin-bottom: 4px;
  display: inline-block;
  vertical-align: top;
}

/* Individual link button styling */
.message-content .link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin: 0 4px;
  vertical-align: middle;
  background: linear-gradient(135deg, #FF6B35, #FF5722);
  color: #ffffff !important;
  text-decoration: none !important;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.25);
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-content .link-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.35);
  background: linear-gradient(135deg, #e55a2b, #e54a1f);
  color: #ffffff !important;
  text-decoration: none !important;
}

.message-content .link-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(255, 107, 53, 0.3);
}

.message-content .link-button:focus {
  outline: 2px solid rgba(255, 107, 53, 0.5);
  outline-offset: 2px;
}

/* Platform icons */
.link-button .platform-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

/* Platform-specific button colors */
.link-button.platform-twitter {
  background: linear-gradient(135deg, #1DA1F2, #0d8bd9);
}

.link-button.platform-twitter:hover {
  background: linear-gradient(135deg, #0d8bd9, #0a7bc4);
}

.link-button.platform-telegram {
  background: linear-gradient(135deg, #0088cc, #006ba6);
}

.link-button.platform-telegram:hover {
  background: linear-gradient(135deg, #006ba6, #005c8f);
}

.link-button.platform-linktree {
  background: linear-gradient(135deg, #39E09B, #2bc77a);
}

.link-button.platform-linktree:hover {
  background: linear-gradient(135deg, #2bc77a, #22a863);
}

/* Generic links keep orange theme */
.link-button.platform-generic {
  background: linear-gradient(135deg, #FF6B35, #FF5722);
}

.link-button.platform-generic:hover {
  background: linear-gradient(135deg, #e55a2b, #e54a1f);
}

/* Responsive adjustments for link buttons */
@media (max-width: 480px) {
  .message-content .link-button {
    font-size: 12px;
    padding: 6px 10px;
    max-width: 150px;
  }
  
  .link-button .platform-icon {
    font-size: 12px;
  }
  
  .message-content .link-buttons-container {
    margin-top: 6px;
    margin-bottom: 4px;
  }
}

/* Extension popup specific adjustments */
@media (max-width: 400px) {
  .message-content .link-button {
    font-size: 11px;
    padding: 5px 8px;
    max-width: 120px;
  }
  
  .link-button .platform-icon {
    font-size: 11px;
  }
}
