/**
 * Conversation Flow Styles
 * Styles for intelligent follow-up questions and interactive elements
 * 
 * @since 10.6.0
 */

/* ============================================
   Follow-up Question Container
   ============================================ */

.follow-up-question {
  margin: 16px 0;
  padding: 12px 16px;
  background: #f0fdf4;
  border-left: 3px solid #10b981;
  border-radius: 4px;
  animation: subtlePulse 2s ease-in-out infinite;
}

/* Fix for invisible message content - matching theme style */
.follow-up-question .message-content {
  color: #333333 !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-size: 14px;
  line-height: 1.6;
  display: inline-block;
  font-weight: 500;
  font-family: "Adamina", serif !important;
}

.follow-up-question .question-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #10b981 0%, #2d6a4f 100%);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  vertical-align: middle;
}

.follow-up-question .question-icon::after {
  content: "?";
  color: white;
  font-size: 12px;
  font-weight: 600;
}

@keyframes subtlePulse {
  0%,
  100% {
    background-color: #f0fdf4;
    border-left-color: #10b981;
  }
  50% {
    background-color: #e6fbf2;
    border-left-color: #0d9766;
  }
}

/* ============================================
   Quick Response Buttons
   ============================================ */

.quick-responses {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.quick-response-btn {
  flex: 0 0 auto;
  padding: 10px 18px;
  background: #ffffff;
  border: 1.5px solid #10b981;
  border-radius: 6px;
  color: #2d6a4f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Adamina", serif;
  letter-spacing: 0.2px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.quick-response-btn:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #0d9766;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.quick-response-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.2);
}

/* Ripple effect on click */
.quick-response-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s, opacity 0.6s;
  opacity: 0;
  pointer-events: none;
}

.quick-response-btn.clicked::after {
  width: 300px;
  height: 300px;
  opacity: 0;
}

/* Selected state */
.quick-response-btn.selected {
  background: #2d6a4f;
  color: white;
  border-color: #2d6a4f;
  padding-left: 36px;
}

.quick-response-btn.selected::before {
  content: "✓";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: white;
  font-weight: bold;
}

/* Mobile optimization */
@media (max-width: 768px) {
  .quick-responses {
    gap: 8px;
  }

  .quick-response-btn {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
    text-align: center;
  }
}

/* ============================================
   Match Category Tabs
   ============================================ */

.match-categories {
  background: linear-gradient(90deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 10px;
  padding: 4px;
  margin: 20px 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.category-tab {
  flex: 1;
  min-width: fit-content;
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: #666666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.category-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  color: #333333;
}

.category-tab.active {
  background: white;
  color: #1b4332;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.category-tab .badge {
  display: inline-block;
  background: linear-gradient(135deg, #10b981 0%, #2d6a4f 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}

.category-tab.active .badge {
  background: linear-gradient(135deg, #1b4332 0%, #0f2e1f 100%);
  animation: badgePulse 1s ease-in-out;
}

@keyframes badgePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Category content */
.category-content {
  animation: fadeInUp 0.3s ease;
}

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

/* ============================================
   Preference Controls
   ============================================ */

.preference-control {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 10px;
  padding: 20px;
  margin: 16px 0;
  border: 1px solid rgba(224, 224, 224, 0.5);
}

.preference-control h4 {
  margin: 0 0 12px 0;
  color: #1b4332;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preference-slider-container {
  margin: 16px 0;
}

.preference-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  transition: background 0.3s;
}

.preference-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.3);
  transition: transform 0.2s;
}

.preference-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 12px rgba(45, 106, 79, 0.4);
}

.preference-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.3);
  transition: transform 0.2s;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: #666666;
}

/* ============================================
   Refinement Options
   ============================================ */

.refinement-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.refinement-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  color: #333;
}

.refinement-chip:hover {
  border-color: #2d6a4f;
  background: rgba(45, 106, 79, 0.05);
}

.refinement-chip.selected {
  background: #2d6a4f;
  color: white;
  border-color: #2d6a4f;
}

.refinement-chip .icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.refinement-chip.selected .icon {
  opacity: 1;
}

/* ============================================
   Engagement Indicators
   ============================================ */

.engagement-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
}

.engagement-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e0e0e0;
  transition: background 0.3s;
}

.engagement-dot.active {
  background: #10b981;
  animation: dotPulse 1s ease-in-out infinite;
}

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

/* ============================================
   Loading States
   ============================================ */

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(45, 106, 79, 0.1);
  border-radius: 20px;
  font-size: 12px;
  color: #2d6a4f;
  margin: 8px 0;
}

.thinking-indicator .dots {
  display: flex;
  gap: 3px;
}

.thinking-indicator .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #2d6a4f;
  animation: thinking 1.4s ease-in-out infinite;
}

.thinking-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ============================================
   Success/Feedback States
   ============================================ */

.preference-saved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  animation: slideInFade 0.3s ease;
}

@keyframes slideInFade {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.preference-saved .checkmark {
  width: 14px;
  height: 14px;
  background: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: bold;
}

/* ============================================
   Mobile Optimizations
   ============================================ */

@media (max-width: 768px) {
  .match-categories {
    border-radius: 8px;
    padding: 3px;
    margin: 16px -8px;
  }

  .category-tab {
    padding: 10px 14px;
    font-size: 13px;
  }

  .preference-control {
    padding: 16px;
    border-radius: 8px;
  }

  .refinement-options {
    grid-template-columns: 1fr;
  }

  .thinking-indicator {
    font-size: 11px;
    padding: 6px 10px;
  }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
  .follow-up-question {
    background-color: rgba(16, 185, 129, 0.05);
  }

  .quick-response-btn {
    background: #1a1a1a;
    border-color: #333;
    color: #e0e0e0;
  }

  .quick-response-btn:hover {
    background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
    color: white;
  }

  .match-categories {
    background: linear-gradient(90deg, #1a1a1a 0%, #0a0a0a 100%);
  }

  .category-tab {
    color: #999;
  }

  .category-tab.active {
    background: #2a2a2a;
    color: #10b981;
  }

  .preference-control {
    background: #f0fdf4;
    border-color: #333;
  }
}

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

.quick-response-btn:focus,
.category-tab:focus,
.refinement-chip:focus {
  outline: 3px solid #2d6a4f;
  outline-offset: 2px;
}

.quick-response-btn:focus:not(:focus-visible),
.category-tab:focus:not(:focus-visible),
.refinement-chip:focus:not(:focus-visible) {
  outline: none;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
