/**
 * Translation Quality System Styles
 * Styles for translation quality badges, feedback widgets, and modals
 */

/* ============================================================================
   Quality Badge Styles
   ============================================================================ */

.translation-quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 20px;
  font-size: 0.875rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.translation-quality-badge.compact {
  padding: 0.25rem 0.5rem;
  gap: 0.25rem;
  font-size: 0.75rem;
}

.quality-source {
   font-weight: 600;
   color: #2c3e50;
   white-space: nowrap;
}

@media (max-width: 768px) {
   .quality-source {
     white-space: normal;
     overflow-wrap: break-word;
   }
}

.quality-stars {
  color: #f39c12;
  letter-spacing: 2px;
  font-size: 1rem;
}

.quality-meta {
  font-size: 0.75rem;
  color: #7f8c8d;
  margin-left: 0.5rem;
}

/* Source-specific badge colors */
.translation-quality-badge[data-source-type="native"] {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.translation-quality-badge[data-source-type="native"] .quality-source {
  color: white;
}

.translation-quality-badge[data-source-type="human_review"] {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.translation-quality-badge[data-source-type="human_review"] .quality-source {
  color: white;
}

.translation-quality-badge[data-source-type="machine"] {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.translation-quality-badge[data-source-type="machine"] .quality-source {
  color: white;
}

/* ============================================================================
   Feedback Widget Styles
   ============================================================================ */

.translation-feedback-widget {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  font-family: inherit;
}

.feedback-header {
  margin-bottom: 1rem;
}

.feedback-header label {
  display: block;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.feedback-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.feedback-btn {
  flex: 1;
  min-width: 100px;
  padding: 0.75rem 1rem;
  border: 2px solid #dee2e6;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.feedback-btn:hover {
  border-color: #adb5bd;
  background: #f8f9fa;
}

.feedback-btn.helpful:hover {
  border-color: #28a745;
  background: #d4edda;
}

.feedback-btn.okay:hover {
  border-color: #ffc107;
  background: #fff3cd;
}

.feedback-btn.poor:hover {
  border-color: #dc3545;
  background: #f8d7da;
}

.feedback-btn.selected {
  border-color: #495057;
  background: #e2e3e5;
  font-weight: 600;
}

.feedback-btn.helpful.selected {
  border-color: #28a745;
  background: #d4edda;
  color: #155724;
}

.feedback-btn.okay.selected {
  border-color: #ffc107;
  background: #fff3cd;
  color: #856404;
}

.feedback-btn.poor.selected {
  border-color: #dc3545;
  background: #f8d7da;
  color: #721c24;
}

.feedback-note {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

.feedback-reason {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
}

.feedback-submit-btn {
  padding: 0.5rem 1rem;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s ease;
}

.feedback-submit-btn:hover {
  background: #0056b3;
}

.feedback-status {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.feedback-status.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.feedback-status.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ============================================================================
   Native Translation Modal Styles
   ============================================================================ */

.native-translation-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.native-translation-modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  z-index: 10000;
  background: white;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #2c3e50;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #495057;
}

.modal-body {
  padding: 1.5rem;
}

.modal-body > p {
  color: #6c757d;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.native-submission-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-group small {
  color: #6c757d;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}

.btn-cancel,
.btn-submit {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.btn-cancel {
  background: #e9ecef;
  color: #495057;
}

.btn-cancel:hover {
  background: #dee2e6;
}

.btn-submit {
  background: #28a745;
  color: white;
}

.btn-submit:hover {
  background: #218838;
}

.btn-submit:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.submission-status {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.submission-status.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.submission-status.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ============================================================================
   Dashboard Styles
   ============================================================================ */

.translation-quality-dashboard {
  padding: 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dashboard-loading {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
}

.dashboard-error {
  text-align: center;
  padding: 2rem;
  color: #dc3545;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
}

.stat-percent {
  font-size: 1rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.dashboard-by-language {
  margin-top: 2rem;
}

.dashboard-by-language h3 {
  color: #2c3e50;
  margin-top: 0;
  margin-bottom: 1rem;
}

.language-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.language-header {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.language-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: white;
  border-radius: 4px;
  font-size: 0.875rem;
}

.stat-name {
  color: #6c757d;
  font-weight: 500;
}

.stat-val {
  color: #2c3e50;
  font-weight: 600;
}

/* ============================================================================
   Job Page Feedback Section Styles
   ============================================================================ */

.job-translation-feedback {
  margin: 2rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.feedback-section-header {
  margin-bottom: 1.5rem;
}

.feedback-section-header h3 {
  margin: 0 0 0.5rem 0;
  color: #2c3e50;
  font-size: 1.1rem;
}

.feedback-section-subtext {
  margin: 0;
  color: #6c757d;
  font-size: 0.9rem;
}

.feedback-section-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.feedback-section-footer p {
  margin: 0 0 0.75rem 0;
  color: #6c757d;
  font-size: 0.9rem;
  font-weight: 500;
}

#nativeTranslationTrigger {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

#nativeTranslationTrigger:hover {
  background: #667eea;
  color: white;
}

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

@media (max-width: 768px) {
  .translation-quality-badge {
    flex-direction: column;
    gap: 0.25rem;
  }

  .feedback-buttons {
    flex-direction: column;
  }

  .feedback-btn {
    min-width: auto;
  }

  .modal-content {
    border-radius: 0;
    max-height: 100%;
  }

  .language-stats {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   Dark Mode Support
   ============================================================================ */

@media (prefers-color-scheme: dark) {
  .translation-quality-badge {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #e2e8f0;
  }

  .feedback-widget {
    background: #1a202c;
    border-color: #2d3748;
    color: #e2e8f0;
  }

  .feedback-header label {
    color: #cbd5e0;
  }

  .feedback-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .feedback-btn:hover {
    background: #4a5568;
  }

  .native-translation-modal {
    .modal-overlay {
      background: rgba(0, 0, 0, 0.8);
    }

    .modal-content {
      background: #1a202c;
      color: #e2e8f0;
    }

    .modal-header {
      border-bottom-color: #2d3748;
    }

    .modal-header h2 {
      color: #f7fafc;
    }
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .modal-actions {
    border-top-color: #2d3748;
  }

  .dashboard-summary .stat-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  }

  .language-card {
    background: #2d3748;
    border-color: #4a5568;
  }

  .language-header {
    color: #f7fafc;
  }

  .stat-row {
    background: #1a202c;
  }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
  .translation-feedback-widget,
  .native-translation-modal,
  .translation-quality-dashboard {
    display: none;
  }

  .translation-quality-badge {
    box-shadow: none;
    page-break-inside: avoid;
  }
}
