/**
 * Chat Messenger Upload Interface Styles
 * 
 * Chat-style Thought Session interface with threads, messages, and attachments
 * Supports light and dark themes
 */

/* ==========================================================================
   Theme Variables
   ========================================================================== */

:root {
  /* Dark theme (default) */
  --theme-bg-primary: #0a0a0a;
  --theme-bg-secondary: rgba(255, 255, 255, 0.02);
  --theme-bg-tertiary: rgba(255, 255, 255, 0.05);
  --theme-bg-hover: rgba(255, 255, 255, 0.08);
  --theme-bg-active: rgba(190, 255, 242, 0.15);
  --theme-text-primary: #ffffff;
  --theme-text-secondary: rgba(255, 255, 255, 0.7);
  --theme-text-tertiary: rgba(255, 255, 255, 0.5);
  --theme-text-muted: rgba(255, 255, 255, 0.4);
  --theme-border: rgba(255, 255, 255, 0.08);
  --theme-border-hover: rgba(255, 255, 255, 0.12);
  --theme-accent: #BEFFF2;
  --theme-accent-hover: #A8FFE8;
  --theme-shadow: rgba(0, 0, 0, 0.5);
  --theme-backdrop: rgba(0, 0, 0, 0.8);
}

/* Body background */
body {
  background: var(--theme-bg-primary);
  color: var(--theme-text-primary);
  transition: background 0.3s, color 0.3s;
}

[data-theme="light"] {
  /* Light theme */
  --theme-bg-primary: #ffffff;
  --theme-bg-secondary: #f8f9fa;
  --theme-bg-tertiary: #e9ecef;
  --theme-bg-hover: #dee2e6;
  --theme-bg-active: rgba(93, 173, 226, 0.1);
  --theme-text-primary: #212529;
  --theme-text-secondary: #495057;
  --theme-text-tertiary: #6c757d;
  --theme-text-muted: #adb5bd;
  --theme-border: rgba(0, 0, 0, 0.1);
  --theme-border-hover: rgba(0, 0, 0, 0.15);
  --theme-accent: #BEFFF2;
  --theme-accent-hover: #A8FFE8;
  --theme-shadow: rgba(0, 0, 0, 0.1);
  --theme-backdrop: rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Chat Navigation
   ========================================================================== */

.chat-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--theme-bg-primary);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--theme-border);
  transition: background 0.3s, border-color 0.3s;
}

.chat-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
  padding: 1rem 2rem;
}

.chat-nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-nav-link,
.chat-nav-btn {
  color: var(--theme-text-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-nav-link:hover,
.chat-nav-btn:hover {
  color: var(--theme-text-primary);
  background: var(--theme-bg-hover);
}

#theme-toggle {
  min-width: 40px;
}

/* ==========================================================================
   Chat Layout
   ========================================================================== */

.chat-layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--theme-bg-primary);
  transition: background 0.3s;
}

.chat-main {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1;
  overflow: hidden;
  background: var(--theme-bg-primary);
  transition: background 0.3s;
}

@media (max-width: 768px) {
  .chat-main {
    grid-template-columns: 1fr;
  }
  
  .threads-sidebar {
    display: none;
  }
  
  .threads-sidebar.show-mobile {
    display: flex;
  }
}

/* ==========================================================================
   Threads Sidebar
   ========================================================================== */

.threads-sidebar {
  background: var(--theme-bg-secondary);
  border-right: 1px solid var(--theme-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
  position: relative;
}

.threads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--theme-border);
  transition: border-color 0.3s;
}

.threads-title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--theme-text-primary);
  margin: 0;
  transition: color 0.3s;
}

.new-thread-btn {
  background: var(--theme-bg-active);
  border: 1px solid var(--theme-accent);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--theme-accent);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.new-thread-btn:hover {
  background: var(--theme-bg-active);
  border-color: var(--theme-accent-hover);
  color: var(--theme-accent-hover);
}

.new-note-btn-text {
  display: none;
}

@media (min-width: 769px) {
  .new-note-btn-text {
    display: inline;
  }
}

.threads-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.thread-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.thread-item:hover {
  background: var(--theme-bg-hover);
}

.thread-item.active {
  background: var(--theme-bg-active);
  border-color: var(--theme-accent);
}

.thread-item-content {
  flex: 1;
  min-width: 0;
}

.thread-item-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--theme-text-primary);
  margin: 0 0 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s;
}

.thread-item-preview {
  font-size: 0.8125rem;
  color: var(--theme-text-tertiary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s;
}

.thread-item-time {
  font-size: 0.75rem;
  color: var(--theme-text-muted);
  align-self: flex-start;
  transition: color 0.3s;
}

/* ==========================================================================
   GitHub Sync Status
   ========================================================================== */

.messages-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.github-sync-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 0.875rem;
}

.sync-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sync-status-icon.synced {
  color: #10b981;
}

.sync-status-icon.syncing {
  color: var(--theme-accent, #BEFFF2);
}

.sync-status-icon.syncing svg.spinning {
  animation: spin 1s linear infinite;
}

.sync-status-icon.failed {
  color: #ef4444;
}

.sync-status-icon.not-connected {
  color: rgba(255, 255, 255, 0.5);
}

.sync-status-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-weight: 500;
}

.sync-status-detail {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 0.25rem;
}

.sync-tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--theme-text-secondary);
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 12px var(--theme-shadow);
  pointer-events: none;
}

.sync-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sync-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--theme-accent, #BEFFF2);
}

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

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

.sync-btn.github-linked {
  border: 2px solid var(--theme-accent, #BEFFF2);
}

.sync-btn.github-linked svg path {
  stroke: var(--theme-accent, #BEFFF2);
}

.link-github-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.link-github-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--theme-accent, #BEFFF2);
}

.link-github-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Manual Repository Creation Instructions */
.manual-repo-creation {
  margin-top: 1rem;
  padding: 1.5rem;
  background: var(--theme-bg-secondary);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  position: relative;
}

.manual-repo-content h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--theme-text-primary);
}

.manual-repo-content p {
  margin: 0 0 1rem 0;
  color: var(--theme-text-secondary);
  font-size: 0.9375rem;
}

.manual-repo-content ol {
  margin: 0 0 1.5rem 0;
  padding-left: 1.5rem;
  color: var(--theme-text-secondary);
  font-size: 0.9375rem;
}

.manual-repo-content ol li {
  margin-bottom: 0.5rem;
}

.manual-repo-content code {
  background: var(--theme-bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--theme-accent);
}

.manual-repo-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-create-repo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--theme-accent);
  color: #000;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.btn-create-repo:hover {
  background: var(--theme-accent-hover);
  transform: translateY(-1px);
}

.btn-link-repo {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid var(--theme-border);
  color: var(--theme-text-primary);
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-link-repo:hover {
  background: var(--theme-bg-tertiary);
  border-color: var(--theme-accent);
}

.btn-close-manual {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--theme-text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close-manual:hover {
  background: var(--theme-bg-tertiary);
  color: var(--theme-text-primary);
}

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

/* Note Title Editing */
.thread-item-title {
  position: relative;
}

.thread-item-title.editing {
  padding: 0.25rem 0.5rem;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-accent);
  border-radius: 4px;
  outline: none;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--theme-text-primary);
  width: 100%;
  min-width: 0;
}

.thread-item-title-edit-icon {
  opacity: 0;
  transition: opacity 0.2s;
  margin-left: 0.5rem;
  color: var(--theme-text-tertiary);
  font-size: 0.75rem;
}

.thread-item:hover .thread-item-title-edit-icon {
  opacity: 1;
}

/* User Profile */
.user-profile {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--theme-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--theme-bg-secondary);
  transition: background 0.3s, border-color 0.3s;
}

.user-profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--theme-accent);
  color: #0a0a0a !important; /* Dark color for contrast on SWFT blue */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: background 0.3s;
}

.user-profile-info {
  flex: 1;
  min-width: 0;
}

.user-profile-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--theme-text-primary);
  margin: 0 0 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s;
}

.user-profile-email {
  font-size: 0.75rem;
  color: var(--theme-text-tertiary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s;
}

/* ==========================================================================
   Messages Container
   ========================================================================== */

.messages-container {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--theme-bg-primary);
  transition: background 0.3s;
}

.messages-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--theme-border);
  background: var(--theme-bg-secondary);
  transition: background 0.3s, border-color 0.3s;
}

.messages-header-info {
  max-width: 1000px;
  margin: 0 auto;
}

.messages-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--theme-text-primary);
  margin: 0 0 0.25rem;
  transition: color 0.3s;
}

.messages-subtitle {
  font-size: 0.875rem;
  color: var(--theme-text-tertiary);
  margin: 0;
  transition: color 0.3s;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--theme-bg-primary);
  transition: background 0.3s;
}

.messages-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--theme-text-muted);
  text-align: center;
  transition: color 0.3s;
}

/* ==========================================================================
   Message Bubbles
   ========================================================================== */

.message {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.message-bubble {
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  transition: background 0.3s, border-color 0.3s;
  box-shadow: 0 1px 2px var(--theme-shadow);
}

.message-bubble.has-content {
  padding: 1.25rem;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  position: relative;
}

.message-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.message-menu-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--theme-text-muted);
  transition: color 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-menu-btn:hover {
  color: var(--theme-text-primary);
  background: var(--theme-bg-hover);
}

.message-menu {
  position: fixed;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--theme-shadow);
  padding: 0.5rem 0;
  min-width: 180px;
  z-index: 1000;
  transition: background 0.3s, border-color 0.3s;
}

.message-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  background: transparent;
  border: none;
  color: var(--theme-text-primary);
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  transition: background 0.2s, color 0.2s;
}

.message-menu-item:hover {
  background: var(--theme-bg-hover);
}

.message-menu-item svg {
  flex-shrink: 0;
}

.message-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--theme-border);
}

.message-tag {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: opacity 0.2s;
}

.message-tag:hover {
  opacity: 0.8;
}

.message-author {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--theme-accent);
  transition: color 0.3s;
}

.message-time {
  font-size: 0.75rem;
  color: var(--theme-text-muted);
  transition: color 0.3s;
}

.message-content {
  color: var(--theme-text-primary);
  font-size: 0.9375rem;
  line-height: 1.6;
  word-wrap: break-word;
  transition: color 0.3s;
  margin-bottom: 0.75rem;
}

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

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

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

.message-content code {
  background: var(--theme-bg-hover);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.875em;
  transition: background 0.3s;
}

.message-content pre {
  background: var(--theme-bg-secondary);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  transition: background 0.3s, border-color 0.3s;
}

.message-content {
  margin-bottom: 0.75rem;
}

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

.message-attachments-list {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--theme-border);
  transition: border-color 0.3s;
}

.attachment-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border);
  transition: background 0.3s, border-color 0.3s;
}

.attachment-item.attachment-image {
  max-width: 300px;
  min-width: 150px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  aspect-ratio: 1;
  overflow: hidden;
}

.attachment-item.attachment-image:hover {
  transform: scale(1.02);
  border-color: var(--theme-accent);
}

.attachment-item.attachment-image img,
.attachment-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--theme-backdrop);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--theme-text-primary);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.attachment-item.attachment-image:hover .attachment-overlay {
  opacity: 1;
}

.attachment-overlay svg {
  width: 32px;
  height: 32px;
}

.attachment-overlay span {
  font-size: 0.875rem;
  font-weight: 500;
}

.attachment-item.attachment-audio,
.attachment-item.attachment-video {
  width: 100%;
  max-width: 500px;
}

.attachment-item.attachment-video {
  cursor: pointer;
  max-width: 300px;
  min-width: 200px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
}

.attachment-video-thumbnail {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--theme-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-video-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.8;
}

.attachment-video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  pointer-events: none;
  transition: transform 0.2s, background 0.2s;
}

.attachment-item.attachment-video:hover .attachment-video-play-icon {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(93, 173, 226, 0.9);
}

.attachment-video-label {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.video-duration {
  font-variant-numeric: tabular-nums;
}

.attachment-item.attachment-audio {
  padding: 0;
  border: none;
  background: transparent;
}

.attachment-item.attachment-audio.voice-recording {
  border-color: var(--theme-accent);
}

.attachment-item.attachment-audio audio {
  display: none; /* Hide default audio controls */
}

/* Custom Audio Player */
.audio-player {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--theme-bg-secondary);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  transition: background 0.3s, border-color 0.3s;
}

.audio-player-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--theme-bg-tertiary);
  color: var(--theme-text-primary);
  flex-shrink: 0;
  transition: background 0.3s;
}

.audio-player-icon svg {
  width: 24px;
  height: 24px;
}

.audio-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--theme-bg-tertiary);
  color: var(--theme-text-primary);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
  padding: 0;
}

.audio-play-btn:hover {
  background: var(--theme-bg-hover);
  transform: scale(1.05);
}

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

.audio-play-btn:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

.audio-play-btn svg {
  width: 20px;
  height: 20px;
}

.audio-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audio-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--theme-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.audio-duration {
  font-size: 0.8125rem;
  color: var(--theme-text-secondary);
  transition: color 0.3s;
}

.audio-transcript-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: transparent;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  color: var(--theme-text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.audio-transcript-btn:hover {
  background: var(--theme-bg-active);
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

.audio-transcript-btn:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

.audio-transcript-btn svg,
.audio-transcribe-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.audio-transcribe-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: transparent;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  color: var(--theme-text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.audio-transcribe-btn:hover:not(:disabled) {
  background: var(--theme-bg-active);
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

.audio-transcribe-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.audio-transcribe-btn:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

.audio-transcribe-btn .spinning {
  animation: spin 1s linear infinite;
}

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

/* Attachment Thumbnails/Icons for Message List */
.attachment-thumbnail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--theme-bg-secondary);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  cursor: pointer;
  min-width: 80px;
  max-width: 120px;
}

.attachment-thumbnail:hover {
  background: var(--theme-bg-active);
  border-color: var(--theme-accent);
  transform: translateY(-2px);
}

.attachment-thumbnail-image {
  padding: 0;
  overflow: hidden;
  position: relative;
  min-width: 120px;
  max-width: 200px;
  aspect-ratio: 1;
}

.attachment-thumbnail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: white;
}

.attachment-thumbnail-image:hover .attachment-thumbnail-overlay {
  opacity: 1;
}

.attachment-thumbnail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--theme-bg-tertiary);
  color: var(--theme-text-primary);
  transition: background 0.2s, color 0.2s;
}

.attachment-thumbnail:hover .attachment-thumbnail-icon {
  background: var(--theme-accent);
  color: white;
}

.attachment-thumbnail-icon.audio-icon {
  background: rgba(93, 173, 226, 0.1);
  color: var(--theme-accent);
}

.attachment-thumbnail:hover .attachment-thumbnail-icon.audio-icon {
  background: var(--theme-accent);
  color: white;
}

.attachment-thumbnail-icon.video-icon {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}

.attachment-thumbnail:hover .attachment-thumbnail-icon.video-icon {
  background: #e74c3c;
  color: white;
}

.attachment-thumbnail-icon.file-icon {
  background: rgba(155, 89, 182, 0.1);
  color: #9b59b6;
}

.attachment-thumbnail-icon.file-icon.text-file {
  background: rgba(52, 152, 219, 0.1);
  color: #BEFFF2;
}

.attachment-thumbnail:hover .attachment-thumbnail-icon.file-icon {
  background: #9b59b6;
  color: white;
}

.attachment-thumbnail:hover .attachment-thumbnail-icon.file-icon.text-file {
  background: #BEFFF2;
  color: white;
}

.attachment-thumbnail-label {
  font-size: 0.75rem;
  color: var(--theme-text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: color 0.2s;
}

.attachment-thumbnail:hover .attachment-thumbnail-label {
  color: var(--theme-text-primary);
}

.attachment-item.attachment-file {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  min-width: 200px;
  background: var(--theme-bg-secondary);
}

.attachment-file-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(155, 89, 182, 0.1);
  color: #9b59b6;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.attachment-file-icon.text-file {
  background: rgba(52, 152, 219, 0.1);
  color: #BEFFF2;
}

.attachment-file-icon.code-file {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}

.file-type-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--theme-accent);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  line-height: 1;
}
}

.attachment-file-icon {
  color: var(--theme-text-tertiary);
  flex-shrink: 0;
  transition: color 0.3s;
}

.attachment-file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attachment-file-name {
  color: var(--theme-text-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  word-break: break-word;
  transition: color 0.3s;
}

.attachment-download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--theme-accent);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s;
}

.attachment-download-link:hover {
  color: var(--theme-accent-hover);
}

.message-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.message-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: var(--theme-bg-active);
  border: 1px solid var(--theme-accent);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--theme-accent);
  transition: all 0.3s;
}

/* ==========================================================================
   Message Input Area
   ========================================================================== */

.message-input-container {
  border-top: 1px solid var(--theme-border);
  background: var(--theme-bg-primary);
  backdrop-filter: blur(12px);
  position: relative;
  transition: background 0.3s, border-color 0.3s;
}

.tag-suggestions {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--theme-border);
  background: var(--theme-bg-active);
  transition: background 0.3s, border-color 0.3s;
}

.tag-suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tag-suggestions-header span {
  font-size: 0.875rem;
  color: var(--theme-text-secondary);
  font-weight: 500;
  transition: color 0.3s;
}

.tag-suggestions-close {
  background: none;
  border: none;
  color: var(--theme-text-tertiary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.tag-suggestions-close:hover {
  color: var(--theme-text-primary);
  background: var(--theme-bg-hover);
}

.tag-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-suggestion {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: var(--theme-bg-active);
  border: 1px solid var(--theme-accent);
  border-radius: 16px;
  font-size: 0.8125rem;
  color: var(--theme-accent);
  cursor: pointer;
  transition: all 0.2s;
}

.tag-suggestion:hover {
  background: var(--theme-bg-active);
  border-color: var(--theme-accent-hover);
  color: var(--theme-accent-hover);
}

.tag-suggestion.selected {
  background: var(--theme-accent);
  color: var(--theme-bg-primary); /* Dark text on SWFT blue for better contrast */
  border-color: var(--theme-accent);
}

/* Custom tag colors with proper contrast - applied via JavaScript */
.tag-suggestion.selected[data-tag-color] {
  /* Inline styles will override this, but this ensures fallback */
}

.message-input-form {
  padding: 1.5rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--theme-bg-secondary);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  transition: background 0.3s, border-color 0.3s;
}

.attachment-preview {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border);
  transition: background 0.3s, border-color 0.3s;
}

.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: var(--theme-backdrop);
  border: none;
  border-radius: 4px;
  padding: 0.25rem;
  color: var(--theme-text-primary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.attachment-preview:hover .attachment-preview-remove {
  opacity: 1;
}

.message-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border);
  border-radius: 24px;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s, background 0.3s;
  box-shadow: 0 2px 8px var(--theme-shadow);
}

.message-input-row:focus-within {
  border-color: var(--theme-accent);
}

.attachment-btn {
  background: none;
  border: none;
  color: var(--theme-text-tertiary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-btn:hover {
  color: var(--theme-accent);
  background: var(--theme-bg-active);
}

.message-input-wrapper {
  flex: 1;
  position: relative;
}

.message-input-wrapper.drag-over {
  background: var(--theme-bg-active);
  border: 2px dashed var(--theme-accent);
  border-radius: 8px;
}

/* CodeMirror Editor Styles */
.message-input-wrapper .CodeMirror {
  background: transparent;
  color: var(--theme-text-primary);
  font-size: 0.9375rem;
  line-height: 1.5;
  height: auto;
  min-height: 40px;
  max-height: 150px;
  transition: color 0.3s;
}

.message-input-wrapper .CodeMirror-scroll {
  max-height: 150px;
  overflow-y: auto;
}

.message-input-wrapper .CodeMirror-lines {
  padding: 0;
}

.message-input-wrapper .CodeMirror-cursor {
  border-left: 2px solid var(--theme-accent);
}

.message-input-wrapper .CodeMirror-selected {
  background: var(--theme-bg-active);
}

.message-input-wrapper .CodeMirror-placeholder {
  color: var(--theme-text-muted);
}

.message-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--theme-text-primary);
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 150px;
  overflow-y: auto;
  transition: color 0.3s;
}

.message-input::placeholder {
  color: var(--theme-text-muted);
}

/* Audio Recording Button */
.audio-record-btn {
  background: none;
  border: none;
  color: var(--theme-text-tertiary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-record-btn:hover {
  color: var(--theme-accent);
  background: var(--theme-bg-active);
}

.audio-record-btn.recording {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* Markdown Preview */
.markdown-preview {
  flex: 1;
  padding: 0.75rem;
  background: var(--theme-bg-secondary);
  border-radius: 8px;
  color: var(--theme-text-primary);
  font-size: 0.9375rem;
  line-height: 1.6;
  max-height: 150px;
  overflow-y: auto;
  transition: background 0.3s, color 0.3s;
}

.markdown-preview p {
  margin: 0 0 0.5rem;
}

.markdown-preview p:last-child {
  margin-bottom: 0;
}

.markdown-preview code {
  background: var(--theme-bg-hover);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
  transition: background 0.3s;
}

.markdown-preview pre {
  background: var(--theme-bg-tertiary);
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.5rem 0;
  transition: background 0.3s;
}

.markdown-preview pre code {
  background: transparent;
  padding: 0;
}

.markdown-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 0.5rem 0;
}

.send-btn {
  background: var(--theme-accent);
  border: none;
  color: #0a0a0a !important; /* Dark color for contrast on SWFT blue */
  cursor: pointer;
  padding: 0.625rem;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px var(--theme-shadow);
}

.send-btn svg {
  stroke: #0a0a0a !important; /* Dark color for contrast on SWFT blue */
}

.send-btn:hover {
  background: var(--theme-accent-hover);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: var(--theme-bg-active);
  color: var(--theme-text-tertiary);
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   Attachment Menu
   ========================================================================== */

.attachment-menu {
  position: absolute;
  bottom: 100%;
  left: 2rem;
  margin-bottom: 0.5rem;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-hover);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: 0 8px 32px var(--theme-shadow);
  backdrop-filter: blur(12px);
  z-index: 50;
  transition: background 0.3s, border-color 0.3s;
}

.attachment-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  color: var(--theme-text-secondary);
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 0.9375rem;
}

.attachment-menu-item:hover {
  background: var(--theme-bg-hover);
  color: var(--theme-text-primary);
}

.attachment-menu-item svg {
  flex-shrink: 0;
}

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

.message-sending {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */

.threads-list::-webkit-scrollbar,
.messages-list::-webkit-scrollbar,
.message-input::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.threads-list::-webkit-scrollbar-track,
.messages-list::-webkit-scrollbar-track,
.message-input::-webkit-scrollbar-track {
  background: var(--theme-bg-secondary);
}

.threads-list::-webkit-scrollbar-thumb,
.messages-list::-webkit-scrollbar-thumb,
.message-input::-webkit-scrollbar-thumb {
  background: var(--theme-border);
  border-radius: 4px;
}

.threads-list::-webkit-scrollbar-thumb:hover,
.messages-list::-webkit-scrollbar-thumb:hover,
.message-input::-webkit-scrollbar-thumb:hover {
  background: var(--theme-border-hover);
}

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

@media (max-width: 768px) {
  .chat-nav-container {
    padding: 1rem;
  }
  
  .message-input-form {
    padding: 1rem;
  }
  
  .messages-list {
    padding: 1rem;
  }
  
  .messages-header {
    padding: 1rem;
  }
  
  .attachment-menu {
    left: 1rem;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Transcript Modal
   ========================================================================== */

.transcript-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.transcript-modal[hidden] {
  display: none !important;
}

.transcript-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--theme-backdrop);
  backdrop-filter: blur(4px);
  transition: background 0.3s;
}

.transcript-modal-content {
  position: relative;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px var(--theme-shadow);
  transition: background 0.3s, border-color 0.3s;
}

/* Blog-style reading width */
.transcript-content {
  max-width: 65ch; /* Optimal reading width */
  margin: 0 auto;
  text-align: left;
}

.transcript-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--theme-border);
  transition: border-color 0.3s;
}

.transcript-modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--theme-text-primary);
  margin: 0;
  transition: color 0.3s;
}

.transcript-modal-close {
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: var(--theme-text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.transcript-modal-close:hover {
  background: var(--theme-bg-active);
  color: var(--theme-text-primary);
}

.transcript-modal-close:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

.transcript-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.transcript-content {
  color: var(--theme-text-primary);
  font-size: 1.125rem;
  line-height: 1.85;
  transition: color 0.3s;
  max-width: none;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.transcript-content p {
  margin: 0 0 1.5rem;
  text-align: left;
  word-wrap: break-word;
  hyphens: auto;
}

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

/* First paragraph styling */
.transcript-content p:first-of-type,
.transcript-content .transcript-lead {
  font-size: 1.1875rem;
  line-height: 1.9;
  margin-bottom: 1.75rem;
  color: var(--theme-text-primary);
  font-weight: 400;
}

.transcript-content .transcript-paragraph {
  text-indent: 0;
  margin-bottom: 1.5rem;
}

/* Paragraph spacing for readability */
.transcript-content p + p {
  margin-top: 0;
}

.transcript-content h1 {
  color: var(--theme-text-primary);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 1.5rem;
  transition: color 0.3s;
  letter-spacing: -0.02em;
}

.transcript-content h2 {
  color: var(--theme-text-primary);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  transition: color 0.3s;
  letter-spacing: -0.01em;
}

.transcript-content h3,
.transcript-content h4,
.transcript-content h5,
.transcript-content h6 {
  color: var(--theme-text-primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  transition: color 0.3s;
}

.transcript-content h3 {
  font-size: 1.375rem;
}

.transcript-content h4 {
  font-size: 1.25rem;
}

.transcript-content h5,
.transcript-content h6 {
  font-size: 1.125rem;
}

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

.transcript-content ul,
.transcript-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
  line-height: 1.8;
}

.transcript-content li {
  margin: 0.75rem 0;
  line-height: 1.85;
}

.transcript-content ul {
  list-style-type: disc;
}

.transcript-content ol {
  list-style-type: decimal;
}

.transcript-content li p {
  margin: 0;
}

.transcript-content code {
  background: var(--theme-bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  transition: background 0.3s;
}

.transcript-content pre {
  background: var(--theme-bg-secondary);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
  transition: background 0.3s;
}

.transcript-content pre code {
  background: transparent;
  padding: 0;
}

.transcript-content blockquote {
  border-left: 4px solid var(--theme-accent);
  padding-left: 1.5rem;
  padding-right: 1rem;
  margin: 2rem 0;
  color: var(--theme-text-secondary);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.8;
  transition: color 0.3s, border-color 0.3s;
  background: var(--theme-bg-secondary);
  border-radius: 0 8px 8px 0;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.transcript-content blockquote p {
  margin: 0;
}

.transcript-content blockquote p + p {
  margin-top: 1rem;
}

.transcript-content a {
  color: var(--theme-accent);
  text-decoration: none;
  transition: color 0.2s;
}

.transcript-content a:hover {
  color: var(--theme-accent-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Attachment Preview Modal
   ========================================================================== */

.attachment-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.attachment-modal[hidden] {
  display: none !important;
}

.attachment-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--theme-backdrop);
  backdrop-filter: blur(4px);
  transition: background 0.3s;
}

.attachment-modal-content {
  position: relative;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px var(--theme-shadow);
  transition: background 0.3s, border-color 0.3s;
}

.attachment-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--theme-border);
  transition: border-color 0.3s;
}

.attachment-modal-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--theme-text-primary);
  margin: 0;
  transition: color 0.3s;
}

.attachment-modal-close {
  background: none;
  border: none;
  color: var(--theme-text-tertiary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-modal-close:hover {
  color: var(--theme-text-primary);
  background: var(--theme-bg-hover);
}

.attachment-modal-body {
  flex: 1;
  overflow: auto;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-preview-image {
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}

.attachment-preview-video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
}

.attachment-preview-audio {
  width: 100%;
  max-width: 500px;
}

.attachment-preview-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--theme-text-secondary);
  transition: color 0.3s;
}

.attachment-preview-file svg {
  width: 80px;
  height: 80px;
  color: var(--theme-text-muted);
  transition: color 0.3s;
}

.attachment-preview-file p {
  font-size: 1rem;
  margin: 0;
}

.attachment-modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--theme-border);
  display: flex;
  justify-content: flex-end;
  transition: border-color 0.3s;
}

.attachment-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--theme-bg-active);
  border: 1px solid var(--theme-accent);
  border-radius: 6px;
  color: var(--theme-accent);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s;
}

.attachment-download-btn:hover {
  background: var(--theme-accent);
  border-color: var(--theme-accent);
  color: var(--theme-text-primary);
}

/* ==========================================================================
   Voice Recording UI
   ========================================================================== */

.voice-recording-container {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--theme-border);
  background: var(--theme-bg-secondary);
  transition: background 0.3s, border-color 0.3s;
}

.voice-recording-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.voice-recording-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.voice-recording-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--theme-accent);
  animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.voice-recording-timer {
  font-size: 1rem;
  font-weight: 600;
  color: var(--theme-text-primary);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.voice-recording-stop {
  background: var(--theme-accent);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(1, 255, 24, 0.3);
}

.voice-recording-stop:hover {
  background: var(--theme-accent-hover);
  transform: scale(1.05);
}

.voice-recording-stop:active {
  transform: scale(0.95);
}

.voice-recording-waveform {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 60px;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: var(--theme-bg-tertiary);
  border-radius: 8px;
  transition: background 0.3s;
}

.waveform-bar {
  background: var(--theme-accent);
  border-radius: 2px;
  transition: background 0.3s;
  min-height: 5%;
}

.voice-recording-transcription-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  transition: background 0.3s, border-color 0.3s;
}

.transcription-preview-header {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--theme-text-secondary);
  margin-bottom: 0.75rem;
  transition: color 0.3s;
}

.transcription-preview-content {
  color: var(--theme-text-primary);
  font-size: 0.9375rem;
  line-height: 1.6;
  transition: color 0.3s;
}

.transcription-preview-content p {
  margin: 0 0 0.75rem;
}

.transcription-preview-content p:last-child {
  margin-bottom: 0;
}

/* Focus visible styles */
.attachment-btn:focus-visible,
.send-btn:focus-visible,
.new-thread-btn:focus-visible,
.thread-item:focus-visible,
.attachment-menu-item:focus-visible,
.tag-suggestion:focus-visible,
.audio-record-btn:focus-visible,
#theme-toggle:focus-visible,
.voice-recording-stop:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}
