/* ============================================
   Complete Multimodal AI Styles
   Voice, Video, Audio, and Text Interface
   ============================================ */

.multimodal-ai-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg, 1.5rem);
  background: var(--color-bg-elevated, #ffffff);
  border-radius: var(--radius-xl, 16px);
  padding: var(--space-xl, 2rem);
  border: 2px solid var(--ai-color-start, #667eea);
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
  max-width: 900px;
  margin: 0 auto;
}

/* ============================================
   Control Bar
   ============================================ */

.multimodal-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm, 0.75rem);
  padding: var(--space-lg, 1.5rem);
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.05) 0%,
    rgba(118, 75, 162, 0.05) 100%
  );
  border-radius: var(--radius-lg, 12px);
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.control-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 0.5rem);
  padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
  background: var(--color-bg, #ffffff);
  border: 2px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-lg, 12px);
  color: var(--color-text, #1f2937);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: var(--font-weight-medium, 500);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.control-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(102, 126, 234, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.control-btn:hover::before {
  width: 300px;
  height: 300px;
}

.control-btn:hover {
  border-color: var(--ai-color-start, #667eea);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.control-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.control-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
}

.control-label {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* ============================================
   Video Preview
   ============================================ */

.video-preview-container {
  background: #000;
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.video-header h4 {
  margin: 0;
  font-size: var(--font-size-base, 1rem);
  font-weight: var(--font-weight-semibold, 600);
}

.btn-close-video {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.btn-close-video:hover {
  background: rgba(255, 255, 255, 0.2);
}

#videoElement {
  width: 100%;
  height: auto;
  display: block;
}

.video-controls {
  display: flex;
  gap: var(--space-sm, 0.75rem);
  padding: var(--space-lg, 1.5rem);
  background: rgba(0, 0, 0, 0.8);
}

.btn-capture,
.btn-analyze {
  flex: 1;
  padding: var(--space-md, 1rem);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: var(--font-weight-semibold, 600);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-capture:hover,
.btn-analyze:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ============================================
   Messages Area
   ============================================ */

.multimodal-messages {
  min-height: 400px;
  max-height: 500px;
  overflow-y: auto;
  padding: var(--space-lg, 1.5rem);
  background: var(--color-bg, #f9fafb);
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--color-border, #e5e7eb);
  scroll-behavior: smooth;
}

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

.multimodal-messages::-webkit-scrollbar-track {
  background: transparent;
}

.multimodal-messages::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 4px;
}

.multimodal-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}

.welcome-message {
  text-align: center;
  padding: var(--space-2xl, 3rem) var(--space-lg, 1.5rem);
  color: var(--color-text-secondary, #6b7280);
}

.welcome-message h3 {
  margin: 0 0 var(--space-md, 1rem) 0;
  color: var(--color-text, #1f2937);
  font-size: var(--font-size-xl, 1.25rem);
}

.welcome-message p {
  margin: 0 0 var(--space-lg, 1.5rem) 0;
}

.welcome-message ul {
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  padding-left: var(--space-xl, 2rem);
}

.welcome-message li {
  margin-bottom: var(--space-sm, 0.75rem);
  line-height: 1.6;
}

/* ============================================
   Chat Messages
   ============================================ */

.chat-message {
  display: flex;
  gap: var(--space-sm, 0.75rem);
  margin-bottom: var(--space-lg, 1.5rem);
  animation: messageSlide 0.3s ease;
}

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

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-bold, 700);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-message.user .message-avatar {
  background: var(--color-text, #1f2937);
}

.message-content {
  flex: 1;
  max-width: 70%;
  padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
  background: var(--color-bg-elevated, #ffffff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-lg, 12px);
  color: var(--color-text, #1f2937);
  line-height: 1.6;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md, 8px);
  margin-top: var(--space-sm, 0.75rem);
}

/* ============================================
   Typing Indicator
   ============================================ */

.typing-indicator {
  display: flex;
  gap: var(--space-sm, 0.75rem);
  margin-bottom: var(--space-lg, 1.5rem);
  animation: fadeIn 0.3s ease;
}

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

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
  background: var(--color-bg-elevated, #ffffff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-8px);
  }
}

/* ============================================
   Input Form
   ============================================ */

.multimodal-input-form {
  display: flex;
  gap: var(--space-sm, 0.75rem);
  padding: var(--space-lg, 1.5rem);
  background: var(--color-bg-elevated, #ffffff);
  border-radius: var(--radius-lg, 12px);
  border: 2px solid var(--color-border, #e5e7eb);
  transition: border-color 0.3s;
}

.multimodal-input-form:focus-within {
  border-color: var(--ai-color-start, #667eea);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-wrapper {
  flex: 1;
  display: flex;
  gap: var(--space-sm, 0.75rem);
  align-items: center;
}

.multimodal-input {
  flex: 1;
  padding: var(--space-md, 1rem);
  border: none;
  background: transparent;
  color: var(--color-text, #1f2937);
  font-size: var(--font-size-base, 1rem);
  font-family: inherit;
  outline: none;
}

.multimodal-input::placeholder {
  color: var(--color-text-secondary, #9ca3af);
}

.btn-voice-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--color-border, #e5e7eb);
  background: var(--color-bg, #ffffff);
  color: var(--color-text, #1f2937);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-voice-toggle:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  transform: scale(1.1);
}

.btn-voice-toggle:active {
  transform: scale(0.95);
}

.btn-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-send:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-send:active {
  transform: scale(0.95) rotate(15deg);
}

/* ============================================
   Listening Indicator
   ============================================ */

.listening-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg, 1.5rem);
  padding: var(--space-2xl, 3rem);
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.listening-animation {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 60px;
}

.listening-animation span {
  width: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  animation: wave 1.2s ease-in-out infinite;
}

.listening-animation span:nth-child(1) {
  animation-delay: 0s;
}

.listening-animation span:nth-child(2) {
  animation-delay: 0.1s;
}

.listening-animation span:nth-child(3) {
  animation-delay: 0.2s;
}

.listening-animation span:nth-child(4) {
  animation-delay: 0.3s;
}

@keyframes wave {
  0%,
  100% {
    height: 20px;
  }
  50% {
    height: 60px;
  }
}

.listening-indicator p {
  margin: 0;
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--color-text, #1f2937);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  .multimodal-ai-wrapper {
    padding: var(--space-lg, 1.5rem);
  }

  .control-label {
    display: none;
  }

  .control-btn {
    padding: var(--space-sm, 0.75rem);
  }

  .message-content {
    max-width: 85%;
  }

  .multimodal-messages {
    min-height: 300px;
    max-height: 400px;
  }

  .listening-indicator {
    width: 90%;
    max-width: 320px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .control-btn,
  .chat-message,
  .typing-dots span,
  .listening-animation span {
    animation: none;
    transition: none;
  }
}

.control-btn:focus-visible,
.btn-send:focus-visible,
.btn-voice-toggle:focus-visible,
.multimodal-input:focus-visible {
  outline: 3px solid var(--ai-color-start, #667eea);
  outline-offset: 2px;
}
