/* CourseForge — Step 4 Skeleton Styles
   Theme inspired by provided screenshot:
   - Light academic theme with blue primary and yellow accent
   - Inter for body; Merriweather for headings
   - Generous whitespace, clear hierarchy, accessible contrasts
*/

:root {
  --brand-blue: #1e73be;
  --brand-blue-600: #155da0;
  --brand-navy: #1f2937; /* headings/body text */
  --accent-yellow: #ffd500;
  --surface: #f3f4f6; /* light grey sections */
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --focus: #2563eb;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.12);
  --container: 1100px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial,
    "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  font-family: "Merriweather", Georgia, "Times New Roman", serif;
  color: var(--brand-navy);
  margin: 0 0 0.6rem;
  line-height: 1.2;
}

p {
  margin: 0 0 1rem;
  color: var(--text);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header (brand only) */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #0f3a6b 0%, var(--brand-blue) 70%);
  box-shadow: var(--shadow-sm);
}

.brand-text {
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--brand-navy);
  font-size: 1.125rem;
}

/* Hero (gradient background, big heading with yellow accent) */
.hero {
  position: relative;
  background: linear-gradient(
    135deg,
    #0f2d52 0%,
    var(--brand-blue) 65%,
    #2a95ff 100%
  );
  color: #fff;
  padding: 56px 0;
}

.hero::after {
  /* subtle dark overlay to increase contrast */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15));
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  color: #fff;
  font-size: clamp(2.2rem, 4vw + 1rem, 3.25rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.6rem;
}

.hero-sub {
  color: #e5efff;
  max-width: 680px;
  font-size: 1.05rem;
}

.highlight {
  color: var(--accent-yellow);
}

/* Section blocks */
.section {
  padding: 40px 0;
}

.surface {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-heading {
  font-size: clamp(1.6rem, 2.2vw + 1rem, 2.2rem);
  font-weight: 900;
}

.section-lead {
  color: var(--muted);
  max-width: 820px;
}

/* Form */
.form-row {
  margin-bottom: 18px;
}

.label {
  display: inline-block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--brand-navy);
}

/* Hover tooltips for field titles (labels) using data-hint set by JS */
.label[data-hint] {
  position: relative;
  cursor: help;
}

.label[data-hint]::after {
  content: attr(data-hint);
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  background: #111827; /* near var(--brand-navy) for contrast */
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.3;
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  white-space: normal;
  max-width: 420px;
  z-index: 20;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

.label[data-hint]::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 12px;
  margin-top: 2px;
  border: 6px solid transparent;
  border-top-color: #111827;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease;
}

.label[data-hint]:hover::after,
.label[data-hint]:hover::before {
  opacity: 1;
  transform: translateY(0);
}

/* Field label emoji icons */
.label[for]::before {
  display: inline-block;
  margin-right: 6px;
}

/* Per-field icons */
.label[for="title"]::before { content: "📘 "; }
.label[for="description"]::before { content: "📝 "; }
.label[for="clos"]::before { content: "🎯 "; }
.label[for="plos"]::before { content: "🎓 "; }
.label[for="creditHours"]::before { content: "⏱️ "; }
.label[for="keyTopics"]::before { content: "📚 "; }
.label[for="keyTakeaways"]::before { content: "💡 "; }
.label[for="prerequisites"]::before { content: "🔑 "; }
.label[for="length"]::before { content: "📏 "; }
.label[for="format"]::before { content: "🧭 "; }
.label[for="textbook"]::before { content: "📖 "; }
.label[for="classTimeStrategy"]::before { content: "🏫 "; }
.label[for="homeworkStrategy"]::before { content: "🏠 "; }
.label[for="majorAssessments"]::before { content: "📊 "; }
.label[for="learnerCharacteristics"]::before { content: "👥 "; }
.label[for="otherInfo"]::before { content: "ℹ️ "; }
.label[for="targetModuleCount"]::before { content: "#️⃣ "; }

.req {
  color: #ef4444;
}

.input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit; /* ensure inputs & textareas use Inter */
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--brand-blue);
  outline: none;
  box-shadow: 0 0 0 4px rgba(30, 115, 190, 0.15);
}

/* Ensure consistent placeholder font across inputs and textareas */
.input::-webkit-input-placeholder {
  font-family: inherit;
  font-style: normal;
  line-height: inherit;
}
.input::-moz-placeholder {
  font-family: inherit;
  font-style: normal;
  line-height: inherit;
}
.input:-ms-input-placeholder {
  font-family: inherit;
  font-style: normal;
  line-height: inherit;
}
.input::-ms-input-placeholder {
  font-family: inherit;
  font-style: normal;
  line-height: inherit;
}
.input::placeholder {
  font-family: inherit;
  font-style: normal;
  line-height: inherit;
  color: #9ca3af;
  opacity: 1;
}

.field-hint {
  display: none; /* hidden by default; tooltips will be provided via label title */
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 6px;
}

.field-error {
  font-size: 0.95rem;
  color: #b91c1c;
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  font-weight: 700;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.04s ease, background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--brand-blue-600);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Actions and status */
.actions {
  margin-top: 12px;
  display: flex;
  gap: 12px;
}

.status {
  margin-top: 12px;
  min-height: 24px;
  color: var(--muted);
}

.status--error {
  color: #b91c1c;
}

.status--success {
  color: #047857;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  vertical-align: -3px;
  margin-left: 8px;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.9);
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  color: var(--muted);
}

/* A11y helpers */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.sr-only-hidden {
  position: absolute !important;
  height: 0;
  width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Header layout for right-aligned actions */
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Danger button */
.btn-danger {
  background: #dc2626; /* red-600 */
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
  background: #b91c1c; /* red-700 */
}

/* Modal */
.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1000;
}

.modal {
  background: #fff;
  width: min(520px, 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Disable custom label tooltips; use native title tooltips only */
.label[data-hint]::after,
.label[data-hint]::before {
  display: none !important;
  content: none !important;
}
.label[data-hint] {
  cursor: inherit;
}
