/* ICOSA Behavioral Observation Framework v1.0 — Fixed Layout */

.obs-framework {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.obs-boundary-notice {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(108,99,255,0.06);
  border: 1px solid rgba(108,99,255,0.2);
  border-left: 3px solid #6c63ff;
  border-radius: 8px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.6;
}
.obs-boundary-notice div { min-width: 0; }
.obs-boundary-notice strong { color: #e2e8f0; }
.obs-boundary-notice em { color: #a78bfa; font-style: normal; font-weight: 600; }
.obs-boundary-icon { font-size: 18px; color: #6c63ff; margin-top: 2px; flex-shrink: 0; }

.obs-section {
  background: #0b0f1e;
  border: 1px solid rgba(108,99,255,0.15);
  border-radius: 10px;
  padding: 16px;
  position: relative;
  transition: opacity 0.3s, filter 0.3s;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
.obs-section.obs-locked {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(0.5);
}
.obs-section.obs-locked::after {
  content: 'Complete previous step to unlock';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(5,7,16,0.9);
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(108,99,255,0.2);
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
}

.obs-step-badge {
  position: absolute;
  top: -10px;
  left: 16px;
  background: #6c63ff;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.obs-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 6px;
  margin-top: 4px;
}
.obs-section-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 14px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Risk classification grid */
.obs-risk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
@media(max-width:640px) { .obs-risk-grid { grid-template-columns: 1fr; } }

.obs-risk-card {
  background: #111827;
  border: 2px solid rgba(108,99,255,0.12);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-width: 0;
  overflow: hidden;
}
.obs-risk-card:hover { border-color: rgba(108,99,255,0.4); }
.obs-risk-card.obs-risk-selected { border-color: #6c63ff; background: rgba(108,99,255,0.08); }
.obs-risk-label { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.obs-risk-desc { font-size: 10px; color: #64748b; line-height: 1.5; overflow-wrap: break-word; }

/* Threshold bar */
.obs-threshold-bar {
  background: #111827;
  border: 1px solid rgba(108,99,255,0.15);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}
.obs-thresh-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.obs-thresh-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media(max-width:640px) { .obs-thresh-grid { grid-template-columns: repeat(2, 1fr); } }
.obs-thresh-item {
  background: #050710;
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}
.obs-thresh-val {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.obs-thresh-label {
  display: block;
  font-size: 8px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

/* Form fields */
.obs-field-group {
  margin-bottom: 14px;
  min-width: 0;
}
.obs-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
}
.obs-req { color: #ef4444; }
.obs-hint { font-weight: 400; color: #64748b; font-size: 11px; }
.obs-hint-block {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(108,99,255,0.04);
  border-radius: 4px;
}

.obs-select, .obs-input, .obs-textarea {
  width: 100%;
  max-width: 100%;
  background: #111827;
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.obs-select:focus, .obs-input:focus, .obs-textarea:focus {
  border-color: #6c63ff;
  box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
}
.obs-textarea { resize: vertical; min-height: 80px; }
.obs-input + .obs-input { margin-top: 8px; }

/* Checkbox grid — THIS IS THE KEY FIX */
.obs-checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
}
.obs-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
  line-height: 1.5;
  min-width: 0;
  width: 100%;
}
.obs-check-item:hover { background: rgba(108,99,255,0.05); }
.obs-check-item input[type=checkbox] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  margin-top: 2px;
  accent-color: #6c63ff;
  flex-shrink: 0;
  flex-grow: 0;
}
/* Force the label text to take remaining space and wrap */
.obs-check-item > span {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.obs-check-item span,
.obs-check-item label,
.obs-check-item {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* Radio row */
.obs-radio-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.obs-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
}
.obs-radio input {
  accent-color: #6c63ff;
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex-shrink: 0;
}

/* Behavior categories */
.obs-behavior-cat {
  margin-bottom: 14px;
  min-width: 0;
  width: 100%;
}
.obs-cat-title {
  font-size: 12px;
  font-weight: 700;
  color: #a78bfa;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Validation status */
.obs-validation-status { margin-top: 12px; }
.obs-status-pass {
  padding: 10px 14px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 8px;
  color: #22c55e;
  font-size: 12px;
  font-weight: 600;
}
.obs-status-fail {
  padding: 10px 14px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.6;
}
.obs-status-fail strong { color: #ef4444; }
.obs-status-fail ul { margin: 6px 0 0 16px; padding: 0; }
.obs-status-fail li { margin-bottom: 3px; }

/* Legal attestation */
.obs-attestation-box {
  background: #111827;
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 8px;
  padding: 16px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.7;
  overflow: hidden;
}
.obs-attestation-box p { color: #e2e8f0; font-weight: 600; margin-bottom: 8px; }
.obs-attestation-box ol {
  margin: 0 0 14px 18px;
  padding: 0;
}
.obs-attestation-box li { margin-bottom: 6px; }
.obs-legal-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 12px;
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.1);
  border-radius: 6px;
}
.obs-legal-check input {
  accent-color: #ef4444;
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  min-width: 16px;
}

/* Deployment Context (Step A) */
.obs-radio-col { display: flex; flex-direction: column; gap: 8px; }
.obs-context-option { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.obs-context-option:hover { border-color: var(--accent); background: rgba(108,99,255,0.05); }
.obs-context-option:has(input:checked) { border-color: var(--cyan); background: rgba(56,189,248,0.06); }
.obs-context-option input[type="radio"] { margin-top: 2px; accent-color: var(--cyan); }
.obs-context-option span { font-size: 13px; color: var(--text); line-height: 1.4; }
