* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

h1 {
  color: var(--text-primary);
  font-size: 28px;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

.instructions-toggle {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-top: 16px;
  transition: background-color 0.2s;
}

.instructions-toggle:hover {
  background: var(--primary-hover);
}

.instructions-panel {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: none;
}

.instructions-panel.active {
  display: block;
}

.instructions-panel h2 {
  color: var(--text-primary);
  font-size: 20px;
  margin-bottom: 16px;
}

.instructions-panel h3 {
  color: var(--text-primary);
  font-size: 16px;
  margin-top: 20px;
  margin-bottom: 10px;
}

.instructions-panel ul {
  margin-left: 20px;
  margin-bottom: 16px;
}

.instructions-panel li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.analogy-info {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column; /* stack items vertically */
  align-items: center;    /* horizontal centering */
  justify-content: center; /* vertical centering if needed */
  gap: 16px;               /* spacing between stacked children (title + images) */
  padding: 20px;           /* optional padding around content */
}

.concept-header {
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px; /* spacing between leftDiv and any other sections */
}

.concept-header > div {
    display: flex;
    flex-direction: column; /* stack title and images vertically */
    align-items: center;
    gap: 12px; /* spacing between title and images */
}

.analogy-image {
    display: block;
    margin: 0 auto;   /* center horizontally */
}

/* Optional: add margin between images */
#analogyImg + #rulesImg {
    margin-top: 12px;
}

.concept-title {
  font-size: 24px;
  color: var(--text-primary);
  font-weight: 600;
}

.info-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.info-btn {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s;
}

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

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 24px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--bg-color);
  color: var(--text-primary);
}

.modal h2 {
  color: var(--text-primary);
  font-size: 20px;
  margin-bottom: 16px;
  padding-right: 40px;
}

.constraint-item {
  background: var(--bg-color);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  border-left: 3px solid var(--primary-color);
}

.constraint-type {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.constraint-type.static {
  background: #dbeafe;
  color: #1e40af;
}

.constraint-type.dynamic {
  background: #fef3c7;
  color: #92400e;
}

.constraint-type.boundary {
  background: #fce7f3;
  color: #9f1239;
}

.mapping-table {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-header {
  background: var(--primary-color);
  color: white;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-weight: 600;
}

.mapping-row {
  border-bottom: 1px solid var(--border-color);
  padding: 20px;
}

.mapping-row:last-child {
  border-bottom: none;
}

.mapping-row-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.entity-box {
  padding: 12px;
  background: var(--bg-color);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.entity-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.entity-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.evaluation-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.evaluation-item {
  margin-bottom: 20px;
}

.evaluation-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.likert-scale {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.likert-option {
  flex: 1;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.likert-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.likert-option label {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
}

.likert-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

.yes-no-buttons {
  display: flex;
  gap: 12px;
}

.yes-no-btn {
  flex: 1;
  padding: 10px 20px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.yes-no-btn:hover {
  border-color: var(--primary-color);
  background: var(--bg-color);
}

.yes-no-btn.selected.yes {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.yes-no-btn.selected.no {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
}

.diagnostic-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
}

.global-evaluation {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.global-evaluation h2 {
  color: var(--text-primary);
  font-size: 20px;
  margin-bottom: 20px;
}

.participant-info {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.submit-section {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-align: center;
}

.submit-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.submit-btn:hover {
  background: var(--primary-hover);
}

.submit-btn:disabled {
  background: var(--secondary-color);
  cursor: not-allowed;
}

.progress-indicator {
  background: var(--bg-color);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
}

.analytics-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.analytics-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.metric {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Dashboard table */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.submissions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

.submissions-table th,
.submissions-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}

.submissions-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-secondary);
}

.submissions-table tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.submissions-table tr:hover {
    background: #f6f8fb;
}

/* Modal for submission details */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.35);
    padding: 24px;
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
}

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

.close-btn {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-secondary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.detail-card {
    background: #f6f8fb;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

/* API Explorer */
.api-human {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f6f8fb;
    color: var(--text-primary);
    line-height: 1.5;
}

.api-human .tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--secondary-color);
    color: #fff;
    font-size: 12px;
    margin-left: 8px;
}

.api-human .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.api-human .summary-item {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
}

.api-human table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.api-human table th,
.api-human table td {
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    font-size: 13px;
    text-align: left;
}

.api-human table th {
    background: #eef2f7;
}

.api-raw {
    margin-top: 10px;
}

.api-raw summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
}

.api-raw-pre {
    background:#0e1b2c;
    color:#d1e7ff;
    padding:12px;
    border-radius:8px;
    max-height:360px;
    overflow:auto;
    font-size: 12px;
}

.rows-list {
    margin-top: 10px;
}

.row-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: white;
}

.row-item h4 {
    margin: 0 0 6px 0;
}

.timer-panel {
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.timer-panel h4 {
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--text-primary);
}

.timer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.timer-value {
  font-weight: 700;
  color: var(--text-primary);
}

.timer-btn {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.timer-btn:disabled {
  background: var(--secondary-color);
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .mapping-row-header {
    grid-template-columns: 1fr;
  }

  .table-header {
    grid-template-columns: 1fr;
  }

  .likert-scale {
    flex-direction: column;
  }

  .likert-option {
    width: 100%;
  }
}

.quality-warning-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.quality-warning-overlay.active {
  display: flex;
}

.quality-warning-modal {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px 28px;
  width: 420px;
  max-width: calc(100vw - 40px);

  box-shadow: var(--shadow-lg);
  text-align: center;

  animation: qualityModalIn 0.25s ease-out;
}

.quality-warning-modal h3 {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.quality-warning-modal p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.quality-warning-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.quality-warning-btn:hover {
  background: var(--primary-hover);
}

@keyframes qualityModalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

#timerdiv {
   display: none;
}
