/* Hide footer on Ask Reed page */
.footer {
  display: none;
}

/* Modern ChatGPT-style design */
.ask-page {
  min-height: calc(100vh - 80px);
  overflow-x: hidden;
}

/* Video container styling */
.video-container {
  --ai-video-size: 250px;
  --ai-video-min-size: 110px;
  width: min(var(--ai-video-size), 100%);
  aspect-ratio: 4 / 5;
  transition:
    width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    aspect-ratio 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s ease,
    background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 3px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.8);
  position: relative;
  display: grid;
  place-items: center;
}

.video-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  border-radius: 21px; /* 24px outer - 3px border width */
  transition: border-radius 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-container.minimized {
  width: var(--ai-video-min-size);
  height: var(--ai-video-min-size);
  min-width: var(--ai-video-min-size);
  min-height: var(--ai-video-min-size);
  max-width: var(--ai-video-min-size);
  max-height: var(--ai-video-min-size);
  flex-shrink: 0;
  border-radius: 50%;
  border-color: transparent;
  background: transparent;
  aspect-ratio: 1 / 1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.video-container.minimized .video-frame {
  border-radius: 50%;
}


.video-container video,
.video-container .video-poster {
  transition: object-position 0.2s ease;
  border-radius: inherit;
}

.video-container.minimized:hover {
  transform: scale(1.05);
}

/* Clear chat pending state */
.video-container.minimized.clear-pending {
  animation: clearPendingPulse 1s ease-in-out infinite;
}

.video-container.minimized.clear-pending::after {
  content: "Press again for a new chat";
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  white-space: nowrap;
  animation: tooltipFadeIn 0.2s ease-out;
  z-index: 10;
}

@keyframes clearPendingPulse {
  0%,
  100% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }

  50% {
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.4);
  }
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  border-radius: inherit;
}

.video-container .video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
}

.video-container .video-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  display: block;
  border-radius: inherit;
}

/* Header styling */
.ask-header {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 2rem 0;
}

.ask-header.minimized {
  padding: 0.75rem 0;
}

.ask-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  transition: all 0.3s ease;
}

.ask-header.minimized h1 {
  font-size: 1rem;
}

.ask-subtitle {
  color: #666;
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

/* Title row with info button */
.ask-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ask-title-row .info-button {
  display: none;
}

/* Info button */
.info-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
  vertical-align: middle;
}

.info-button i,
.info-button svg {
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 14px;
  color: #666;
}

.info-button svg {
  width: 18px;
  height: 18px;
  fill: #666;
  vertical-align: middle;
  display: inline-block;
  position: relative;
  top: -1px;
}

.info-button:hover i,
.info-button:hover svg {
  opacity: 1;
}

/* Info popup */
.info-popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.info-popup-overlay.visible {
  display: flex;
  animation: overlayFadeIn 0.2s ease-out;
}

.info-popup {
  background: #fff;
  border-radius: 16px;
  padding: 0;
  max-width: 520px;
  width: 100%;
  position: relative;
  animation: popupSlideIn 0.25s ease-out;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  text-align: left;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.info-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 1;
}

.info-popup-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.info-popup-close svg {
  width: 18px;
  height: 18px;
  color: #666;
}

.info-popup-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 24px 16px;
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  border-bottom: 1px solid #eee;
}

.info-popup-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.info-popup-icon svg {
  width: 26px;
  height: 26px;
  color: white;
  stroke: white;
}

.info-popup-icon video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-popup-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-popup-title h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}

.info-popup-badge {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-popup-description {
  margin: 0;
  padding: 20px 24px;
  font-size: 1.05rem;
  color: #555;
  line-height: 1.6;
  border-bottom: 1px solid #eee;
  text-align: left;
}

.info-popup-section {
  padding: 16px 24px;
  border-bottom: 1px solid #eee;
}

.info-popup-section:last-of-type {
  border-bottom: none;
}

.info-popup-section h4 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  letter-spacing: 0;
  text-align: left;
}

.info-popup-tech-subtitle {
  margin: 16px 0 8px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.info-popup-tech-subtitle:first-child {
  margin-top: 0;
}

.info-popup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

.info-popup-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  color: #333;
  line-height: 1.5;
  padding: 6px 0;
}

.info-popup-list li .model-name {
  color: #9333ea;
  font-weight: 600;
}

.info-popup-list li svg {
  width: 18px;
  height: 18px;
  color: #22c55e;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-popup-list.limitations li svg {
  color: #f59e0b;
}

/* Model badge in info popup */
.model-badge {
  display: inline-block;
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 4px;
  vertical-align: middle;
}

.info-popup-footer {
  padding: 16px 24px;
  background: #fafafa;
  border-top: 1px solid #eee;
}

.info-popup-model {
  font-size: 0.85rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-popup-model::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
}

/* Chat messages container */
#chatMessages {
  padding: 1rem 0;
  scroll-behavior: smooth;
  overflow-anchor: none;
}

/* Message styling */
.message-row {
  display: flex;
  gap: 12px;
  /* padding: 1rem 0; */
  animation: fadeSlideIn 0.3s ease-out;
}

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

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.message-avatar.assistant-avatar {
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  color: white;
  overflow: hidden;
}

.message-avatar.assistant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-avatar.user-avatar {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: white;
}

.message-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-content.user-message {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-content.assistant-message {
  background: #f0f0f0;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.message-content.loading-message {
  background: white;
  padding: 0;
  min-width: auto;
  display: inline-flex;
  align-items: center;
  border-radius: 0;
  max-width: none;
}

/* Modern thinking indicator - simple inline style matching the thinking toggle */
.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #777;
}

.thinking-indicator-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.thinking-indicator-text {
  animation: thinkingPulse 1.5s ease-in-out infinite;
}

@keyframes thinkingPulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.thinking-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
}

.thinking-dots span {
  width: 4px;
  height: 4px;
  background: #888;
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

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

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

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

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

/* Streaming text animation - initial message appearance */
.message-content.assistant-message.streaming {
  animation: messageFadeIn 0.6s ease-out;
}

@keyframes messageFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-content.error-message {
  background: #fee2e2;
  color: #dc2626;
  text-align: center;
}

/* Redirect indicator */
.redirect-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  color: white;
  border-radius: 20px;
  font-size: 0.85rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.redirect-indicator svg {
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

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

  50% {
    opacity: 0.7;
  }
}

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

  to {
    transform: rotate(360deg);
  }
}

.message-content a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  transition: text-decoration-color 0.2s;
}

.message-content.assistant-message a {
  color: #0066cc;
  text-decoration-color: rgba(0, 102, 204, 0.3);
}

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

/* Markdown styling for assistant messages */
.message-content.assistant-message {
  white-space: normal;
}

.message-content.assistant-message p {
  margin: 0 0 0.75em 0;
}

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

.message-content.assistant-message code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
  font-size: 0.875em;
}

.message-content.assistant-message pre {
  background: #1a1a1a;
  color: #e5e5e5;
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.75em 0;
  font-size: 0.85em;
}

.message-content.assistant-message pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.message-content.assistant-message ul,
.message-content.assistant-message ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.message-content.assistant-message li {
  margin: 0.25em 0;
}

.message-content.assistant-message blockquote {
  border-left: 3px solid #0066cc;
  margin: 0.75em 0;
  padding: 0.25em 0 0.25em 1em;
  color: #555;
}

.message-content.assistant-message h1,
.message-content.assistant-message h2,
.message-content.assistant-message h3,
.message-content.assistant-message h4 {
  margin: 0.75em 0 0.5em 0;
  font-weight: 600;
  line-height: 1.3;
}

.message-content.assistant-message h1:first-child,
.message-content.assistant-message h2:first-child,
.message-content.assistant-message h3:first-child,
.message-content.assistant-message h4:first-child {
  margin-top: 0;
}

.message-content.assistant-message h1 {
  font-size: 1.25em;
}

.message-content.assistant-message h2 {
  font-size: 1.15em;
}

.message-content.assistant-message h3 {
  font-size: 1.05em;
}

.message-content.assistant-message h4 {
  font-size: 1em;
}

.message-content.assistant-message strong {
  font-weight: 600;
}

.message-content.assistant-message em {
  font-style: italic;
}

.message-content.assistant-message hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1em 0;
}

.message-content.assistant-message table {
  border-collapse: collapse;
  margin: 0.75em 0;
  font-size: 0.9em;
  width: 100%;
}

.message-content.assistant-message th,
.message-content.assistant-message td {
  border: 1px solid #ddd;
  padding: 0.5em 0.75em;
  text-align: left;
}

.message-content.assistant-message th {
  background: rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

/* Input area */
.input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent 0%, #ffffff 20%);
  padding: 1.5rem 1rem 1.5rem;
  z-index: 100;
}

.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.input-container {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.input-container:focus-within {
  border-color: #0066cc;
  box-shadow: 0 4px 24px rgba(0, 102, 204, 0.15);
}

.input-container input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  padding: 12px 0;
  background: transparent;
  color: #1a1a1a;
}

.input-container input::placeholder {
  color: #999;
}

.send-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.send-button.voice-mode-ready {
  background: #0052a3;
  color: #ffffff;
  border: none;
}

.send-button.voice-mode-ready:hover:not(:disabled) {
  background: #004080;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 82, 163, 0.35);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-button svg {
  width: 20px;
  height: 20px;
}

/* Voice button */
.voice-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-right: 4px;
  position: relative;
}

.voice-button:hover:not(:disabled) {
  color: #1a1a1a;
  background: #f0f0f0;
}

.voice-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.voice-button svg {
  width: 20px;
  height: 20px;
}

.voice-button.connecting {
  color: #d97706;
  background: #fef3c7;
  cursor: wait;
}

.voice-button.connecting .mic-icon,
.voice-button.connecting .stop-icon {
  display: none;
}

.voice-button.connecting::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(217, 119, 6, 0.3);
  border-top-color: #d97706;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.voice-button.recording {
  color: #dc2626;
  background: #fee2e2;
  animation: voicePulse 1.5s ease-in-out infinite;
}

.voice-button.transcribing {
  color: #16a34a;
  background: #dcfce7;
  animation: voiceTranscribePulse 1.2s ease-in-out infinite;
}

.voice-button.transcribing .mic-icon {
  animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes voiceTranscribePulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
  }
}

@keyframes micPulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

@keyframes voicePulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
  }
}

/* Send button spinner state */
.send-button.loading svg {
  display: none;
}

.send-button.loading::after {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.send-button .stop-gen-icon {
  display: none;
}

.send-button.stopping {
  background: #e0e0e0;
  color: #000000;
  border: none;
}

.send-button.stopping:hover:not(:disabled) {
  background: #cccccc;
  color: #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.send-button.stopping .send-icon,
.send-button.stopping .voice-mode-icon {
  display: none;
}

.send-button.stopping .stop-gen-icon {
  display: block;
  transform: none;
}

/* Suggestion chips */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 1.5rem;
  padding: 0 1rem;
  transition: opacity 0.3s ease;
}

.suggestion-chip {
  background: white;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 0.9rem;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-chip:hover {
  background: #f5f5f5;
  border-color: #e5e5e5;
}

/* Inline contact form (in chat) */
.inline-contact-form {
  background: #f0f0f0;
  border-bottom-left-radius: 4px;
  max-width: 400px;
  white-space: normal;
}

.inline-form-header {
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline-form-email,
.inline-form-message {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  box-sizing: border-box;
  background: white;
}

.inline-form-email:focus,
.inline-form-message:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.inline-form-message {
  min-height: 80px;
  resize: vertical;
}

.inline-form-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.inline-form-buttons .btn-discard,
.inline-form-buttons .btn-send {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.inline-form-buttons .btn-discard {
  background: white;
  border: 1px solid #ddd;
  color: #666;
}

.inline-form-buttons .btn-discard:hover {
  background: #f5f5f5;
  color: #333;
}

.inline-form-buttons .btn-send {
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  border: none;
  color: white;
}

.inline-form-buttons .btn-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.inline-form-buttons .btn-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Command action overlay (redirect) */
.command-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  box-sizing: border-box;
}

.command-overlay.visible {
  display: flex;
  animation: overlayFadeIn 0.2s ease-out;
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.command-overlay-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: iconPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes iconPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.command-overlay-icon svg {
  width: 32px;
  height: 32px;
  color: white;
  stroke: white;
  fill: none;
}

.command-overlay-icon.redirect svg {
  animation: arrowSlide 0.6s ease-in-out infinite;
}

@keyframes arrowSlide {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(4px);
  }
}

.command-overlay-icon.newchat svg {
  animation: newchatSpin 0.6s ease-out;
}

@keyframes newchatSpin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.command-overlay-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: #1a1a1a;
  animation: textFadeIn 0.3s ease-out 0.1s both;
}

.command-overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.command-overlay-close:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: scale(1.05);
}

.command-overlay-close svg {
  width: 18px;
  height: 18px;
}

@keyframes textFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .video-container {
    --ai-video-size: 200px;
    --ai-video-min-size: 84px;
  }

  .message-content {
    max-width: 85%;
    font-size: 0.9rem;
  }

  .ask-header h1 {
    font-size: 1.5rem;
  }

  .suggestions {
    gap: 6px;
  }

  .suggestion-chip {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .suggestion-chip:nth-child(3) {
    display: none;
  }

  /* Sticky header on mobile */
  .ask-header.minimized {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin: 0;
    padding: 0.5rem 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ask-header.minimized .video-container {
    margin: 0;
  }

  .ask-header.minimized p {
    display: none;
  }

  .ask-header.minimized .ask-subtitle {
    display: none;
  }

  /* Info popup mobile fixes */
  .info-popup-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
    padding-top: 32px;
    overflow-y: auto;
  }

  .info-popup {
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    margin: 0;
  }
}

/* Sources Citation Styles */
.sources-row {
  padding-top: 0;
  padding-bottom: 0;
  margin-top: -0.5rem;
}

.sources-citation {
  max-width: 70%;
}

.sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  font-size: 0.8rem;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sources-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #333;
}

.sources-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.chevron-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sources-citation.expanded .chevron-icon {
  transform: rotate(180deg);
}

.sources-list {
  display: block;
  margin-top: 10px;
  background: #fafafa;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease;
}

.sources-citation.expanded .sources-list {
  max-height: 300px;
  overflow-y: auto;
  opacity: 1;
}

.sources-list::-webkit-scrollbar {
  width: 4px;
}

.sources-list::-webkit-scrollbar-track {
  background: transparent;
}

.sources-list::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.sources-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

@keyframes sourcesSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.source-item {
  padding: 12px 14px;
  font-size: 0.85rem;
  color: #555;
  transition: background 0.15s ease;
}

.source-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.source-item:not(:last-child) {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

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

.source-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.source-header {
  color: #1a1a1a;
  font-weight: 600;
  font-size: 0.85rem;
}

.source-snippet {
  color: #666;
  font-size: 0.8rem;
  line-height: 1.5;
  padding-left: 28px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (max-width: 768px) {
  .sources-citation {
    max-width: 90%;
  }

  .source-snippet {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
}

/* Edit button row */
.edit-button-row {
  padding-top: 0;
  padding-bottom: 0;
  margin-top: -0.5rem;
  justify-content: flex-end;
}

/* Hide edit buttons during generation */
#chatMessages.generating .edit-button-row {
  visibility: hidden;
  pointer-events: none;
}

/* Edit message button */
.edit-message-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  opacity: 0;
}

.edit-button-row:hover .edit-message-btn,
.message-row.user-row:hover + .edit-button-row .edit-message-btn {
  opacity: 1;
}

.edit-message-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #555;
}

.edit-message-btn svg {
  width: 14px;
  height: 14px;
}

/* Edit message form */
.edit-message-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 70%;
  width: 100%;
}

.edit-message-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #0066cc;
  border-radius: 18px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
  min-height: 44px;
  box-sizing: border-box;
  background: white;
  color: #1a1a1a;
}

.edit-message-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.edit-message-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.edit-cancel-btn,
.edit-submit-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-cancel-btn {
  background: #f0f0f0;
  border: 1px solid #ddd;
  color: #666;
}

.edit-cancel-btn:hover {
  background: #e5e5e5;
  color: #333;
}

.edit-submit-btn {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  border: none;
  color: white;
}

.edit-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

/* Mobile adjustments for edit button */
@media (max-width: 768px) {
  .edit-message-btn {
    opacity: 1;
  }

  .edit-message-form {
    max-width: 85%;
  }

  .edit-button-row {
    justify-content: flex-end;
  }
}

/* Message Action Buttons */
.message-actions-row {
  padding-top: 0;
  padding-bottom: 0.5rem;
  margin-top: -0.5rem;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #555;
}

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

.action-btn svg {
  width: 16px;
  height: 16px;
}

.action-btn.active {
  color: #0066cc;
}

.action-btn.active.thumbs-down {
  color: #dc2626;
}

/* Copy button success state */
.action-btn.copied {
  color: #16a34a;
}

/* Action button tooltip */
.action-btn {
  position: relative;
}

.action-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.15s,
    visibility 0.15s;
  pointer-events: none;
  margin-bottom: 4px;
  z-index: 1000;
  width: max-content;
  max-width: 200px;
}

.action-btn:first-child::before {
  left: 0;
  transform: translateX(0);
}

.action-btn:hover::before {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .message-actions {
    opacity: 1;
  }

  .action-btn::before {
    display: none;
  }
}

.thinking-block {
  font-style: italic;
  color: #666;
  border-left: 2px solid #ddd;
  padding-left: 0.5rem;
  margin-bottom: 0rem;
  margin-left: 0.5rem;
  font-size: 0.9em;
  opacity: 0.8;
  word-break: break-word;
}

.thinking-block:empty {
  display: none;
}

.thinking-block blockquote {
  border-left: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.message-row {
  display: flex;
  gap: 12px;
  padding: 0.5rem 0;
  animation: fadeSlideIn 0.3s ease-out;
  flex-wrap: wrap;
}

/* Collapsible thinking wrapper */
.thinking-wrapper {
  width: 100%;
  margin-bottom: -0.25rem;
  padding-left: 0;
  order: -1;
  /* Above everything else in the row */
}

/* Shift everything else down */
.message-avatar,
.message-content {
  order: 0;
}

.thinking-toggle {
  margin-left: 0.5rem;
  /* 36px avatar + 12px gap */
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 400;
  color: #777;
  cursor: pointer;
  transition: color 0.2s ease;
  margin-bottom: 2px;
  user-select: none;
}

.thinking-toggle:hover {
  color: #555;
  background: none;
}

.thinking-toggle-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.thinking-toggle .chevron-icon {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.thinking-wrapper.expanded .thinking-toggle .chevron-icon {
  transform: rotate(180deg);
}

.thinking-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease;
}

.thinking-wrapper.expanded .thinking-content {
  max-height: 400px;
  overflow-y: auto;
  opacity: 1;
}

.thinking-content::-webkit-scrollbar {
  width: 4px;
}

.thinking-content::-webkit-scrollbar-track {
  background: transparent;
}

.thinking-content::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.thinking-content .thinking-block {
  margin-bottom: 0;
}

/* Streaming thinking wrapper styles */
.thinking-wrapper.streaming-thinking .thinking-toggle {
  cursor: default;
}

.thinking-wrapper.streaming-thinking .thinking-toggle:hover {
  color: #888;
}

.thinking-wrapper.streaming-thinking .thinking-content {
  max-height: 400px;
  overflow-y: auto;
  opacity: 1;
}

.thinking-wrapper.streaming-thinking .chevron-icon {
  display: none;
}

/* Hide assistant message bubble and actions while thinking is still streaming */
.thinking-wrapper.streaming-thinking ~ .message-content.assistant-message {
  display: none;
}

.message-row:has(.streaming-thinking) + .message-actions-row {
  display: none;
}

/* Ensure markdown body doesn't have extra margin if it follows a thinking block */
.thinking-block + .markdown-body,
.thinking-wrapper + .markdown-body {
  margin-top: 0.25rem;
}

/* Message Queue Indicator */
.queue-indicator {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 0.85rem;
  color: #555;
}

.queue-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #888;
  font-weight: 500;
}

.queue-header svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  animation: queueSpin 1.5s linear infinite;
}

.queue-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-message-preview {
  display: block;
  padding: 6px 10px;
  background: white;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

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

@media (max-width: 768px) {
  .queue-indicator {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .queue-message-preview {
    font-size: 0.8rem;
  }
}

/* ============================================
   VOICE MODE STYLES
   ============================================ */

/* Voice Mode Overlay */
.voice-mode-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
  /* Must stack above the mobile navbar brand/toggler (z-index 1020 in main.css),
     otherwise the hamburger icon overlaps and swallows taps on the close button. */
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: voiceOverlayFadeIn 0.3s ease-out;
}

.voice-mode-overlay.active {
  display: flex;
}

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

/* Close button */
.voice-mode-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.voice-mode-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.voice-mode-close:active {
  transform: scale(0.95);
}

.voice-mode-close svg {
  width: 28px;
  height: 28px;
}

/* State-aware close button glow */
.voice-mode-overlay[data-state="listening"] .voice-mode-close:hover {
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.voice-mode-overlay[data-state="transcribing"] .voice-mode-close:hover {
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.voice-mode-overlay[data-state="thinking"] .voice-mode-close:hover {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.voice-mode-overlay[data-state="speaking"] .voice-mode-close:hover {
  box-shadow: 0 0 20px rgba(0, 102, 204, 0.5);
}

/* Voice Orb Container */
.voice-orb-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 32px;
}

.voice-orb {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.voice-orb:hover {
  transform: scale(1.02);
}

.voice-orb-inner {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  overflow: hidden;
  background: #333;
}

.voice-orb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Orb ring - animated based on state */
.voice-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

/* Pulse effect */
.voice-orb-pulse {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid transparent;
  opacity: 0;
}

/* State-specific orb styles */
.voice-mode-overlay[data-state="listening"] .voice-orb-ring {
  border-color: #22c55e;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
  animation: orbListening 1.5s ease-in-out infinite;
}

.voice-mode-overlay[data-state="listening"] .voice-orb-pulse {
  border-color: #22c55e;
  animation: orbPulse 2s ease-out infinite;
}

.voice-mode-overlay[data-state="transcribing"] .voice-orb-ring {
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
  animation: orbProcessing 0.8s linear infinite;
}

.voice-mode-overlay[data-state="thinking"] .voice-orb-ring {
  border-color: #8b5cf6;
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.4);
  animation: orbThinking 1.2s ease-in-out infinite;
}

.voice-mode-overlay[data-state="speaking"] .voice-orb-ring {
  border-color: #0066cc;
  box-shadow: 0 0 30px rgba(0, 102, 204, 0.5);
  animation: orbSpeaking 0.4s ease-in-out infinite;
}

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

@keyframes orbPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@keyframes orbProcessing {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes orbThinking {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

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

/* State text container */
.voice-state-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 20px;
  min-height: 40px;
  transition: opacity 0.3s ease;
}

/* Voice live transcript box */
.voice-transcript {
  max-width: 80%;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  min-height: 2.5rem;
  max-height: 7.5rem;
  overflow-y: auto;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(0.625rem);
  border: 0.0625rem solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  margin-bottom: 1.25rem;
}

.voice-transcript:empty {
  opacity: 0;
  border-color: transparent;
  background: transparent;
}

.voice-state-text .state-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  opacity: 0.9;
}

.voice-state-text .state-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Ellipsis animation dots */
.ellipsis-dots {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  padding-top: 6px;
}

.ellipsis-dots span {
  width: 8px;
  height: 8px;
  background-color: currentColor;
  border-radius: 50%;
  animation: ellipsisPulse 1.4s ease-in-out infinite;
}

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

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

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

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

/* State-specific icon animations */
.voice-mode-overlay[data-state="idle"] .state-icon {
  animation: spin 1s linear infinite;
}

.voice-mode-overlay[data-state="listening"] .state-icon {
  animation: iconPulse 2s ease-in-out infinite;
}

.voice-mode-overlay[data-state="thinking"] .state-icon {
  display: none;
}

.voice-mode-overlay[data-state="speaking"] .state-icon {
  display: none;
}

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

@keyframes iconRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

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

/* Interrupt button */
.voice-interrupt-btn {
  position: absolute;
  bottom: 80px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  background: rgba(107, 114, 128, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.voice-interrupt-btn.visible {
  display: flex;
  animation: interruptPulse 2s ease-in-out infinite;
}

.voice-interrupt-btn:hover {
  background: rgba(5, 84, 163, 0.95);
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 25px rgba(5, 84, 163, 0.4);
}

.voice-interrupt-btn:active {
  transform: scale(0.98);
}

.voice-interrupt-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Pulse animation for interrupt button */
@keyframes interruptPulse {
  0%,
  100% {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 4px 25px rgba(5, 84, 163, 0.5);
  }
}

/* Send button voice mode icon toggle */
.send-button .voice-mode-icon {
  display: none;
  transform: none; /* Reset the transform from .send-button svg */
  width: 24px;
  height: 24px;
}

.send-button.voice-mode-ready .send-icon {
  display: none;
}

.send-button.voice-mode-ready .voice-mode-icon {
  display: block;
}

.send-button.voice-mode-ready.stopping .voice-mode-icon {
  display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .voice-orb-container {
    width: 160px;
    height: 160px;
  }

  .voice-mode-close {
    width: 48px;
    height: 48px;
    top: 16px;
    right: 16px;
  }

  .voice-mode-close svg {
    width: 24px;
    height: 24px;
  }

  .voice-state-text {
    font-size: 1.1rem;
    gap: 10px;
    min-height: 36px;
  }

  .voice-state-text .state-icon {
    width: 20px;
    height: 20px;
  }

  .voice-interrupt-btn {
    bottom: 60px;
    padding: 12px 24px;
    font-size: 1rem;
  }

  .voice-interrupt-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Fade-in animation for streamed text blocks */
@keyframes fadeInBlock {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-block {
  animation: fadeInBlock 0.25s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

/* Fade-in animation for individual words */
@keyframes fadeInWord {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in-word {
  animation: fadeInWord 0.15s ease-out forwards;
}

/* Voice Alert Toast */
.voice-alert-toast {
  position: absolute;
  top: -120px; /* Hidden initially, slides down */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 18px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: 420px;
  width: calc(100% - 48px);
  z-index: 1002;
  transition: top 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.voice-alert-toast.visible {
  top: 96px; /* Sits below the close button on mobile */
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 769px) {
  .voice-alert-toast.visible {
    top: 24px; /* Centered top on desktop */
  }
}

.voice-alert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: rgba(56, 139, 253, 0.15);
  border-radius: 50%;
  color: #58a6ff;
}

.voice-alert-icon svg {
  width: 18px;
  height: 18px;
}

.voice-alert-content {
  flex-grow: 1;
  text-align: left;
}

.voice-alert-title {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.voice-alert-message {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  line-height: 1.4;
}

.voice-alert-dismiss {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background-color 0.2s;
  border-radius: 50%;
}

.voice-alert-dismiss:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
}

.voice-alert-dismiss svg {
  width: 16px;
  height: 16px;
}

/* Retry Button styling */
.retry-button-row {
  padding-top: 0.25rem;
  padding-bottom: 0.5rem;
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: flex-end;
  animation: messageFadeIn 0.3s ease-out;
}

/* Hide retry button during generation */
#chatMessages.generating .retry-button-row {
  visibility: hidden;
  pointer-events: none;
}

.retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(220, 38, 38, 0.04);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.05);
}

.retry-btn:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.retry-btn:active {
  transform: translateY(0);
}

.retry-btn svg.retry-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.retry-btn:hover svg.retry-icon {
  transform: rotate(180deg);
}

/* Voice transcript message turn styling */
.voice-message-turn .message-content {
  font-style: italic;
}

