/* Accessibility Fixes for Color Contrast Issues */

/* 1. Skip to main content - Improve contrast */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #1f2937 !important; /* Darker background for better contrast */
  color: #ffffff !important; /* Ensure white text */
  padding: 12px 16px; /* Larger padding for better touch target */
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 9999;
  transition: top var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.skip-link:focus {
  top: 6px;
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* 2. Upload Method Toggle Buttons - Clear Active State */
.toggle-btn {
  background: #f3f4f6 !important; /* Light gray for inactive */
  color: #6b7280 !important; /* Muted text for inactive */
  border: 2px solid #e5e7eb !important; /* Light border for inactive */
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Active tab styling - Very clear difference */
.toggle-btn.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important; /* Bright gradient */
  color: #ffffff !important; /* White text */
  border: 2px solid #4f46e5 !important; /* Matching border */
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important; /* Glowing effect */
  transform: translateY(-2px);
}

/* Hover effect for inactive tabs */
.toggle-btn:hover:not(.active) {
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
  color: #374151 !important;
  transform: translateY(-1px);
}

.toggle-btn:focus {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* Add a subtle animation for active state */
.toggle-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* 3. Upload method toggle container - Improve contrast */
.upload-method-toggle {
  background: #f8fafc !important;
  border: 2px solid #e2e8f0 !important;
  color: #1f2937 !important; /* Dark text */
  padding: 8px;
  border-radius: 16px;
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  gap: 4px;
  position: relative;
}

.upload-method-toggle:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

/* Add a visual indicator for the active tab */
.toggle-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Add a checkmark icon for active tab */
.toggle-btn.active i {
  color: #ffffff !important;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

/* Add a subtle pulse animation for active tab */
.toggle-btn.active {
  animation: activePulse 2s ease-in-out infinite;
}

@keyframes activePulse {
  0%, 100% { 
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  }
  50% { 
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  }
}

/* Make inactive tabs more subtle */
.toggle-btn:not(.active) {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.toggle-btn:not(.active):hover {
  opacity: 1;
}

/* 4. Format label - Improve contrast */
.format-label {
  font-size: 0.875rem;
  color: #374151 !important; /* Darker gray for better contrast */
  font-weight: 600; /* Bolder text */
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* 5. Upload area - Improve contrast */
.upload-area {
  border: 3px dashed #6b7280 !important; /* Darker border */
  border-radius: var(--radius-2xl);
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
  color: #374151 !important; /* Dark text */
}

.upload-area:hover {
  border-color: #4b5563 !important; /* Darker on hover */
  background: linear-gradient(135deg, #f0f2ff 0%, #ffffff 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.1);
}

.upload-area.dragover {
  border-color: #374151 !important; /* Dark border when dragging */
  background: linear-gradient(135deg, #e8f0ff 0%, #f8f9ff 100%);
  transform: scale(1.02);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.2);
}

.upload-area .upload-text {
  color: #374151 !important; /* Dark text */
  font-weight: 600;
  font-size: 1.125rem;
}

.upload-area .upload-subtext {
  color: #6b7280 !important; /* Medium gray for subtext */
  font-size: 0.875rem;
  margin-top: 8px;
}

/* 6. CTA Button Large - Improve contrast */
.cta-button-large {
  background: #1f2937 !important; /* Dark background */
  color: #ffffff !important; /* White text */
  border: 2px solid #374151 !important; /* Dark border */
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cta-button-large:hover {
  background: #374151 !important;
  border-color: #4b5563 !important;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  color: #ffffff !important;
}

.cta-button-large:focus {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* Additional accessibility improvements */

/* Ensure all interactive elements have proper focus states */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #3b82f6 !important;
  outline-offset: 2px !important;
}

/* Improve text contrast for better readability */
.text-muted {
  color: #6b7280 !important; /* Better contrast than gray-500 */
}

.text-gray-500 {
  color: #6b7280 !important; /* Better contrast */
}

/* Ensure proper contrast for small text */
small, .text-sm {
  color: #4b5563 !important; /* Darker than gray-500 */
  font-weight: 500;
}

/* Improve contrast for labels and form elements */
label {
  color: #374151 !important; /* Dark text for labels */
  font-weight: 600;
}

/* Better contrast for placeholder text */
::placeholder {
  color: #9ca3af !important; /* Better contrast placeholder */
  opacity: 1;
}

/* Improve contrast for disabled elements */
button:disabled,
input:disabled,
textarea:disabled {
  background: #f3f4f6 !important;
  color: #9ca3af !important;
  border-color: #e5e7eb !important;
}

/* Ensure proper contrast for error states */
.error, .text-error {
  color: #dc2626 !important; /* Darker red for better contrast */
  font-weight: 600;
}

/* Improve contrast for success states */
.success, .text-success {
  color: #059669 !important; /* Darker green for better contrast */
  font-weight: 600;
}

/* Better contrast for info text */
.info, .text-info {
  color: #0284c7 !important; /* Darker blue for better contrast */
  font-weight: 600;
}

/* Chat navbar logo positioning */
.chat-navbar .nav-actions .logo {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.chat-navbar .nav-actions .logo-image {
  height: 40px;
  width: auto;
  transition: transform 0.2s ease;
}

.chat-navbar .nav-actions .logo-image:hover {
  transform: scale(1.05);
}

/* Ensure proper spacing in chat navbar */
.chat-navbar .nav-container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
}

.chat-navbar .back-btn {
  justify-self: start;
}

.chat-navbar .nav-center {
  justify-self: center;
}

.chat-navbar .nav-actions {
  justify-self: end;
}

/* Progress Steps in Header - Integrated Design */
.progress-steps-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  height: 100%;
  min-width: 0;
  flex-shrink: 1;
}

.progress-steps-header .step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.progress-steps-header .step-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.progress-steps-header .step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.progress-steps-header .step-item.completed .step-circle {
  background: #10b981;
  color: white;
  box-shadow: none;
}

.progress-steps-header .step-item.active .step-circle {
  background: #6366f1;
  color: white;
  box-shadow: none;
  animation: none;
}

.progress-steps-header .step-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  text-align: left;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.progress-steps-header .step-item.completed .step-label {
  color: #10b981;
  font-weight: 600;
}

.progress-steps-header .step-item.active .step-label {
  color: #6366f1;
  font-weight: 600;
}

.progress-steps-header .step-line {
  width: 24px;
  height: 2px;
  background: #e5e7eb;
  border-radius: 1px;
  margin: 0 4px;
  flex-shrink: 0;
}

.progress-steps-header .step-line.completed {
  background: #10b981;
}

/* Responsive adjustments for header progress steps */
@media (max-width: 768px) {
  .progress-steps-header {
    gap: 8px;
  }
  
  .progress-steps-header .step-item {
    padding: 6px 8px;
    gap: 6px;
  }
  
  .progress-steps-header .step-circle {
    width: 20px;
    height: 20px;
    font-size: 9px;
  }
  
  .progress-steps-header .step-label {
    font-size: 11px;
  }
  
  .progress-steps-header .step-line {
    width: 16px;
  }
}

@media (max-width: 480px) {
  .progress-steps-header {
    gap: 4px;
  }
  
  .progress-steps-header .step-item {
    padding: 4px 6px;
    gap: 4px;
  }
  
  .progress-steps-header .step-circle {
    width: 18px;
    height: 18px;
    font-size: 8px;
  }
  
  .progress-steps-header .step-label {
    font-size: 10px;
  }
  
  .progress-steps-header .step-line {
    width: 12px;
  }
}

/* Horizontal Transcript Segments */
.segments-container-horizontal {
  display: block;
  flex-wrap: wrap;
  gap: 0px;
  padding: 0px;
  max-height: 100vh;
  margin-bottom: 60px!important;
  overflow-y: auto;
}

.segment-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 30px;
  min-width: 280px;
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.segment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border-color: #6366f1;
}

.segment-card.active {
  border-color: #6366f1;
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.segment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.segment-time-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.segment-time-badge i {
  font-size: 10px;
}

.segment-duration {
  background: #f3f4f6;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.segment-content {
  margin-bottom: 12px;
}

.segment-text {
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
    /* max-height: 640px; */
    height: 100%;
    /* overflow: auto; */
    display: -webkit-box;
    /* -webkit-line-clamp: 3; */
    -webkit-box-orient: vertical;
}

.segment-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.segment-play,
.segment-copy {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}

.segment-play:hover {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.segment-copy:hover {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

/* No Segments Horizontal Layout */
.no-segments-horizontal {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin: 16px;
}

.no-segments-icon {
  background: #6366f1;
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.no-segments-content h4 {
  color: #374151;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.no-segments-content p {
  color: #6b7280;
  font-size: 14px;
  margin: 0 0 12px 0;
}

.transcript-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 13px;
}

.stat-item i {
  color: #6366f1;
  width: 16px;
}

.transcript-text-horizontal {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0px;
  margin: 16px;
  color: #374151;
  line-height: 1.6;
  font-size: 14px;
}

/* Responsive Design for Horizontal Segments */
@media (max-width: 768px) {
  .segments-container-horizontal {
    flex-direction: column;
    gap: 12px;
    padding: 0px;
  }
  
  .segment-card {
    min-width: 100%;
    max-width: 100%;
  }
  
  .no-segments-horizontal {
    flex-direction: column;
    text-align: center;
    margin: 12px;
  }
  
  .transcript-stats {
    align-items: center;
  }
}

@media (max-width: 480px) {
  .segment-card {
    padding: 12px;
  }
  
  .segment-text {
    font-size: 13px;
    max-height: 48px;
    -webkit-line-clamp: 2;
  }
  
  .segment-actions {
    gap: 6px;
  }
  
  .segment-play,
  .segment-copy {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
}

/* AI Chat Message Improvements */
.ai-message .message-content {
  background: #3b82f6 !important;
  color: white !important;
  padding: 16px !important;
  border-radius: 12px !important;
  max-width: 85% !important;
  word-wrap: break-word !important;
  line-height: 1.8 !important;
}

.ai-message .ai-response-text {
  margin-bottom: 12px !important;
  font-size: 14px !important;
  line-height: 1.8 !important;
}

.ai-message .ai-response-text p {
  margin: 0 0 8px 0 !important;
  line-height: 1.8 !important;
}

.ai-message .ai-response-text br {
  display: block !important;
  content: "" !important;
  margin: 4px 0 !important;
}

.ai-message .message-actions {
  margin-top: 12px !important;
  padding-top: 12px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.ai-message .message-actions button {
  padding: 6px 12px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all 0.2s !important;
}

.ai-message .translate-msg-btn {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

.ai-message .translate-msg-btn:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

.ai-message .copy-msg-btn {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

.ai-message .copy-msg-btn:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* Fix chat input at bottom */
.chat-input-container {
  position: sticky !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: white !important;
  border-top: 1px solid #e5e7eb !important;
  padding: 16px !important;
  z-index: 100 !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
}

/* Ensure chat messages area has proper padding at bottom */
.chat-content-area {
  padding-bottom: 120px !important;
  overflow-y: auto !important;
  max-height: calc(100vh - 200px) !important;
}

/* Fix input field layout */
.input-field {
  display: flex !important;
  align-items: flex-end !important;
  gap: 8px !important;
  width: 100% !important;
}

.input-field textarea {
  flex: 1 !important;
  min-width: 0 !important;
}

/* Fix input actions alignment */
.input-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Voice input button */
.voice-btn {
  background: #667eea !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  font-size: 16px !important;
  flex-shrink: 0 !important;
}

/* Send button alignment */
.send-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.voice-btn:hover {
  background: #5568d3 !important;
  transform: scale(1.05) !important;
}

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

/* When listening */
.voice-btn.listening {
  background: #ef4444 !important;
  animation: pulse 1.5s infinite !important;
}

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

/* Text-to-Speech buttons */
.speak-segment-btn {
  position: absolute !important;
  bottom: 12px !important;
  right: 12px !important;
  background: #10b981 !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important;
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  font-size: 14px !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
  z-index: 10 !important;
}

.speak-segment-btn:hover {
  background: #059669 !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.speak-segment-btn.speaking {
  background: #ef4444 !important;
  animation: pulse 1.5s infinite !important;
}

.segment-content {
  position: relative !important;
  padding-bottom: 48px !important;
}

/* Full transcript speaker button */
.speak-full-btn {
  position: sticky !important;
  top: 20px !important;
  right: 20px !important;
  float: right !important;
  background: #10b981 !important;
  color: white !important;
  border: none !important;
  border-radius: 24px !important;
  padding: 10px 20px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
  z-index: 100 !important;
  margin-bottom: 20px !important;
}

.speak-full-btn:hover {
  background: #059669 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

.speak-full-btn.speaking {
  background: #ef4444 !important;
  animation: pulse 1.5s infinite !important;
}

.speak-full-btn i {
  font-size: 16px !important;
}

.speak-full-btn span {
  font-size: 14px !important;
}
