/* Survey Admin View — EntityBrowser layout */

/* List cell */
.survey-cell-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.survey-cell-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Detail pane */
.survey-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.survey-detail-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.survey-detail {
  max-width: 720px;
}

/* Legacy card style — kept for compatibility */
.survey-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.survey-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.survey-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.survey-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-draft {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.status-active {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.status-closed {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.status-paused {
  background: rgba(250, 204, 21, 0.15);
  color: var(--warning);
}

.survey-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.survey-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Compact button for survey card actions */
.survey-actions .small-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

.survey-actions .small-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.survey-actions .small-btn.primary-btn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.survey-actions .small-btn.primary-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.survey-actions .small-btn.danger-btn {
  color: var(--error);
  border-color: rgba(248, 113, 113, 0.4);
  background: transparent;
}

.survey-actions .small-btn.danger-btn:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--error);
}

.survey-warn {
  font-size: 12px;
  color: var(--warning);
  font-style: italic;
}

/* --- Survey Edit Form --- */

.survey-edit-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  max-height: 70vh;
  overflow-y: auto;
}

.se-section {
  margin-bottom: 24px;
}

.se-section h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.se-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.se-section-header h4 {
  margin: 0;
}

.se-field {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.se-field span {
  display: block;
  margin-bottom: 4px;
}

.se-field input,
.se-field textarea,
.se-field select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  box-sizing: border-box;
}

.se-field textarea {
  resize: vertical;
}

/* Question rows */

.se-questions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.se-question {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.se-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.se-question-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.se-question-controls {
  display: flex;
  gap: 4px;
}

.se-question-controls .icon-btn {
  font-size: 14px;
  padding: 2px 6px;
  min-width: 24px;
  cursor: pointer;
}

.se-question-controls .icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.se-question-body {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 8px;
}

.se-question-body .se-options-field {
  grid-column: 1 / -1;
}

/* Form actions */

.se-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--bg-surface);
  padding-bottom: 4px;
}

.se-form-actions .small-btn,
.se-section-header .small-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

.se-form-actions .small-btn:hover,
.se-section-header .small-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.se-form-actions .small-btn.primary-btn,
.se-section-header .small-btn.primary-btn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.se-form-actions .small-btn.primary-btn:hover,
.se-section-header .small-btn.primary-btn:hover {
  background: var(--accent-dim);
}

.se-form-actions .small-btn.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.se-save-status {
  font-size: 12px;
  margin-left: 4px;
}

/* --- Survey Responses Panel --- */

.survey-responses-panel {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  max-height: 70vh;
  overflow-y: auto;
}

.sr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sr-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sr-date-range {
  font-size: 11px;
  color: var(--text-muted);
}

.sr-question {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.sr-question-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sr-question-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Rating breakdown */

.sr-rating {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.sr-avg {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  min-width: 48px;
  text-align: center;
}

.sr-avg-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.sr-rating-bars {
  flex: 1;
}

.sr-rating-row,
.sr-choice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.sr-rating-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 12px;
  text-align: right;
}

.sr-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
}

.sr-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.3s ease;
}

.sr-bar-choice {
  background: rgba(124, 107, 196, 0.6);
}

.sr-rating-count {
  font-size: 11px;
  color: var(--text-muted);
  width: 24px;
  text-align: right;
}

/* Choice breakdown */

.sr-choices {
  max-width: 400px;
}

.sr-choice-label {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 100px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Freeform responses */

.sr-freeform {
  max-height: 200px;
  overflow-y: auto;
}

.sr-freeform-item {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-left: 2px solid var(--border);
  margin-bottom: 4px;
  line-height: 1.4;
}

.sr-freeform-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
