/*
 * Novocura Clinical Transcription POC
 *
 * Clean, medical-appropriate design with a blue/white/gray palette.
 * Doctor lines are blue-accented, patient lines are green-accented.
 */

/* --- CSS Variables --- */
:root {
  --color-primary: #1a73e8;
  --color-primary-light: #e8f0fe;
  --color-doctor: #1a73e8;
  --color-doctor-bg: #e8f0fe;
  --color-patient: #0d9d58;
  --color-patient-bg: #e6f4ea;
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-text: #202124;
  --color-text-secondary: #5f6368;
  --color-border: #dadce0;
  --color-error: #d93025;
  --color-error-bg: #fce8e6;
  --color-success: #0d9d58;
  --color-recording: #d93025;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Layout --- */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* --- Header --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
}

.provider-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Controls Bar --- */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

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

.btn-start {
  background: var(--color-success);
  color: white;
}

.btn-start:hover:not(:disabled) {
  background: #0b8a4b;
}

.btn-stop {
  background: var(--color-recording);
  color: white;
}

.btn-stop:hover:not(:disabled) {
  background: #c12b20;
}

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

.btn-primary:hover:not(:disabled) {
  background: #1557b0;
}

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

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

/* --- Recording Indicator --- */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-recording);
  font-weight: 500;
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-recording);
  animation: pulse 1.2s ease-in-out infinite;
}

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

/* --- Timer --- */
.timer-display {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  min-width: 48px;
}

/* --- Listening Indicator --- */
.listening-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-success);
  font-weight: 500;
}

.listening-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 0.8s ease-in-out infinite;
}

/* --- Status Bar --- */
.status-bar {
  padding: 8px 24px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  margin-bottom: 16px;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.status-info {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.status-error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* --- Content Panels --- */
.content-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  max-height: 500px;
}

/* --- Transcript Lines --- */
.transcript-line {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.transcript-doctor {
  background: var(--color-doctor-bg);
}

.transcript-patient {
  background: var(--color-patient-bg);
}

.speaker-label {
  font-weight: 600;
  display: inline;
}

.transcript-doctor .speaker-label {
  color: var(--color-doctor);
}

.transcript-patient .speaker-label {
  color: var(--color-patient);
}

.speaker-text {
  color: var(--color-text);
}

/* Pending (in-progress) transcript — italic and lower opacity */
.transcript-pending {
  opacity: 0.6;
  font-style: italic;
}

/* --- Summary Content --- */
.summary-content h3 {
  font-size: 1rem;
  color: var(--color-primary);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
}

.summary-content h3:first-child {
  margin-top: 0;
}

.summary-content h4 {
  font-size: 0.9rem;
  color: var(--color-text);
  margin: 12px 0 6px;
}

.summary-content li {
  margin-left: 20px;
  margin-bottom: 4px;
}

.summary-content strong {
  color: var(--color-text);
}

/* --- Empty state --- */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  text-align: center;
  padding: 40px;
}

/* --- Footer --- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px;
  margin-top: 16px;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

.spacer {
  flex: 1;
}

/* --- Responsive: stack panels on small screens --- */
@media (max-width: 768px) {
  .content-area {
    grid-template-columns: 1fr;
  }

  .app-header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .controls-bar {
    justify-content: center;
  }

  .app-footer {
    justify-content: center;
  }
}
