/* Phase 2 Module Styles */

/* File Upload Component */
.upload-zone {
  border: 2px dashed var(--bs-border-color);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: var(--bs-background-light);
  margin-bottom: 20px;
}

.upload-zone:hover {
  border-color: var(--bs-primary);
  background: var(--bs-primary-light);
}

.upload-zone.drag-over {
  border-color: var(--bs-success);
  background: var(--bs-success-light);
  transform: scale(1.02);
}

.upload-zone.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-icon {
  font-size: 48px;
  opacity: 0.7;
}

.upload-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--bs-text-primary);
  margin: 0;
}

.upload-hint {
  font-size: 14px;
  color: var(--bs-text-secondary);
  margin: 0;
}

.upload-progress {
  margin-bottom: 20px;
}

.progress-item {
  background: var(--bs-background-light);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--bs-border-color);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.file-name {
  font-weight: 600;
  color: var(--bs-text-primary);
}

.progress-status {
  font-size: 14px;
  color: var(--bs-text-secondary);
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bs-border-color);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--bs-primary);
  transition: width 0.3s ease;
}

.upload-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.upload-result.success {
  background: var(--bs-success-light);
  border: 1px solid var(--bs-success);
}

.upload-result.error {
  background: var(--bs-error-light);
  border: 1px solid var(--bs-error);
}

.result-icon {
  font-size: 20px;
}

.result-content p {
  margin: 0 0 4px 0;
  font-size: 14px;
}

/* QA Results Component */
.qa-results-container {
  max-width: 100%;
}

.qa-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px;
  background: var(--bs-background-light);
  border-radius: 8px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--bs-text-primary);
}

.filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--bs-border-color);
  border-radius: 4px;
  background: white;
  font-size: 14px;
}

.qa-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.qa-results-header h3 {
  margin: 0;
  color: var(--bs-text-primary);
}

.qa-actions {
  display: flex;
  gap: 8px;
}

.qa-results-stats {
  margin-bottom: 20px;
}

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

.stat-item {
  background: var(--bs-background-light);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--bs-border-color);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--bs-primary);
  display: block;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--bs-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qa-results-list {
  margin-bottom: 20px;
}

.report-item {
  background: white;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.report-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.report-item.excellent {
  border-left: 4px solid var(--bs-success);
}

.report-item.good {
  border-left: 4px solid var(--bs-primary);
}

.report-item.needs-improvement {
  border-left: 4px solid var(--bs-warning);
}

.report-item.poor {
  border-left: 4px solid var(--bs-error);
}

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

.report-agent {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-agent strong {
  font-size: 16px;
  color: var(--bs-text-primary);
}

.report-team {
  font-size: 14px;
  color: var(--bs-text-secondary);
  font-weight: 600;
  background: var(--bs-background-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.report-score {
  text-align: center;
}

.score-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--bs-primary);
  display: block;
}

.score-label {
  font-size: 12px;
  color: var(--bs-text-secondary);
  text-transform: uppercase;
}

.report-details {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--bs-text-secondary);
}

.report-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-score {
  background: var(--bs-background-light);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.category-score.excellent {
  background: var(--bs-success-light);
  color: var(--bs-success);
}

.category-score.good {
  background: var(--bs-primary-light);
  color: var(--bs-primary);
}

.category-score.needs-improvement {
  background: var(--bs-warning-light);
  color: var(--bs-warning);
}

.category-score.poor {
  background: var(--bs-error-light);
  color: var(--bs-error);
}

.report-summary {
  font-size: 14px;
  color: var(--bs-text-primary);
  line-height: 1.4;
  border-top: 1px solid var(--bs-border-color);
  padding-top: 12px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.page-btn {
  padding: 8px 12px;
  border: 1px solid var(--bs-border-color);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.page-btn:hover {
  background: var(--bs-primary-light);
  border-color: var(--bs-primary);
}

.page-btn.active {
  background: var(--bs-primary);
  color: white;
  border-color: var(--bs-primary);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading and Error States */
.loading, .error, .no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--bs-text-secondary);
  font-size: 16px;
}

.error {
  color: var(--bs-error);
}

/* Search Results Styles */
.search-results-header {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bs-border-color);
}

.search-results-header h3 {
  margin: 0;
  color: var(--bs-text-primary);
}

.search-result-item {
  background: white;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-result-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

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

.result-phone {
  font-size: 16px;
  color: var(--bs-text-primary);
}

.result-date {
  font-size: 14px;
  color: var(--bs-text-secondary);
}

.result-details {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 14px;
}

.result-details .label {
  font-weight: 600;
  color: var(--bs-text-secondary);
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status.successful {
  color: var(--bs-success);
  font-weight: 600;
}

.status.failed {
  color: var(--bs-error);
  font-weight: 600;
}

.search-no-results, .search-status, .search-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--bs-text-secondary);
}

.search-error {
  color: var(--bs-error);
}

/* App Controller Styles */
.spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--bs-primary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

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

/* Button Styles */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--bs-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--bs-primary-dark);
}

.btn-secondary {
  background: var(--bs-background-light);
  color: var(--bs-text-primary);
  border: 1px solid var(--bs-border-color);
}

.btn-secondary:hover {
  background: var(--bs-border-color);
}

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

/* Tab Bar Improvements */
.tab-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 24px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: none;
  background: #f7fafc;
  color: #1a365d;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active,
.tab-btn:hover {
  background: #e6f3ff;
  color: #1a365d;
  font-weight: 600;
}

/* Form Layout Improvements */
.form-row {
  margin-bottom: 16px;
}

/* Date Preset Buttons */
.date-preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.preset-btn {
  padding: 6px 12px;
  font-size: 0.9rem;
  border: 1px solid #cfd8dc;
  background: #f7fafc;
  color: #1a365d;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.preset-btn:hover {
  background: #e6f3ff;
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.preset-btn.active {
  background: var(--bs-primary);
  color: white;
  border-color: var(--bs-primary);
}

.preset-btn:focus {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.form-row label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #1a365d;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  font-size: 1rem;
}

.form-row textarea {
  resize: vertical;
  min-height: 80px;
}

.date-range {
  display: flex;
  gap: 16px;
  align-items: center;
}

.date-range > div {
  flex: 1;
}

/* Button Groups */
.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn-primary {
  background: var(--bs-orange);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background: #e55a2b;
}

.btn-secondary {
  background: #f7fafc;
  color: #1a365d;
  border: 1px solid #cfd8dc;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #a0aec0;
}

/* Section Headers */
.section-header {
  max-width: 700px;
  margin: 0 auto 18px auto;
  text-align: center;
}

.section-header h2 {
  margin-bottom: 8px;
}

.section-description {
  font-size: 1.08rem;
  color: #1a365d;
  background: #f7fafc;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.section-description ul {
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
}

/* Search Container */
.search-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  gap: 8px;
}

.search-container input {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #cfd8dc;
  font-size: 1rem;
  width: 220px;
}

/* Search Results */
.search-results-item {
  background: #f7fafc;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-results-item:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

/* Status and Result Areas */
.status-area {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
}

.status-area.success {
  background: #e6f3ff;
  color: #0078d7;
  border: 1px solid #b8deff;
}

.status-area.error {
  background: #ffeaea;
  color: #e74c3c;
  border: 1px solid #ffb8b8;
}

.status-area.warning {
  background: #fff3cd;
  color: #e67e22;
  border: 1px solid #f7931e;
}

/* Responsive Design */
@media (max-width: 768px) {
  .qa-filters {
    flex-direction: column;
  }
  
  .filter-group {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  
  .report-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .report-details {
    flex-direction: column;
    gap: 8px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .result-actions .btn {
    width: 100%;
  }

  .tab-bar {
    flex-direction: column;
    gap: 4px;
  }
  
  .tab-btn {
    font-size: 1rem;
    padding: 8px 16px;
  }
  
  .date-range {
    flex-direction: column;
    gap: 8px;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .search-container {
    flex-direction: column;
    gap: 12px;
  }
  
  .search-container input {
    width: 100%;
  }
  
  .search-results-item {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--bs-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Card Improvements */
.card {
  background: white;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #1a365d;
  font-size: 1.5rem;
}

/* Table Styling */
.qa-results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.qa-results-table th {
  background: #f7fafc;
  color: #1a365d;
  font-weight: 600;
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
}

.qa-results-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.qa-results-table tr:hover {
  background: #f8fafc;
}

.qa-results-table .error-cell {
  color: #e74c3c;
  font-style: italic;
}

/* Agent Header Styling */
.agent-header {
  margin-top: 32px;
  margin-bottom: 8px;
  background: #f7fafc;
  border-radius: 8px;
  padding: 12px 18px;
}

.agent-header b {
  font-size: 1.1rem;
  color: #1a365d;
}

.agent-stats {
  font-size: 0.98em;
  color: #4a5568;
  margin-top: 8px;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.gap-8 {
  gap: 8px;
}

.gap-16 {
  gap: 16px;
}

.hidden {
  display: none;
}

.visible {
  display: block;
}

/* Toast Improvements */
/* Enhanced Toast Notification */
#toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bs-white);
  color: var(--bs-text);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  max-width: 400px;
  min-width: 300px;
  word-wrap: break-word;
  overflow: hidden;
}

#toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  position: relative;
}

.toast-icon {
  font-size: 18px;
  font-weight: bold;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.toast-dismiss {
  background: none;
  border: none;
  font-size: 20px;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-dismiss:hover {
  background: #f8f9fa;
  color: #495057;
}

.toast-actions {
  padding: 0 20px 16px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.toast-action-btn {
  background: var(--toast-color, var(--bs-primary));
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toast-action-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--toast-color, var(--bs-primary));
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  animation: toastProgress var(--duration, 3000ms) linear forwards;
}

@keyframes toastProgress {
  to {
    transform: scaleX(1);
  }
}

/* Toast Type Variations */
.toast-success {
  border-left: 4px solid #28a745;
}

.toast-error {
  border-left: 4px solid #dc3545;
}

.toast-warning {
  border-left: 4px solid #ffc107;
}

.toast-info {
  border-left: 4px solid #007bff;
}

.toast-success .toast-icon {
  color: #28a745;
}

.toast-error .toast-icon {
  color: #dc3545;
}

.toast-warning .toast-icon {
  color: #ffc107;
}

.toast-info .toast-icon {
  color: #007bff;
}

#toast.error {
  background: #e74c3c;
}

#toast.success {
  background: #27ae60;
}

#toast.warning {
  background: #f39c12;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 40, 60, 0.45);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  max-width: 900px;
  width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 32px rgba(30, 60, 90, 0.18);
  padding: 32px 24px 24px 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 2rem;
  color: #888;
  cursor: pointer;
  transition: color 0.2s;
}

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

/* Chat Container Styles */
.chat-container {
  margin-top: 32px;
}

.chat-container h3 {
  margin-bottom: 8px;
  color: var(--bs-heading);
}

.chat-history {
  background: #f7fafc;
  border-radius: 8px;
  min-height: 60px;
  max-height: 180px;
  overflow-y: auto;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-form input {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #cfd8dc;
  font-size: 1rem;
}

.chat-form button {
  padding: 10px 18px;
  background: var(--bs-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.chat-form button:hover {
  background: var(--bs-accent);
}

.chat-message {
  padding: 8px 14px;
  border-radius: 12px;
  max-width: 80%;
  word-wrap: break-word;
}

.user-message {
  background: #e6f3ff;
  color: #1a365d;
  align-self: flex-end;
}

.ai-message {
  background: #f7fafc;
  color: #333;
  align-self: flex-start;
}

.error-message {
  color: #e74c3c;
  margin-top: 6px;
  font-size: 0.95rem;
}

/* Transcript Bubble Styles */
.transcript-bubbles-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
}

.transcript-bubble {
  max-width: 70%;
  margin: 8px 0;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 1.05em;
  box-shadow: 0 1px 4px rgba(30, 60, 90, 0.06);
  position: relative;
  word-break: break-word;
  display: flex;
  flex-direction: column;
}

.transcript-agent {
  background: #e6f3ff;
  color: #1a365d;
  align-self: flex-start;
  border-top-left-radius: 4px;
  border-top-right-radius: 16px;
  margin-right: auto;
}

.transcript-customer {
  background: #f7fafc;
  color: #333;
  align-self: flex-end;
  border-top-right-radius: 4px;
  border-top-left-radius: 16px;
  margin-left: auto;
}

.transcript-meta {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.9em;
}

.transcript-speaker {
  font-weight: bold;
  margin-right: 8px;
}

.transcript-timestamp {
  font-size: 0.85em;
  color: #888;
  margin-right: 8px;
}

.transcript-text {
  line-height: 1.4;
}

/* Report Table Styles */
.qa-results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(30, 60, 90, 0.04);
}

.qa-results-table th,
.qa-results-table td {
  border: 1px solid var(--bs-gray);
  padding: 12px 8px;
  text-align: left;
  font-size: 0.95rem;
}

.qa-results-table th {
  background-color: var(--bs-bg);
  color: var(--bs-heading);
  font-weight: 600;
}

.qa-results-table tr:nth-child(even) {
  background-color: #f7fafc;
}

.qa-results-table tr:hover {
  background-color: #e6f3ff;
}

.qa-results-table .error-cell {
  color: #e74c3c;
  font-style: italic;
}

/* Agent Section Styles */
.agent-section {
  margin-top: 32px;
  margin-bottom: 8px;
  background: #f7fafc;
  border-radius: 8px;
  padding: 12px 18px;
  border-left: 4px solid var(--bs-primary);
}

.agent-section b {
  color: var(--bs-heading);
  font-size: 1.1rem;
}

.agent-stats {
  font-size: 0.98em;
  color: #555;
  line-height: 1.5;
}

/* Button Styles for Reports */
.downloadPdfBtn,
.viewTranscriptBtn,
.viewQaDetailBtn {
  background: var(--bs-primary);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-right: 8px;
  margin-bottom: 4px;
  transition: background 0.2s;
}

.downloadPdfBtn:hover,
.viewTranscriptBtn:hover,
.viewQaDetailBtn:hover {
  background: var(--bs-accent);
}

.downloadPdfBtn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.viewTranscriptBtn {
  background: var(--bs-orange);
}

.viewTranscriptBtn:hover {
  background: #e67e22;
}

.viewQaDetailBtn {
  background: #27ae60;
}

.viewQaDetailBtn:hover {
  background: #219a52;
}

/* Search Results Styles */
.search-result-item {
  background: #f7fafc;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.search-result-item:hover {
  background: #e6f3ff;
  border-color: var(--bs-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(30, 60, 90, 0.08);
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-info strong {
  color: var(--bs-heading);
}

.search-result-meta {
  color: #666;
  font-size: 0.95rem;
}

.search-result-actions {
  display: flex;
  gap: 8px;
}

.viewTranscriptFromSearchBtn {
  background: var(--bs-primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.viewTranscriptFromSearchBtn:hover {
  background: var(--bs-accent);
}

/* Form Enhancements */
.form-row {
  margin-bottom: 16px;
}

.form-row label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--bs-heading);
}

.date-range {
  display: flex;
  gap: 16px;
  align-items: center;
}

.date-range > div {
  flex: 1;
}

/* Button Group Styles */
.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.button-group button {
  margin: 0;
}

/* Progress and Status Styles */
.progress-container {
  width: 100%;
  height: 20px;
  background-color: #f3f3f3;
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: #4CAF50;
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.upload-status {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.95rem;
}

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

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

.upload-status.pending {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* Spinner Animation */
.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 4px solid var(--bs-gray);
  border-top: 4px solid var(--bs-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

/* Team Results Styles */
.team-summary {
  background: #f0f0f0;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  border-left: 4px solid var(--bs-primary);
}

.team-summary h4 {
  margin-top: 0;
  color: var(--bs-heading);
}

.agent-link {
  color: var(--bs-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.agent-link:hover {
  color: var(--bs-accent);
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-content {
    width: 95vw;
    padding: 20px 16px;
  }
  
  .transcript-bubble {
    max-width: 90%;
    padding: 10px 14px;
  }
  
  .date-range {
    flex-direction: column;
    gap: 8px;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .button-group button {
    width: 100%;
  }
  
  .search-result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .search-result-actions {
    align-self: stretch;
  }
  
  .viewTranscriptFromSearchBtn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .qa-results-table {
    font-size: 0.85rem;
  }
  
  .qa-results-table th,
  .qa-results-table td {
    padding: 8px 4px;
  }
  
  .agent-section {
    padding: 8px 12px;
  }
  
  .modal-content {
    padding: 16px 12px;
  }
}

/* Print Styles */
@media print {
  .modal {
    display: block !important;
    position: static;
    background: none;
  }
  
  .modal-content {
    box-shadow: none;
    max-width: none;
    max-height: none;
  }
  
  .modal-close,
  .chat-container,
  .button-group,
  .downloadPdfBtn,
  .viewTranscriptBtn,
  .viewQaDetailBtn {
    display: none !important;
  }
}

/* Agent Transcript Analysis Component */
.analysis-results {
  background: var(--bs-background-light);
  border-radius: 8px;
  padding: 24px;
  margin-top: 20px;
  border: 1px solid var(--bs-border-color);
}

.analysis-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bs-border-color);
}

.analysis-header h3 {
  margin: 0 0 8px 0;
  color: var(--bs-text-primary);
  font-size: 1.4rem;
}

.analysis-period {
  margin: 0;
  color: var(--bs-text-secondary);
  font-size: 1rem;
  font-style: italic;
}

.structured-analysis {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.analysis-section {
  background: var(--bs-white);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--bs-border-color);
}

.analysis-section h4 {
  margin: 0 0 16px 0;
  color: var(--bs-text-primary);
  font-size: 1.2rem;
  font-weight: 600;
  border-bottom: 1px solid var(--bs-border-color);
  padding-bottom: 8px;
}

.findings-list,
.patterns-list,
.recommendations-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.findings-list li,
.patterns-list li,
.recommendations-list li {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bs-background-light);
  border-radius: 6px;
  border-left: 4px solid var(--bs-primary);
}

.findings-list li strong,
.patterns-list li strong,
.recommendations-list li strong {
  color: var(--bs-text-primary);
  font-weight: 600;
}

.severity-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
}

.severity-badge.high {
  background: var(--bs-error);
  color: white;
}

.severity-badge.medium {
  background: var(--bs-warning);
  color: white;
}

.severity-badge.low {
  background: var(--bs-success);
  color: white;
}

.evidence {
  margin-top: 8px;
  padding: 8px;
  background: var(--bs-background-light);
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--bs-text-secondary);
  border-left: 3px solid var(--bs-secondary);
}

.examples-list {
  list-style: disc;
  margin-left: 20px;
  margin-top: 8px;
}

.examples-list li {
  margin-bottom: 4px;
  padding: 4px 0;
  background: none;
  border: none;
  border-left: none;
  color: var(--bs-text-secondary);
}

.target-area {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bs-secondary);
  color: white;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-left: 8px;
}

.benefit {
  margin-top: 8px;
  padding: 8px;
  background: var(--bs-success-light);
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--bs-text-secondary);
  border-left: 3px solid var(--bs-success);
}

.custom-prompt-response {
  background: var(--bs-background-light);
  border-radius: 6px;
  padding: 16px;
  border: 1px solid var(--bs-border-color);
}

.custom-prompt-response .prompt {
  margin-bottom: 12px;
  padding: 8px;
  background: var(--bs-primary-light);
  border-radius: 4px;
}

.custom-prompt-response .response {
  padding: 8px;
  background: var(--bs-success-light);
  border-radius: 4px;
}

.plain-analysis {
  background: var(--bs-white);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--bs-border-color);
}

.plain-analysis pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--bs-text-primary);
  margin: 0;
}

.status-message {
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 500;
  margin-top: 10px;
}

.status-message.success {
  background: var(--bs-success-light);
  color: var(--bs-success);
  border: 1px solid var(--bs-success);
}

.status-message.error {
  background: var(--bs-error-light);
  color: var(--bs-error);
  border: 1px solid var(--bs-error);
}

.status-message.info {
  background: var(--bs-primary-light);
  color: var(--bs-primary);
  border: 1px solid var(--bs-primary);
}

/* Responsive adjustments for Agent Transcript Analysis */
@media (max-width: 768px) {
  .analysis-results {
    padding: 16px;
  }
  
  .analysis-section {
    padding: 16px;
  }
  
  .analysis-header h3 {
    font-size: 1.2rem;
  }
  
  .analysis-section h4 {
    font-size: 1.1rem;
  }
}

/* === TEAM BEST CALLS STYLES === */
.team-best-calls {
  margin: 30px 0;
  padding: 25px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  border: 1px solid #dee2e6;
}

.team-best-calls h4 {
  color: #495057;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
}

.team-calls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.team-best-call-card {
  background: white;
  border: 2px solid #28a745;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.team-best-call-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  border-color: #20c997;
}

.team-best-call-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #28a745, #20c997);
}

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

.team-badge {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.team-badge-small {
  background: linear-gradient(135deg, #6c757d, #495057);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.best-call-title {
  color: #28a745;
  font-size: 14px;
  margin: 0;
  font-weight: 600;
}

.call-score {
  text-align: center;
  margin: 15px 0;
}

.call-score .score-value {
  font-size: 36px;
  font-weight: bold;
  display: block;
  line-height: 1;
}

.call-score .score-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

.call-details {
  margin: 15px 0;
}

.call-details .detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #f8f9fa;
}

.call-details .detail-row:last-child {
  border-bottom: none;
}

.call-details .detail-label {
  font-weight: 500;
  color: #6c757d;
  font-size: 13px;
}

.call-details .detail-value {
  font-weight: 600;
  color: #495057;
  font-size: 13px;
}

.call-actions {
  margin-top: 20px;
  text-align: center;
}

.view-transcript-btn {
  background: linear-gradient(135deg, #007bff, #0056b3);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.view-transcript-btn:hover {
  background: linear-gradient(135deg, #0056b3, #004085);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.winners-grid .winner-card .team-badge-small {
  margin-top: 5px;
  font-size: 10px;
}

/* Responsive adjustments for team best calls */
@media (max-width: 768px) {
  .team-calls-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .team-best-call-card {
    padding: 15px;
  }
  
  .call-score .score-value {
    font-size: 28px;
  }
}