/* Chrysalis Psychometric Tests Stylesheet */

/* Forms & Questions */
.question-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--card-border);
  border-left: 5px solid transparent;
  transition: all 0.25s ease;
  animation: fadeIn 0.4s ease-out;
}

@media (min-width: 768px) {
  .question-item {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.question-item:hover {
  background-color: var(--primary-alpha);
}

.question-item.active-question {
  background-color: var(--primary-alpha);
  border-left-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

body[data-theme="dark"] .question-item.active-question {
  background-color: rgba(59, 130, 246, 0.15);
  border-left-color: var(--primary);
}

.q-number {
  font-weight: 700;
  color: var(--primary);
  margin-right: 0.5rem;
  font-size: 1rem;
}

.q-text {
  font-size: 0.92rem;
  color: var(--text-main);
  font-weight: 500;
}

/* Option Buttons (0, 1, 2, 3) */
.options-group {
  display: flex;
  gap: 0.4rem;
}

.option-cell {
  position: relative;
}

.option-cell input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.option-cell label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--card-border);
  background-color: var(--bg-body);
  border-radius: 50%;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  user-select: none;
}

.option-cell input:checked + label {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
  transform: scale(1.08);
}

.option-cell label:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Impairment Options */
.options-group-impairment {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  width: 100%;
}

@media (min-width: 768px) {
  .options-group-impairment {
    display: flex;
    width: auto;
  }
}

.option-cell-impairment {
  position: relative;
}

.option-cell-impairment input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.option-cell-impairment label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.6rem;
  min-width: 60px;
  height: 44px;
  border: 1px solid var(--card-border);
  background-color: var(--bg-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.option-cell-impairment label span.val {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

.option-cell-impairment label span.desc {
  font-size: 0.62rem;
  color: var(--text-secondary);
  text-align: center;
  display: block;
}

.option-cell-impairment input:checked + label {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.option-cell-impairment input:checked + label span.val,
.option-cell-impairment input:checked + label span.desc {
  color: white;
}

.option-cell-impairment label:hover {
  border-color: var(--primary);
}

/* Clinical Score Cards */
.scores-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .scores-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.score-box {
  background-color: var(--bg-body);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  transition: all 0.25s ease;
}

.score-box:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.15);
}

.score-box.highlight {
  background-color: var(--primary-alpha);
  border-color: var(--primary);
}

.score-box.highlight .lbl {
  color: var(--primary);
}

.score-box .lbl {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.score-box .num {
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--text-main);
  line-height: 1.1;
}

.score-box .num span.pct {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-left: 0.1rem;
  font-weight: 600;
}

.score-box .clinical-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

.score-box .clinical-pill.normal {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.score-box .clinical-pill.risk {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  animation: pulse 2s infinite;
}

/* Charts */
.chart-container {
  background-color: var(--bg-body);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 130px 1fr 40px;
  align-items: center;
  gap: 1rem;
}

.chart-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-track {
  height: 12px;
  background-color: var(--card-border);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  width: 0%;
  transition: width 0.8s ease-out;
}

.chart-bar-fill.risk {
  background: linear-gradient(90deg, #ef4444, #f59e0b);
}

.chart-bar-threshold {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: #ef4444;
  opacity: 0.6;
  z-index: 2;
}

.chart-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
}

/* Report results table */
.report-results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.report-results-table th, 
.report-results-table td {
  border: 1px solid var(--card-border);
  padding: 0.5rem 0.75rem;
  text-align: center;
  color: #2d3748;
}

.report-results-table th {
  background-color: #f7fafc;
  font-weight: 700;
}

.report-results-table td.align-left {
  text-align: left;
  font-weight: 600;
}

/* Animations */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Test-specific printing rules */
@media print {
  .no-print {
    display: none !important;
  }
}

/* Printing chrysalis test report */
body.print-mode-test-report {
  background: white !important;
  color: black !important;
}

body.print-mode-test-report .sidebar,
body.print-mode-test-report .header-top,
body.print-mode-test-report .tab-subnavigation,
body.print-mode-test-report .patient-header-card,
body.print-mode-test-report .note-creation-block,
body.print-mode-test-report #completedTestsSection,
body.print-mode-test-report .no-print {
  display: none !important;
}

body.print-mode-test-report .app-container {
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.print-mode-test-report .main-content {
  margin-left: 0 !important;
  padding: 0 !important;
}

body.print-mode-test-report #activeTestWorkspace {
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: white !important;
  color: black !important;
}

body.print-mode-test-report .report-view {
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: white !important;
  color: black !important;
}
