/* Film Unit Portal CSS — matches matura-anglescina plugin style */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

.fu-portal {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1a202c;
  max-width: 860px;
  margin: 0 auto;
}
.fu-portal * { box-sizing: border-box; }
.fu-view { display: none; }
.fu-view.active { display: block; }

/* ── HERO ─────────────────────────────────────────────────────────────── */
.fu-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #7c3aed 100%);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 28px;
  color: #fff;
}
.fu-hero-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.fu-hero-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.7); margin-bottom: 6px; }
.fu-hero-title { font-size: clamp(1.6rem, 5vw, 2.5rem); font-weight: 800; margin: 0 0 12px; color: #fff; }
.fu-hero-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.fu-hero-pill {
  background: rgba(255,255,255,.18);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
  border: 1px solid rgba(255,255,255,.25);
}
.fu-hero-pill:hover { background: rgba(255,255,255,.3); color: #fff; }

/* ── STEPS ────────────────────────────────────────────────────────────── */
.fu-step { margin-bottom: 24px; }
.fu-step-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: #64748b; margin-bottom: 14px;
}
.fu-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: #2563eb; color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ── REGISTRATION ─────────────────────────────────────────────────────── */
.fu-reg-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  max-width: 480px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.fu-field { margin-bottom: 14px; }
.fu-field label { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 5px; }
.fu-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  transition: border .13s;
}
.fu-input:focus { outline: none; border-color: #2563eb; }
.fu-hint { font-size: 12px; color: #94a3b8; }
.fu-error { color: #dc2626; font-size: 13px; background: #fef2f2; border: 1px solid #fca5a5; border-radius: 6px; padding: 7px 10px; margin-bottom: 10px; }

/* ── PROGRESS ─────────────────────────────────────────────────────────── */
.fu-progress-bar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.fu-progress-inner { display: flex; flex-direction: column; gap: 6px; }
.fu-progress-lbl { font-size: 12px; color: #64748b; font-weight: 600; }
.fu-prog-track { height: 6px; background: #e2e8f0; border-radius: 10px; overflow: hidden; }
.fu-prog-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #7c3aed); border-radius: 10px; width: 0; transition: width .4s ease; }

/* ── QUESTION CARD ────────────────────────────────────────────────────── */
.fu-q-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  position: relative;
  overflow: hidden;
}
.fu-q-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
}
.fu-q-category {
  display: inline-block;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  padding: 3px 10px; border-radius: 20px;
  margin-bottom: 12px;
}
.fu-q-category.literal      { background: #dcfce7; color: #14532d; }
.fu-q-category.interpretive { background: #dbeafe; color: #1e40af; }
.fu-q-category.critical     { background: #ede9fe; color: #5b21b6; }
.fu-q-category.creative     { background: #fef9c3; color: #713f12; }

.fu-q-text {
  font-size: 17px;
  font-weight: 600;
  color: #1a202c;
  line-height: 1.5;
  margin-bottom: 16px;
}
.fu-answer-input {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.65;
  resize: vertical;
  transition: border .13s;
  font-family: inherit;
}
.fu-answer-input:focus { outline: none; border-color: #2563eb; }
.fu-q-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.fu-char-count { font-size: 11px; color: #94a3b8; }

/* ── AI FEEDBACK ──────────────────────────────────────────────────────── */
.fu-ai-feedback {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.fu-ai-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; color: #14532d;
  margin-bottom: 10px;
}
.fu-ai-icon { font-size: 20px; }
.fu-ai-score {
  margin-left: auto;
  background: #2563eb;
  color: #fff;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 800;
}
.fu-ai-text { font-size: 14px; color: #166534; line-height: 1.6; }

/* ── BUTTONS ──────────────────────────────────────────────────────────── */
.fu-btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 22px;
  border-radius: 9px; border: none;
  background: #2563eb; color: #fff;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .18s;
  justify-content: center;
}
.fu-btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.fu-btn-primary:disabled { background: #93c5fd; cursor: not-allowed; transform: none; }

/* ── DONE ─────────────────────────────────────────────────────────────── */
.fu-done-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.fu-done-icon { font-size: 56px; margin-bottom: 16px; }
.fu-done-title { font-size: 22px; font-weight: 800; color: #1a202c; margin-bottom: 8px; }
.fu-done-sub { font-size: 15px; color: #64748b; max-width: 400px; margin: 0 auto 20px; }
.fu-final-score { display: flex; align-items: center; gap: 20px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.fu-score-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 4px solid #2563eb;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fu-score-num { font-size: 24px; font-weight: 800; color: #2563eb; line-height: 1; }
.fu-score-lbl { font-size: 10px; color: #64748b; margin-top: 1px; }
#fu-score-summary { font-size: 14px; color: #374151; text-align: left; line-height: 1.6; max-width: 280px; }

/* ── LOADING ──────────────────────────────────────────────────────────── */
.fu-spinner-inline {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fu-spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes fu-spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .fu-hero { padding: 20px 16px; border-radius: 10px; }
  .fu-hero-title { font-size: 1.5rem; }
  .fu-q-card { padding: 16px; }
  .fu-done-card { padding: 24px 16px; }
}

/* ── FILM UNIT GRID ───────────────────────────────────────────────────── */
.fu-grid {
  display: grid;
  grid-template-columns: repeat(var(--fu-cols, 3), 1fr);
  gap: 20px;
  margin: 0 auto;
}
.fu-grid-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .18s, box-shadow .18s;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  position: relative;
}
.fu-grid-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1e3a8a, #2563eb, #7c3aed);
}
.fu-grid-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(37,99,235,.15);
  border-color: #93c5fd;
}
.fu-grid-card-top {
  padding: 22px 20px 16px;
}
.fu-grid-card-title {
  font-size: 18px;
  font-weight: 800;
  color: #1a202c;
  margin: 8px 0 6px;
  line-height: 1.25;
}
.fu-grid-card-meta {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}
.fu-grid-card-foot {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
}
.fu-grid-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 4px;
}
.fu-grid-badge-ai   { background: #dcfce7; color: #14532d; }
.fu-grid-badge-html { background: #ede9fe; color: #5b21b6; }
.fu-grid-badge-qa   { background: #dbeafe; color: #1e40af; }
.fu-grid-empty { color: #94a3b8; font-style: italic; }

@media (max-width: 768px) {
  .fu-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
  .fu-grid { grid-template-columns: 1fr !important; }
}


/* White background, dark text — overrides any dark WordPress theme       */
.fu-html-unit {
  background: #ffffff !important;
  color: #1a1a1a !important;
  border-radius: 8px;
  overflow: hidden;
  /* Isolation: the unit's own CSS applies inside this wrapper */
}

/* Reset common WordPress theme overrides that bleed into the unit */
.fu-html-unit *,
.fu-html-unit *::before,
.fu-html-unit *::after {
  box-sizing: border-box;
}
.fu-html-unit a {
  color: inherit;
}
/* Ensure nav-bar sticky works within page flow */
.fu-html-unit .nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
}
/* Force body-level background vars to work inside wrapper */
.fu-html-unit body,
.fu-html-unit .hero {
  /* hero keeps its own dark bg — only the wrapper bg is white */
}

/* ── HTML UNIT WRAPPER (custom / generated / AI mode) ────────────────── */
.fu-html-unit {
  background: #ffffff;
  color: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  /* Remove top/side padding so the hero spans full width */
  padding: 0;
}
/* Ensure sticky nav-bar works relative to scroll container */
.fu-html-unit .nav-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
}
/* Readable text on white for any element that might inherit theme dark color */
.fu-html-unit p,
.fu-html-unit li,
.fu-html-unit td,
.fu-html-unit th,
.fu-html-unit span,
.fu-html-unit div {
  /* only override if the element has no explicit color — we use a low-specificity default */
}
/* WordPress themes sometimes set a body background that bleeds through */
.fu-html-unit main,
.fu-html-unit footer {
  background: #f8f7f5;
}

/* ── Send button emphasis ─────────────────────────────────────── */
#fu-submit-btn {
  font-size: 16px;
  padding: 13px 28px;
  letter-spacing: .02em;
}
