/* FHIR Project Proposal Fitment - Main Styles */

:root {
  --maxw: 1200px;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-light: #ccfbf1;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #ffedd5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --bg: #f7f3ee;
  --card: #fffdf9;
  --border: #e7e1d8;
  --text: #1f2933;
  --text-muted: #6b7280;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
}

* {
  box-sizing: border-box;
}

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

/* Header */
header {
  background: linear-gradient(135deg, var(--primary) 0%, #0b4f4a 100%);
  color: #fff;
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-lg);
}

header .wrap {
  max-width: var(--maxw);
  margin: 0 auto;
}

header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

header p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.95;
  line-height: 1.5;
}

.disclaimer {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  border-left: 4px solid #fbbf24;
  font-size: 0.875rem;
}

/* Main Layout */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  main {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem 3rem;
  }
}

@media (max-width: 640px) {
  main {
    padding: 1rem 0.75rem 2rem;
    gap: 1rem;
  }
  header { padding: 1.5rem 1rem; }
  header h1 { font-size: 1.5rem; }
  header p { font-size: 0.875rem; }
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.card-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.card-body {
  padding: 1.5rem;
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  transition: width 0.3s ease;
  border-radius: 999px;
}

/* Questions */
.question-section {
  margin-bottom: 1.5rem;
}

.question-number {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.question-hint {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
}

.question-type {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary-dark);
  margin-left: 0.5rem;
}

/* Options */
.options {
  display: grid;
  gap: 0.875rem;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.option-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.option-btn.selected::before {
  content: "✓";
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.875rem;
}

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

.option-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.option-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.option-score {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-weight: 500;
  background: var(--success-light);
  color: #065f46;
}

/* Navigation */
.nav-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: #111827;
  border-color: #111827;
  color: #f9fafb;
}

.btn-primary:hover:not(:disabled) {
  background: #0b1220;
  border-color: #0b1220;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
}

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

.btn-success {
  background: #1f2937;
  border-color: #1f2937;
  color: #f9fafb;
}

.btn-danger {
  background: #111827;
  border-color: #111827;
  color: #f9fafb;
}

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

/* Shared Modal */
.ui-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 3000;
}

.ui-modal.open {
  display: flex;
}

.ui-modal-content {
  width: min(100%, 520px);
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ui-modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.ui-modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.ui-modal-body {
  padding: 1rem 1.25rem;
  color: var(--text);
}

.ui-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.25rem 1rem;
}

/* Score Panel */
.score-panel {
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border);
}

.score-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.score-value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.score-bar {
  flex: 1;
  height: 1.5rem;
  background: white;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid var(--border);
  position: relative;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--danger) 0%, var(--warning) 40%, var(--success) 100%);
  transition: width 0.4s ease;
  border-radius: 999px;
}

.score-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 4px white;
}

/* Status Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.excellent {
  background: var(--success-light);
  color: #065f46;
  border: 2px solid #6ee7b7;
}

.badge.good {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 2px solid #93c5fd;
}

.badge.needs_work {
  background: var(--warning-light);
  color: #92400e;
  border: 2px solid #fcd34d;
}

.badge.high_risk {
  background: var(--danger-light);
  color: #991b1b;
  border: 2px solid #fca5a5;
}

/* Answer Log */
.answer-log {
  margin-top: 1.5rem;
}

.answer-item {
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--primary);
}

.answer-question {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.answer-value {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Info Boxes */
.info-box {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  border: 1px solid var(--border);
}

.info-box p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.info-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Footer */
footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.5rem;
  margin-top: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer p {
  max-width: var(--maxw);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #111827;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ==================== Admin Styles ==================== */

.admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.question-editor {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.question-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.options-editor {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
}

.option-editor {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.option-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Login Form */
.login-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 0 1rem;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.login-card h2 {
  margin: 0 0 1.5rem;
  text-align: center;
  color: var(--text);
}

.error-message {
  background: var(--danger-light);
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 640px) {
  .card { border-radius: var(--radius-sm); }
  .card-header { padding: 1rem 1.25rem; }
  .card-body { padding: 1.25rem; }
  .score-value { font-size: 2.5rem; }
  .score-panel { padding: 1.25rem; }
  .question-text { font-size: 1.125rem; }
  .question-number { font-size: 0.8125rem; padding: 0.25rem 0.625rem; }
  .option-label { font-size: 0.9375rem; }
  .option-desc { font-size: 0.8125rem; }
  .option-btn { padding: 0.875rem 1rem; }
  .nav-buttons { gap: 0.5rem; }
  .btn { padding: 0.5rem 1rem; font-size: 0.875rem; }
  .score-display { flex-direction: column; align-items: stretch; }
  .score-bar { height: 1.25rem; }
}
