/* results.css - Session Results Review Page */

/* =========================================================================
   Page header — override global header{background:#6CBEDA} from styles.css
   ========================================================================= */

/* Content area — make scrollable within admin-layout */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.admin-header {
  background: transparent;
  padding: 0;
}

/* =========================================================================
   Filters
   ========================================================================= */

.results-filters {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #1e293b;
  border-radius: 8px;
  border: 1px solid #334155;
}

.results-filters__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.results-filters__group label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-filters__group select,
.results-filters__group input {
  padding: 0.5rem 0.75rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.875rem;
  min-width: 160px;
}

.results-filters__group select:focus,
.results-filters__group input:focus {
  outline: none;
  border-color: #60a5fa;
}

.btn-primary-sm {
  padding: 0.5rem 1.25rem;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary-sm:hover {
  background: #2563eb;
}

/* =========================================================================
   Session list
   ========================================================================= */

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.results-list__loading,
.results-list__empty {
  text-align: center;
  padding: 3rem;
  color: #64748b;
  font-size: 0.9rem;
}

.results-card {
  padding: 0.875rem 1rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.results-card:hover {
  border-color: #475569;
  background: #1e293b;
}

.results-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}

.results-card__scenario {
  font-weight: 600;
  color: #f1f5f9;
  font-size: 0.9rem;
}

.results-card__date {
  color: #64748b;
  font-size: 0.8rem;
}

.results-card__bottom {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.results-card__participant {
  color: #94a3b8;
  font-size: 0.85rem;
}

.results-card__duration {
  color: #64748b;
  font-size: 0.8rem;
}

.results-card__score {
  background: #166534;
  color: #86efac;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.results-card__audio-icon {
  color: #60a5fa;
  flex-shrink: 0;
}

.results-card__audio-expired {
  color: #64748b;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.results-card__audio-expiring {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #f59e0b;
}

.results-card__expiry-badge {
  font-size: 0.7rem;
  color: #f59e0b;
  white-space: nowrap;
  font-weight: 600;
}

.results-card__transcripts {
  color: #64748b;
  font-size: 0.8rem;
}

.results-card__feedback-preview {
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid #293548;
  color: #94a3b8;
  font-size: 0.8rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-muted {
  color: #475569;
  font-style: italic;
}

/* =========================================================================
   Pagination
   ========================================================================= */

.results-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
}

.results-pagination__btn {
  padding: 0.4rem 1rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.results-pagination__btn:hover {
  background: #334155;
}

.results-pagination__info {
  color: #64748b;
  font-size: 0.85rem;
}

/* =========================================================================
   Session Detail Modal
   ========================================================================= */

.results-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.results-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.results-modal__content {
  position: relative;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
}

.results-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.results-modal__close:hover {
  color: #f1f5f9;
}

.results-modal__header {
  margin-bottom: 1rem;
}

.results-modal__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0 0 0.5rem;
}

.results-modal__meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #94a3b8;
}

.results-modal__score {
  color: #86efac;
  font-weight: 600;
}

/* Audio */
.results-modal__audio {
  margin-bottom: 1rem;
}

.results-modal__audio audio {
  width: 100%;
  border-radius: 8px;
}

.results-modal__audio-expired-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #1a1a2e;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 0.85rem;
}

.results-modal__audio-expired-notice svg {
  flex-shrink: 0;
  color: #64748b;
}

.results-modal__audio-expiry-notice {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 6px;
  color: #f59e0b;
  font-size: 0.8rem;
}

/* Feedback */
.results-modal__feedback {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid #334155;
}

.results-modal__feedback h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
}

.results-modal__feedback-text {
  color: #cbd5e1;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Transcript */
.results-modal__transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.results-modal__content h3 {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
}

.results-modal__audio-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.results-modal__audio-controls audio {
  flex: 1;
}

.btn-secondary-sm {
  padding: 0.35rem 0.75rem;
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-secondary-sm:hover {
  background: #475569;
}

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

.results-modal__transcript {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: visible;
}

.transcript-bubble {
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  max-width: 85%;
}

.transcript-bubble--user {
  background: #1e3a5f;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.transcript-bubble--assistant {
  background: #334155;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.transcript-bubble__speaker {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 2px;
}

.transcript-bubble__text {
  color: #e2e8f0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.transcript-bubble__time {
  color: #475569;
  font-size: 0.7rem;
  margin-top: 4px;
  text-align: right;
}

.transcript-bubble[data-start-ms] {
  cursor: pointer;
  transition: opacity 0.15s;
}

.transcript-bubble[data-start-ms]:hover {
  opacity: 0.85;
}

.transcript-bubble--active {
  outline: 2px solid #60a5fa;
  outline-offset: -2px;
  background: #1e3a5f !important;
  transition: outline 0.15s ease, background 0.15s ease;
}

/* =========================================================================
   Toggle label (shared with scenarios.html)
   ========================================================================= */

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  color: #e2e8f0;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

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

@media (max-width: 768px) {
  .results-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .results-filters__group {
    width: 100%;
  }

  .results-filters__group select,
  .results-filters__group input {
    min-width: 100%;
    width: 100%;
  }

  .btn-primary-sm {
    width: 100%;
  }

  .results-card__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .results-modal__content {
    width: 95%;
    max-height: 90vh;
    padding: 1rem;
  }
}
