/* Base sizing for predictable layouts. */
* {
  box-sizing: border-box;
}

/* Global typography and background. */
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #0d1b2a;
  background: #f5f7fb;
}

/* Theme tokens for consistent color usage. */
:root {
  --primary: #2f5bff;
  --primary-dark: #1c3fcc;
  --secondary: #eef2ff;
  --border: #d9e2f0;
  --muted: #5e6a79;
  --success: #1f9d55;
  --warning: #ff8800;
  --danger: #dc2626;
}

/* Utility layout helpers for consistent spacing. */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-center {
  justify-content: center;
}

.row-between {
  justify-content: space-between;
}

.row-wrap {
  flex-wrap: wrap;
}

.row-sm {
  gap: 8px;
}

.row-lg {
  gap: 16px;
}

[hidden] {
  display: none !important;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.grid {
  display: grid;
  gap: 24px;
}

.upload-zone {
  display: grid;
  grid-template-columns: 1fr;
}

.grid-review {
  grid-template-columns: 1.05fr 1.4fr;
}

.grid-post {
  grid-template-columns: 1.2fr 1fr;
}

/* App header layout and sticky behavior. */
header.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Main content width and padding. */
.container {
  max-width: 1080px;
  margin: 32px auto 48px;
  padding: 0 24px;
}

/* Page intro. */
.instructions {
  margin-bottom: 24px;
}

.instructions h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.instructions p {
  margin: 0;
  color: var(--muted);
}

/* 3-step progress indicator. */
.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.step {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.step.is-active {
  border-color: var(--primary);
  color: #0d1b2a;
  box-shadow: 0 0 0 2px rgba(47, 91, 255, 0.1);
}

/* Step number badge. */
.step-index {
  background: var(--secondary);
  color: var(--primary);
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 24px rgba(13, 27, 42, 0.05);
}

/* Upload dropzone styling + active drag state. */
.upload-dropzone {
  border: 2px dashed #c7d3e8;
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  background: #f9fbff;
  width: 100%;
}

.prompt {
  border: 2px dashed #c7d3e8;
  padding: 16px;
  border-radius: 16px;
  text-align: center;
  background: #f9fbff;
  width: 100%;
}

.upload-dropzone.is-dragover {
  border-color: var(--primary);
  background: #eef2ff;
}

/* Upload panel micro UI. */
.upload-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.upload-actions {
  margin: 20px 0 14px;
}

.upload-tips {
  color: var(--muted);
  font-size: 13px;
}

.assignment-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #d9e1f2;
  display: flex;
  flex-direction: row;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
}

#assignmentPrompt textarea {
  width: 100%;
  max-width: 640px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

#quizQuestions .field-card {
  width: 100%;
}

#quizQuestions {
  width: 100%;
}

/* Secondary text utility. */
.mini-muted {
  color: var(--muted);
  font-size: 13px;
}

.image-preview {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f7f9fc;
  min-height: 320px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.image-placeholder {
  color: var(--muted);
}

.image-preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.image-preview img[hidden] {
  display: none;
}

/* Attention badge for review issues. */
.issues-pill {
  background: #fff4e6;
  color: var(--warning);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* Field container card. */
.field-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fcfdff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-card + .field-card {
  margin-top: 12px;
}

/* Field labels and pseudo-labels. */
.field-card label,
.field-card .field-label {
  font-size: 13px;
  font-weight: 600;
  color: #1f2a37;
}

/* Align control + confidence chip. */
.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

/* Base inputs, selects, and textareas. */
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background-color: #fff;
}

/* Custom select dropdown caret. */
select {
  appearance: none;
  padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%),
    linear-gradient(135deg, #6b7280 50%, transparent 50%),
    linear-gradient(to right, #e2e8f0, #e2e8f0);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%,
    calc(100% - 36px) 50%;
  background-size: 6px 6px, 6px 6px, 1px 18px;
  background-repeat: no-repeat;
}

select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Inline validation hint. */
.field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}

/* Confidence chips. */
.chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.chip-high {
  background: #e9f9ef;
  color: var(--success);
}

.chip-medium {
  background: #fff5e5;
  color: var(--warning);
}

.chip-low {
  background: #fde8e8;
  color: var(--danger);
}

/* AI suggestion disclosure. */
.ai-suggestions {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f9fbff;
}

.segmented-button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: #ffffff;
  cursor: pointer;
}

.segmented-button.is-active {
  background: var(--secondary);
  color: var(--primary);
  border-color: var(--primary);
}

/* Canvas-style assignment preview. */
.preview-card {
  background: #f7f9ff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #d6e1ff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Preview content hierarchy. */
.preview-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.preview-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Success confirmation card. */
.success-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #c7f0d1;
  background: #e9f9ef;
  display: none;
  gap: 8px;
}

.success-card h4 {
  margin: 0 0 6px;
}

/* Primary/secondary/ghost button base styles. */
.button1,
.button2,
.button3 {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.button1 {
  background: var(--primary);
  color: #ffffff;
}

.button1:hover {
  background: var(--primary-dark);
}

/* Secondary and neutral button styles. */
.button2 {
  background: #ffffff;
  border: 1px solid var(--border);
}

.button3 {
  background: transparent;
  color: #1f2a37;
  border: 1px solid var(--border);
}

.courses {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-good {
  color: var(--success);
  font-weight: 600;
}

.status-warning {
  color: var(--warning);
  font-weight: 600;
}

.status-fail {
  color: var(--danger);
  font-weight: 600;
}

.button2 + .status-good {
  background: var(--success);
  color: #ffffff;
}

/* Posting progress indicator. */
.progress {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

/* Simple progress bar. */
.progress-bar {
  height: 6px;
  width: 160px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #9eb2ff);
}

/* Toggle switch visuals. */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: 0.2s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* Shared hidden state for panels. */
.step-panel.is-hidden {
  display: none;
}

/* Footer microcopy. */
.footer {
  text-align: center;
  padding: 24px 12px 40px;
  color: var(--muted);
  font-size: 13px;
}

/* Responsive layout changes for tablets/phones. */
@media (max-width: 900px) {
  .grid-upload,
  .grid-review,
  .grid-post {
    grid-template-columns: 1fr;
  }

  .stepper {
    grid-template-columns: 1fr;
  }

  header.top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

.nav-links {
  flex-wrap: wrap;
}
}
