/* Email Modals - Shared styles for email-related modals */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 0.5rem;
}

.modal {
  background: #161b22;
  color: #f0f6fc;
  border-radius: 8px;
  width: 98vw;
  height: 95vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Research Modal Specific Styles */
.research-modal {
  width: 90vw;
  max-width: 800px;
  height: 80vh;
  max-height: 600px;
}

/* Processing Modal Specific Styles */
.processing-modal {
  width: 90vw;
  max-width: 600px;
  height: auto;
  max-height: 80vh;
}

.processing-modal-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.processing-info h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #f0f6fc;
}

.processing-info > p {
  margin: 0 0 2rem 0;
  color: #c9d1d9;
  font-size: 0.875rem;
  line-height: 1.5;
}

.processing-options {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.processing-option {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.2s ease;
}

.processing-option:hover {
  border-color: #484f58;
  background: #161b22;
}

.option-info {
  flex: 1;
}

.option-info h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #f0f6fc;
}

.option-info p {
  margin: 0;
  color: #8b949e;
  font-size: 0.875rem;
  line-height: 1.5;
}

.processing-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
  min-width: 160px;
  justify-content: center;
  text-align: center;
}

.processing-btn.primary {
  background: #238636;
  border: 1px solid #238636;
  color: #f0f6fc;
}

.processing-btn.primary:hover:not(:disabled) {
  background: #2ea043;
  border-color: #2ea043;
}

.processing-btn.secondary {
  background: #21262d;
  border: 1px solid #484f58;
  color: #c9d1d9;
}

.processing-btn.secondary:hover:not(:disabled) {
  background: #30363d;
  border-color: #58a6ff;
  color: #f0f6fc;
}

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

/* ========================================
   REDESIGNED RESEARCH MODAL - MODERN UX
   ======================================== */

/* Modal Container - Completely Independent */
.research-modal-redesigned {
  /* Reset any inherited styles */
  all: initial;
  
  /* Modal positioning and structure */
  width: 90vw;
  max-width: 900px;
  height: auto;
  max-height: 90vh;
  background: #161b22;
  color: #f0f6fc;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  border: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  
  /* Explicit font stack to prevent inheritance */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  
  /* Box model reset */
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Comprehensive reset for all research modal children to prevent email styling inheritance */
.research-modal-redesigned * {
  box-sizing: border-box;
}

.research-modal-redesigned h1,
.research-modal-redesigned h2, 
.research-modal-redesigned h3,
.research-modal-redesigned h4,
.research-modal-redesigned h5,
.research-modal-redesigned h6 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  color: #f0f6fc;
  margin: 0;
  line-height: 1.25;
  text-decoration: none;
  text-transform: none;
}

.research-modal-redesigned p {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  line-height: 1.5;
  color: inherit;
  text-decoration: none;
}

.research-modal-redesigned div {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

/* Enhanced Header */
.research-modal-redesigned .research-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid #30363d;
  background: linear-gradient(135deg, #161b22 0%, #1c2128 100%);
  position: relative;
  box-sizing: border-box;
}

.research-modal-redesigned .research-modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #58a6ff, #1f6feb, #58a6ff);
}

.research-modal-redesigned .research-header-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.research-modal-redesigned .research-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.research-modal-redesigned .research-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: -0.025em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  text-decoration: none;
  text-transform: none;
}

.research-modal-redesigned .research-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: #8b949e;
  font-weight: 400;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  text-decoration: none;
  text-transform: none;
}

.research-modal-redesigned .sender-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.research-modal-redesigned .sender-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #58a6ff, #1f6feb);
  border-radius: 10px;
  color: white;
  flex-shrink: 0;
}

.research-modal-redesigned .sender-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.research-modal-redesigned .sender-name-primary {
  font-size: 1rem;
  font-weight: 600;
  color: #f0f6fc;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.research-modal-redesigned .sender-email-primary {
  font-size: 0.85rem;
  color: #8b949e;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.research-modal-redesigned .research-close-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -0.5rem;
  margin-right: -0.5rem;
}

.research-modal-redesigned .research-close-btn:hover {
  background: rgba(248, 81, 73, 0.1);
  color: #f85149;
  transform: scale(1.05);
}

/* Modal Body */
.research-modal-redesigned .research-modal-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Empty State */
.research-modal-redesigned .research-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  min-height: 400px;
}

.research-modal-redesigned .empty-state-icon {
  color: #58a6ff;
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.research-modal-redesigned .empty-state-title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: #f0f6fc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.research-modal-redesigned .empty-state-description {
  margin: 0 0 2rem;
  font-size: 1rem;
  color: #8b949e;
  line-height: 1.6;
  max-width: 480px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.research-modal-redesigned .research-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #238636, #2ea043);
  border: none;
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(35, 134, 54, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.research-cta-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2ea043, #238636);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(35, 134, 54, 0.4);
}

/* Research Prompt Section Styles */
.research-prompt-section {
  width: 100%;
  max-width: 600px;
  margin: 2rem 0;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 8px;
  overflow: hidden;
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(33, 38, 45, 0.8);
  border-bottom: 1px solid #30363d;
}

.prompt-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #f0f6fc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.prompt-controls {
  display: flex;
  gap: 0.5rem;
}

.prompt-edit-btn,
.prompt-reset-btn {
  background: transparent;
  border: 1px solid #484f58;
  color: #8b949e;
  padding: 0.375rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prompt-edit-btn:hover,
.prompt-reset-btn:hover {
  background: rgba(139, 148, 158, 0.1);
  border-color: #58a6ff;
  color: #58a6ff;
}

.prompt-display {
  padding: 1.25rem;
}

.prompt-text {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #c9d1d9;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #0d1117;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #21262d;
}

.prompt-editor {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prompt-textarea {
  width: 100%;
  min-height: 120px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #f0f6fc;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 0.75rem;
  resize: vertical;
  transition: all 0.2s ease;
}

.prompt-textarea:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.prompt-textarea::placeholder {
  color: #8b949e;
}

.prompt-editor-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.prompt-save-btn {
  background: #238636;
  border: 1px solid #238636;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.prompt-save-btn:hover {
  background: #2ea043;
  border-color: #2ea043;
}

.prompt-cancel-btn {
  background: transparent;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.prompt-cancel-btn:hover {
  background: rgba(139, 148, 158, 0.1);
  border-color: #484f58;
  color: #c9d1d9;
}

/* Prompt loading state */
.prompt-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: #8b949e;
  font-size: 0.8rem;
}

.loading-spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid #30363d;
  border-top: 2px solid #58a6ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Loading State */
.research-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  min-height: 400px;
}

.loading-animation {
  margin-bottom: 2rem;
}

.loading-spinner-modern {
  width: 48px;
  height: 48px;
  border: 3px solid #30363d;
  border-top: 3px solid #58a6ff;
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.loading-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.research-modal-redesigned .loading-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #f0f6fc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.loading-description {
  margin: 0;
  font-size: 0.9rem;
  color: #8b949e;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #8b949e;
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

.loading-step.active {
  color: #58a6ff;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #30363d;
  transition: background 0.3s ease;
}

.loading-step.active .step-dot {
  background: #58a6ff;
  box-shadow: 0 0 8px rgba(88, 166, 255, 0.4);
}

/* Error State */
.research-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  min-height: 400px;
}

.error-icon {
  color: #f85149;
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.research-modal-redesigned .error-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #f0f6fc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.error-description {
  margin: 0 0 2rem;
  font-size: 0.9rem;
  color: #8b949e;
  line-height: 1.6;
  max-width: 480px;
}

.error-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #58a6ff;
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retry-btn:hover:not(:disabled) {
  background: #1f6feb;
  transform: translateY(-1px);
}

.skip-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.skip-btn:hover {
  background: rgba(139, 148, 158, 0.1);
  border-color: #484f58;
  color: #c9d1d9;
}

/* Results Layout */
.research-results-redesigned {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.search-metadata {
  display: flex;
  justify-content: center;
  margin-bottom: -0.5rem;
}

.search-query-redesigned {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 20px;
  font-size: 0.8rem;
}

.query-label-new {
  color: #8b949e;
  font-weight: 500;
}

.query-text-new {
  color: #58a6ff;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.75rem;
  background: rgba(88, 166, 255, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* Section Styling */
.summary-section-redesigned,
.sources-section-redesigned {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.research-modal-redesigned .section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f0f6fc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

.section-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: #8b949e;
  font-weight: 500;
}

.summary-content {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  line-height: 1.7;
  font-size: 0.95rem;
  color: #c9d1d9;
}

.summary-content a {
  color: #58a6ff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.summary-content a:hover {
  color: #79c0ff;
  border-bottom-color: #58a6ff;
}

/* Sources Grid */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.source-card {
  display: flex;
  flex-direction: column;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  color: inherit;
  text-decoration: none;
}

.source-card:hover {
  background: #161b22;
  border-color: #58a6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.source-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.source-favicon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #21262d;
  border-radius: 4px;
  color: #58a6ff;
  flex-shrink: 0;
}

.source-domain {
  font-size: 0.8rem;
  color: #8b949e;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-link-icon {
  color: #8b949e;
  opacity: 0.6;
  transition: all 0.2s ease;
}

.source-card:hover .external-link-icon {
  color: #58a6ff;
  opacity: 1;
}

.source-content {
  display: flex;
  flex-direction: column;
}

.source-title {
  font-size: 0.9rem;
  color: #c9d1d9;
  line-height: 1.4;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Action Bar */
.research-actions-redesigned {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
  border-top: 1px solid #30363d;
}

.refresh-research-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-research-btn:hover:not(:disabled) {
  background: #21262d;
  border-color: #58a6ff;
  color: #f0f6fc;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .research-modal-redesigned {
    width: 95vw;
    max-height: 95vh;
  }
  
  .research-modal-header {
    padding: 1.5rem 1rem 1rem;
  }
  
  .research-title {
    font-size: 1.5rem;
  }
  
  .sender-card {
    padding: 0.75rem;
  }
  
  .research-results-redesigned {
    padding: 1.5rem 1rem;
  }
  
  .sources-grid {
    grid-template-columns: 1fr;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
  }
}

/* Legacy Research Modal Styles (keeping for backward compatibility) */
.research-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.research-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #f0f6fc;
}

.sender-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sender-name {
  font-weight: 500;
  color: #58a6ff;
  font-size: 0.875rem;
}

.sender-email {
  font-size: 0.75rem;
  color: #8b949e;
}

.research-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.research-prompt {
  text-align: center;
  padding: 2rem 0;
}

.research-prompt p {
  margin-bottom: 1.5rem;
  color: #c9d1d9;
  font-size: 0.875rem;
}

.research-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #21262d;
  border: 1px solid #484f58;
  color: #c9d1d9;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.research-btn:hover:not(:disabled) {
  background: #30363d;
  border-color: #58a6ff;
  color: #f0f6fc;
}

.research-btn.primary {
  background: #238636;
  border-color: #238636;
  color: #f0f6fc;
}

.research-btn.primary:hover:not(:disabled) {
  background: #2ea043;
  border-color: #2ea043;
}

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

.research-loading {
  text-align: center;
  padding: 2rem 0;
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid #30363d;
  border-top: 2px solid #58a6ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.research-loading p {
  color: #8b949e;
  font-size: 0.875rem;
}

.research-error {
  text-align: center;
  padding: 2rem 0;
}

.research-error p {
  color: #f85149;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.research-results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-query {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
}

.query-label {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 500;
}

.query-text {
  font-size: 0.875rem;
  color: #58a6ff;
  font-family: monospace;
}

.summary-section h4,
.annotations-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #f0f6fc;
}

.summary-text {
  padding: 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  line-height: 1.6;
  font-size: 0.875rem;
  white-space: pre-wrap;
}

.summary-link {
  color: #58a6ff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.summary-link:hover {
  color: #79c0ff;
  border-bottom-color: #58a6ff;
}

.summary-link:visited {
  color: #bc8cff;
}

.annotation-tiles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.annotation-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
  color: #c9d1d9;
}

.annotation-tile:hover {
  background: #21262d;
  border-color: #58a6ff;
}

.tile-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tile-domain {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 500;
}

.tile-title {
  font-size: 0.875rem;
  color: #c9d1d9;
  line-height: 1.4;
}

.research-actions {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
  border-top: 1px solid #30363d;
}

/* Modal Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #30363d;
  background: #161b22;
  flex-shrink: 0;
}

.email-subject {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subject-label {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 500;
}

.subject-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f0f6fc;
}

.close-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #21262d;
  color: #f0f6fc;
}

/* Modal Content */
.modal-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 0.5rem;
}

.email-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.email-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.email-message.original {
  background: #fafbfc;
  border: 1px solid #d1d9e0;
  border-radius: 6px;
  padding: 1.5rem;
  margin: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e1e4e8;
}

.sender {
  font-weight: 600;
  color: #0366d6;
}

.timestamp {
  font-size: 0.75rem;
  color: #6a737d;
}

.message-body {
  color: #24292f;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Normalize HTML email content to reduce excessive spacing */
.message-body p {
  margin: 0.5rem 0;
}

.message-body p:first-child {
  margin-top: 0;
}

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

.message-body p:empty {
  display: none;
}

.message-body br {
  line-height: 1.2;
}

.message-body div {
  margin: 0;
  padding: 0;
}

.message-body div:empty {
  display: none;
}

.message-body table {
  margin: 0.5rem 0;
  border-collapse: collapse;
}

.message-body td, .message-body th {
  padding: 0.25rem;
  vertical-align: top;
}

.message-body tr:empty {
  display: none;
}

.message-body td:empty, .message-body th:empty {
  padding: 0;
  height: 0;
}

.message-body * {
  max-width: 100%;
}

/* Hide excessive spacing elements */
.message-body > br,
.message-body > br + br,
.message-body br + br + br {
  display: none;
}

/* Collapse multiple consecutive empty elements */
.message-body div:empty + div:empty,
.message-body p:empty + p:empty,
.message-body td:empty + td:empty {
  display: none;
}

/* Reset margins on nested elements */
.message-body table table {
  margin: 0;
}

.message-body div div {
  margin: 0;
}

/* Draft Compose Area */
.draft-compose-area {
  border-top: 1px solid #30363d;
  background: #0d1117;
  flex-shrink: 0;
}

.compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #30363d;
}

.compose-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #f0f6fc;
}

.compose-actions {
  display: flex;
  gap: 0.5rem;
}

.research-sender-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: transparent;
  border: 1px solid #484f58;
  color: #c9d1d9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: fit-content;
  font-family: inherit;
}

.research-sender-btn:hover {
  background: #21262d;
  border-color: #58a6ff;
  color: #f0f6fc;
}

.settings-toggle-btn {
  background: transparent;
  border: 1px solid #484f58;
  color: #c9d1d9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.settings-toggle-btn:hover {
  background: #21262d;
  border-color: #58a6ff;
  color: #f0f6fc;
}

.compose-content {
  padding: 1rem;
}

.draft-textarea {
  width: 100%;
  min-height: 200px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #f0f6fc;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.75rem;
  resize: vertical;
  transition: all 0.2s ease;
}

.draft-textarea:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.1);
}

.draft-textarea::placeholder {
  color: #8b949e;
}

/* Settings Panel */
.settings-panel {
  width: 300px;
  background: #0d1117;
  border-left: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.settings-panel.collapsed {
  width: 0;
  overflow: hidden;
}

.settings-panel.expanded {
  width: 300px;
}

.settings-panel-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.settings-section {
  margin-bottom: 1.5rem;
}

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

.settings-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f0f6fc;
  margin: 0;
}

.panel-collapse-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-collapse-btn:hover {
  background: #21262d;
  color: #f0f6fc;
}

.settings-field {
  margin-bottom: 1rem;
}

.settings-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #8b949e;
  margin-bottom: 0.5rem;
}

.settings-textarea {
  width: 100%;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #f0f6fc;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0.5rem;
  resize: vertical;
  transition: all 0.2s ease;
}

.settings-textarea:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.1);
}

.settings-textarea.readonly {
  background: #0d1117;
  color: #8b949e;
  cursor: not-allowed;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid #30363d;
  background: #161b22;
  flex-shrink: 0;
}

.compose-footer-left {
  display: flex;
  gap: 0.5rem;
}

.quick-action-btn {
  background: transparent;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-action-btn:hover:not(:disabled) {
  background: #21262d;
  border-color: #484f58;
  color: #f0f6fc;
}

.quick-action-btn.delete-action {
  border-color: #f85149;
  color: #f85149;
}

.quick-action-btn.delete-action:hover {
  background: rgba(248, 81, 73, 0.1);
  color: #f85149;
}

.compose-footer-right {
  display: flex;
  gap: 0.5rem;
}

.send-btn {
  background: #58a6ff;
  border: 1px solid #58a6ff;
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 120px;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
}

.send-btn:hover:not(:disabled) {
  background: #6ba6ff;
  border-color: #6ba6ff;
}

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

/* Awaiting Human Modal Specific */
.awaiting-human-modal .modal-content {
  flex-direction: row;
}

.awaiting-human-modal .email-main-area {
  flex: 1;
  min-width: 0;
}

.awaiting-human-modal .email-thread {
  flex: 1;
  overflow-y: auto;
}

.awaiting-human-modal .email-message.original {
  background: #fafbfc;
  border: 1px solid #d1d9e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.awaiting-human-modal .message-body {
  color: #24292f;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.awaiting-human-modal .draft-compose-area {
  border-top: 1px solid #30363d;
  background: #0d1117;
  flex-shrink: 0;
}

.awaiting-human-modal .compose-content {
  padding: 1rem;
}

.awaiting-human-modal .draft-textarea {
  width: 100%;
  min-height: 200px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #f0f6fc;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.75rem;
  resize: vertical;
  transition: all 0.2s ease;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .settings-panel.expanded {
    width: 250px;
  }
  
  .settings-panel-content {
    padding: 0.75rem;
  }
}

@media (max-width: 768px) {
  .modal {
    width: 95vw;
    height: 90vh;
  }
  
  .modal-content {
    flex-direction: column;
  }
  
  .settings-panel.expanded {
    width: 100%;
    height: 200px;
    border-left: none;
    border-top: 1px solid #30363d;
  }
  
  .settings-panel.collapsed {
    width: 100%;
    height: 0;
    overflow: hidden;
  }
  
  .settings-panel-content {
    padding: 0.75rem;
  }
  
  .compose-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .compose-footer-left {
    width: 100%;
    justify-content: center;
  }
  
  .compose-footer-right {
    width: 100%;
    justify-content: center;
  }
  
  .email-thread {
    padding: 0.75rem;
  }
  
  .draft-textarea {
    min-height: 150px;
  }
  
  .modal-footer {
    padding: 0.75rem;
  }
  
  .modal-footer .compose-footer-left {
    width: 100%;
    justify-content: center;
  }
  
  .modal-footer .compose-footer-right {
    width: 100%;
    justify-content: center;
  }
} 

/* Mobile responsiveness for prompt section */
@media (max-width: 768px) {
  .research-prompt-section {
    margin: 1.5rem 0;
  }
  
  .prompt-header {
    padding: 0.75rem 1rem;
  }
  
  .prompt-display,
  .prompt-editor {
    padding: 1rem;
  }
  
  .prompt-text {
    font-size: 0.75rem;
    padding: 0.75rem;
  }
  
  .prompt-textarea {
    font-size: 0.75rem;
    min-height: 100px;
  }
  
  .prompt-editor-actions {
    flex-direction: column-reverse;
  }
  
  .prompt-save-btn,
  .prompt-cancel-btn {
    width: 100%;
    justify-content: center;
  }
} 