/**
 * AI Response Display Styles
 *
 * Displays AI voice responses with two parts:
 * - Voice (prominent, also spoken)
 * - Text (less prominent, additional detail)
 */

.ai-response-display {
  position: fixed;
  bottom: 120px; /* Above any bottom controls */
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  max-width: 600px;
  width: 90%;
  z-index: 9000; /* High z-index to appear above most elements */

  background: var(--surface-color);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 24px 48px 24px 24px; /* Extra padding on right for close button */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Visible state */
.ai-response-display.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hidden state */
.ai-response-display.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

/* Content container */
.ai-response-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Voice part (prominent) */
.ai-response-voice {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 0;
}

/* Text part (less prominent, additional detail) */
.ai-response-text {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
  opacity: 0.85;
  margin: 0;
}

/* Close button */
.ai-response-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.ai-response-close:hover {
  background: var(--hover-background);
  color: var(--text-primary);
}

.ai-response-close:active {
  transform: scale(0.95);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .ai-response-display {
    bottom: 80px;
    width: 95%;
    padding: 20px 44px 20px 20px;
  }

  .ai-response-voice {
    font-size: 18px;
  }

  .ai-response-text {
    font-size: 14px;
  }
}

/* TV mode adjustments */
@media (min-width: 1920px) {
  .ai-response-display {
    max-width: 800px;
    padding: 32px 56px 32px 32px;
    bottom: 140px;
  }

  .ai-response-voice {
    font-size: 24px;
  }

  .ai-response-text {
    font-size: 18px;
  }

  .ai-response-close {
    width: 40px;
    height: 40px;
    font-size: 32px;
  }
}

/* Dark mode specific adjustments */
[data-theme="dark"] .ai-response-display {
  background: var(--surface-color);
  border-color: var(--border-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Light mode specific adjustments */
[data-theme="light"] .ai-response-display {
  background: var(--surface-color);
  border-color: var(--border-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Animation for thinking/loading state (optional, for future use) */
.ai-response-display.thinking .ai-response-voice::after {
  content: '...';
  animation: thinking-dots 1.5s infinite;
}

@keyframes thinking-dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ai-response-display {
    transition: none;
  }

  .ai-response-display.thinking .ai-response-voice::after {
    animation: none;
    content: '...';
  }
}

/* =============================================================================
   IMAGE DISPLAY IN AI RESPONSES
   ============================================================================= */

/* AI Response with image layout */
.ai-response-with-image {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.ai-response-content-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-response-image {
  flex-shrink: 0;
  width: 250px;
  max-width: 35%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-response-image img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  object-fit: cover;
  max-height: 200px;
}

.ai-response-image-attribution {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

.ai-response-image-attribution a {
  color: var(--accent-color);
  text-decoration: none;
}

.ai-response-image-attribution a:hover {
  text-decoration: underline;
}

/* Mobile: Stack image below text */
@media (max-width: 768px) {
  .ai-response-with-image {
    flex-direction: column;
    gap: 1rem;
  }

  .ai-response-image {
    width: 100%;
    max-width: 100%;
  }

  .ai-response-image img {
    max-height: 180px;
  }
}

/* TV mode: Larger image */
@media (min-width: 1920px) {
  .ai-response-image {
    width: 300px;
  }

  .ai-response-image img {
    max-height: 250px;
  }

  .ai-response-image-attribution {
    font-size: 0.75rem;
  }
}
