/* ============================================================
   SOP Builder — Professional CSS
   Matches the exact layout from the reference screenshots
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@500;600;700;800&display=swap');

/* ── Root Variables ── */
:root {
  --sop-purple: #8B00FF;
  /* main brand purple from screenshot  */
  --sop-text: #111111;
  --sop-muted: #555555;
  --sop-bg: #f0f4ff;
  --sop-surface: #ffffff;
  --sop-border: #e2e8f0;
  --radius: 14px;
  --shadow-sm: 0 2px 12px rgba(139, 0, 255, .06);
  --shadow-md: 0 8px 32px rgba(139, 0, 255, .10);
  --shadow-lg: 0 20px 60px rgba(139, 0, 255, .16);
  --transition: all .25s cubic-bezier(.4, 0, .2, 1);
}

/* ── Body / Page ── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--sop-bg);
  color: var(--sop-text);
}

/* ============================================================
   SOP Templates Page (sop-builder.php)
   ============================================================ */

.sop-hero {
  padding: 80px 0 50px;
  text-align: center;
}

.sop-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(139, 0, 255, .08);
  color: var(--sop-purple);
  border: 1px solid rgba(139, 0, 255, .2);
  border-radius: 50px;
  padding: 6px 20px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.sop-hero-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  background: linear-gradient(135deg, #6600cc 0%, #8B00FF 60%, #aa44ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
  letter-spacing: -.03em;
  margin-bottom: 18px;
}

.sop-hero-sub {
  font-size: clamp(.95rem, 2vw, 1.15rem);
  color: var(--sop-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.75;
}

/* ── Hero CTA Button ── */
.sop-hero-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 42px;
  background: linear-gradient(135deg, #6600cc 0%, #8B00FF 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 6px 24px rgba(139, 0, 255, .4);
}

.sop-hero-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 40px rgba(139, 0, 255, .6);
  color: #fff;
  text-decoration: none;
}

.sop-hero-cta-btn svg {
  width: 20px;
  height: 20px;
  transition: transform .3s ease;
}

.sop-hero-cta-btn:hover svg {
  transform: translateX(4px);
}

/* ── Single Template Card ── */
.sop-single-card {
  max-width: 680px;
  margin: 0 auto 60px;
  background: var(--sop-surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--sop-border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: var(--transition);
}

.sop-single-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(139, 0, 255, .35);
}

/* Mini preview thumbnail inside card */
.sop-card-preview {
  background: #f8f6ff;
  padding: 36px 40px 28px;
  border-bottom: 1px solid var(--sop-border);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.mini-sop-page {
  width: 240px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .15);
  padding: 20px 18px 16px;
  font-size: 0;
  /* hide any inline white-space */
}

.mini-sop-page .mini-title {
  width: 90%;
  height: 9px;
  background: #8B00FF;
  border-radius: 4px;
  margin: 0 auto 3px;
}

.mini-sop-page .mini-rule {
  width: 100%;
  height: 1.5px;
  background: #ddd;
  margin: 6px 0 8px;
}

.mini-sop-page .mini-label {
  height: 5px;
  border-radius: 3px;
  background: #8B00FF;
  margin-bottom: 4px;
}

.mini-sop-page .mini-label.w70 {
  width: 70%;
}

.mini-sop-page .mini-label.w55 {
  width: 55%;
}

.mini-sop-page .mini-label.w60 {
  width: 60%;
}

.mini-sop-page .mini-label.w40 {
  width: 40%;
}

.mini-sop-page .mini-text {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  margin-bottom: 3px;
}

.mini-sop-page .mini-text.full {
  width: 100%;
}

.mini-sop-page .mini-text.w90 {
  width: 90%;
}

.mini-sop-page .mini-text.w80 {
  width: 80%;
}

.mini-sop-page .mini-text.w70 {
  width: 70%;
}

.mini-sop-page .mini-section-head {
  height: 5px;
  width: 55%;
  border-radius: 3px;
  background: #8B00FF;
  margin: 8px 0 5px;
}

.sop-card-info {
  padding: 28px 36px 32px;
}

.sop-card-info h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--sop-text);
  margin-bottom: 6px;
}

.sop-card-info p {
  color: var(--sop-muted);
  font-size: .9rem;
  line-height: 1.65;
  margin-bottom: 24px;
}

.sop-features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.sop-features-list li {
  font-size: .82rem;
  color: var(--sop-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.sop-features-list li::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sop-purple);
  flex-shrink: 0;
}

/* ── Primary Button ── */
.sop-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 14px 28px;
  background: linear-gradient(135deg, #6600cc, #8B00FF);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(139, 0, 255, .35);
}

.sop-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 0, 255, .5);
  color: #fff;
}

/* How It Works strip */
.sop-how-section {
  padding: 20px 0 70px;
}

.sop-how-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--sop-text);
  text-align: center;
  margin-bottom: 36px;
}

.sop-how-card {
  background: #fff;
  border: 1.5px solid var(--sop-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  height: 100%;
  transition: var(--transition);
}

.sop-how-card:hover {
  border-color: rgba(139, 0, 255, .3);
  box-shadow: var(--shadow-sm);
  transform: translateY(-3px);
}

.sop-how-icon {
  width: 54px;
  height: 54px;
  background: rgba(139, 0, 255, .1);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.4rem;
}

.sop-how-card h5 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  color: var(--sop-text);
  margin-bottom: 8px;
}

.sop-how-card p {
  font-size: .82rem;
  color: var(--sop-muted);
  line-height: 1.65;
  margin: 0;
}

/* ============================================================
   SOP Editor Page (sop-editor.php)
   ============================================================ */

/* Top bar */
.sop-editor-topbar {
  background: #fff;
  border-bottom: 1.5px solid var(--sop-border);
  padding: 13px 0;
  position: sticky;
  top: 0;
  z-index: 200;
}

.sop-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sop-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sop-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: .84rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.sop-back-link:hover {
  color: var(--sop-purple);
}

.sop-topbar-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--sop-text);
}

.sop-topbar-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sop-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.sop-action-btn-pdf {
  background: linear-gradient(135deg, #6600cc, #8B00FF);
  color: #fff;
}

.sop-action-btn-pdf:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 0, 255, .4);
  color: #fff;
}

.sop-action-btn-doc {
  background: #f1f5f9;
  color: #374151;
  border: 1.5px solid var(--sop-border);
}

.sop-action-btn-doc:hover {
  border-color: var(--sop-purple);
  color: var(--sop-purple);
  background: rgba(139, 0, 255, .05);
}

.sop-action-btn-print {
  background: #f1f5f9;
  color: #374151;
  border: 1.5px solid var(--sop-border);
}

.sop-action-btn-print:hover {
  border-color: var(--sop-purple);
  color: var(--sop-purple);
  background: rgba(139, 0, 255, .05);
}

/* ── Editor Split Layout ── */
.sop-editor-wrap {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 28px;
  padding: 28px 0 60px;
  align-items: start;
}

@media (max-width: 1100px) {
  .sop-editor-wrap {
    grid-template-columns: 1fr;
  }
}

/* On mobile: ensure form panel (Fill Your SOP) comes first visually.
   Since form is the first child in HTML, no order change needed. */
@media (max-width: 767px) {
  .sop-editor-wrap {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 16px 0 40px;
  }
}

/* ── Form Panel ── */
.sop-form-panel {
  background: #fff;
  border: 1.5px solid var(--sop-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 0, 255, .3) transparent;
}

@media (max-width: 767px) {
  .sop-form-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

.sop-form-panel::-webkit-scrollbar {
  width: 5px;
}

.sop-form-panel::-webkit-scrollbar-thumb {
  background: rgba(139, 0, 255, .3);
  border-radius: 4px;
}

.sop-form-header {
  padding: 22px 26px 20px;
  background: linear-gradient(135deg, #6600cc, #8B00FF);
  color: #fff;
}

.sop-form-header h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.sop-form-header p {
  font-size: .8rem;
  opacity: .85;
  margin: 0;
}

/* Progress fill bar */
.sop-prog-bar {
  height: 3px;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.sop-prog-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 0%;
  transition: width .4s ease;
}

.sop-form-body {
  padding: 24px 26px 28px;
}

/* Section grouping */
.sop-field-group {
  margin-bottom: 26px;
}

.sop-field-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--sop-purple);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(139, 0, 255, .12);
  margin-bottom: 16px;
}

.sop-field-group-title .fgi {
  width: 26px;
  height: 26px;
  background: rgba(139, 0, 255, .1);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
}

/* Form controls */
.sop-form-body .form-label {
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.sop-form-body .form-control {
  border: 1.5px solid var(--sop-border);
  border-radius: 9px;
  font-size: .86rem;
  padding: 9px 13px;
  color: var(--sop-text);
  background: #fafbff;
  transition: var(--transition);
}

.sop-form-body .form-control:focus {
  border-color: var(--sop-purple);
  box-shadow: 0 0 0 3px rgba(139, 0, 255, .12);
  background: #fff;
  outline: none;
}

.sop-form-body textarea.form-control {
  resize: vertical;
  min-height: 105px;
  line-height: 1.7;
}

.sop-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--sop-purple);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-right: 4px;
}

.sop-char-hint {
  font-size: .71rem;
  color: #94a3b8;
  text-align: right;
  margin-top: 3px;
}

.sop-char-hint.warn {
  color: #f59e0b;
}

.sop-char-hint.limit {
  color: #ef4444;
}

/* Bottom CTA */
.sop-form-cta {
  display: grid;
  gap: 8px;
}

.sop-cta-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  background: linear-gradient(135deg, #6600cc, #8B00FF);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: var(--transition);
}

.sop-cta-pdf:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(139, 0, 255, .4);
}

.sop-cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sop-cta-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px;
  background: transparent;
  border: 1.5px solid var(--sop-border);
  border-radius: 9px;
  font-weight: 600;
  font-size: .82rem;
  color: #374151;
  cursor: pointer;
  transition: var(--transition);
}

.sop-cta-ghost:hover {
  border-color: var(--sop-purple);
  color: var(--sop-purple);
  background: rgba(139, 0, 255, .04);
}

/* ── Preview Panel ── */
.sop-preview-panel {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 0, 255, .3) transparent;
}

@media (max-width: 767px) {
  .sop-preview-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

.sop-preview-panel::-webkit-scrollbar {
  width: 5px;
}

.sop-preview-panel::-webkit-scrollbar-thumb {
  background: rgba(139, 0, 255, .3);
  border-radius: 4px;
}

.sop-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--sop-border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 13px 18px;
  flex-wrap: wrap;
}

.sop-preview-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: .92rem;
  color: var(--sop-text);
}

.sop-preview-btns {
  display: flex;
  gap: 7px;
}

.sop-doc-canvas {
  background: #d9d9d9;
  border: 1.5px solid var(--sop-border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}

/* ============================================================
   THE DOCUMENT — Exact match to screenshot
   ============================================================ */

.sop-document {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  box-shadow: 0 4px 40px rgba(0, 0, 0, .18);
  padding: 28mm 22mm 24mm;
  box-sizing: border-box;

  /* Typography to match screenshot */
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  font-size: 11.5pt;
  font-weight: 700;
  /* body text is bold in screenshot */
  line-height: 1.75;
  color: #111111;
}

/* ── Document Title ── */
.doc-title {
  font-size: 22pt;
  font-weight: 700;
  color: #8B00FF;
  margin: 0 0 12px;
  line-height: 1.2;
}

/* ── Horizontal Rules ── */
.doc-rule {
  border: none;
  border-top: 1.5px solid #bbbbbb;
  margin: 0 0 20px;
}

.doc-rule-thick {
  border: none;
  border-top: 1.5px solid #bbbbbb;
  margin: 22px 0;
}

/* ── Sender Block ── */
.doc-sender {
  margin-bottom: 18px;
  line-height: 1.75;
}

.doc-field-label {
  font-weight: 700;
  color: #8B00FF;
}

/* Date */
.doc-date-line {
  color: #8B00FF;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ── University/Recipient Block ── */
.doc-recipient {
  color: #8B00FF;
  font-weight: 700;
  line-height: 1.75;
  margin-bottom: 16px;
}

/* ── Subject Line ── */
.doc-subject-line {
  margin-bottom: 4px;
}

.doc-subject-label {
  color: #8B00FF;
  font-weight: 700;
}

.doc-subject-text {
  color: #111111;
  font-weight: 700;
}

/* ── Section Heading ── */
.doc-section-heading {
  color: #8B00FF;
  font-weight: 700;
  font-size: 11.5pt;
  margin: 20px 0 10px;
}

/* ── Section paragraph ── */
.doc-section-para {
  color: #111111;
  font-weight: 700;
  text-align: justify;
  margin: 0 0 4px;
  line-height: 1.75;
}

/* ── Signature ── */
.doc-sig-label {
  color: #8B00FF;
  font-weight: 700;
  margin-bottom: 8px;
}

.doc-sig-name {
  color: #111111;
  font-weight: 700;
  font-size: 11.5pt;
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  * {
    visibility: hidden !important;
  }

  .sop-document,
  .sop-document * {
    visibility: visible !important;
  }

  .sop-document {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    min-height: 100% !important;
    box-shadow: none !important;
    padding: 20mm 20mm 20mm !important;
  }

  @page {
    size: A4;
    margin: 0;
  }
}

/* ============================================================
   Responsive Tweaks
   ============================================================ */

/* ── Tablet & Mobile (≤ 900px) — JS applies zoom to fit document ── */
@media (max-width: 900px) {
  .sop-editor-wrap {
    gap: 20px;
    /* Prevent horizontal scroll at the wrap level — safe for html2canvas
       because html2pdf captures #sopDocument directly, not the wrapper */
    overflow-x: hidden;
  }

  /* KEY FIX: min-width:0 breaks the flexbox min-width:auto trap that
     lets flex children expand to 794px (the document width).
     DO NOT add overflow:hidden here — that breaks html2canvas PDF capture. */
  .sop-editor-wrap>div {
    min-width: 0;
    max-width: 100%;
  }

  /* Preview panel: constrain width, no overflow:hidden (breaks PDF) */
  .sop-preview-panel {
    max-width: 100%;
  }

  /* Canvas: only this element clips the wide document visually.
     html2canvas captures #sopDocument directly so this doesn't affect PDF. */
  .sop-doc-canvas {
    overflow: hidden;
    justify-content: flex-start;
    padding: 16px;
    box-sizing: border-box;
    max-width: 100%;
  }

  /* Document: set a reasonable initial zoom so there's no overflow flash
     before the JS zoom fires. JS will recalculate the exact value. */
  .sop-document {
    width: 210mm;
    min-width: unset;
    zoom: 0.45;
    /* JS overrides this with the exact fit value */
  }
}

/* ── Mobile (≤ 767px) ── */
@media (max-width: 767px) {

  /* Hero */
  .sop-hero {
    padding: 40px 0 24px;
  }

  /* Template section padding */
  .templates-section {
    padding: 40px 0 50px;
  }

  /* Features list: single column */
  .sop-features-list {
    grid-template-columns: 1fr;
  }

  /* Topbar: hide title, shrink buttons */
  .sop-topbar-title {
    display: none;
  }

  .sop-topbar-btns {
    gap: 6px;
  }

  .sop-action-btn {
    padding: 7px 12px;
    font-size: .78rem;
  }

  /* Form panel: reduce padding on mobile */
  .sop-form-header {
    padding: 16px 18px 14px;
  }

  .sop-form-body {
    padding: 16px 14px 20px;
  }

  /* Preview toolbar: stack when narrow */
  .sop-preview-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
  }

  .sop-preview-btns {
    width: 100%;
    justify-content: flex-end;
  }

  /* Canvas: tighter padding on phones */
  .sop-doc-canvas {
    padding: 10px;
  }

  /* CTA row: stack on small phones */
  .sop-cta-row {
    grid-template-columns: 1fr;
  }
}

/* ── Extra-small phones (≤ 400px) ── */
@media (max-width: 400px) {
  .sop-action-btn {
    padding: 6px 9px;
    font-size: .74rem;
  }
}

/* ── Fade-in animation ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp .55s ease both;
}

.delay-1 {
  animation-delay: .1s;
}

.delay-2 {
  animation-delay: .2s;
}

.delay-3 {
  animation-delay: .3s;
}

.delay-4 {
  animation-delay: .4s;
}

.delay-5 {
  animation-delay: .5s;
}

/* ── Additional Polish & Enhancements ── */
.sop-form-body .form-control::placeholder {
  color: #a0aec0;
  font-size: .82rem;
}

.sop-form-body .form-control:disabled,
.sop-form-body .form-control[readonly] {
  background: #f5f7fa;
  color: #64748b;
}

/* Input group styling */
.input-group .input-group-text {
  background: #fafbff;
  border: 1.5px solid var(--sop-border);
  color: #94a3b8;
}

.input-group .form-control:focus ~ .input-group-text {
  border-color: var(--sop-purple);
  background: #f8f6ff;
}

/* Smooth scrollbar for better UX */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 0, 255, .2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 0, 255, .4);
}

/* ── Hero Section Animations ── */
.sop-hero {
  animation: fadeUp .6s ease both;
}

/* ── Button Focus States ── */
.sop-hero-cta-btn:focus,
.sop-btn-primary:focus,
.sop-cta-pdf:focus {
  outline: 2px solid var(--sop-purple);
  outline-offset: 2px;
}

/* Improved label styling */
.sop-form-body .form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #1f2937;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .3px;
}

/* ── Template Grid Enhancements ── */
.templates-grid {
  gap: 24px 20px;
}

@media (max-width: 1200px) {
  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .templates-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Template card subtle enhancements */
.template-card {
  transition: all .35s cubic-bezier(.4, 0, .2, 1);
}

.template-card:hover {
  transform: translateY(-8px);
}

.template-image {
  transition: transform .35s ease;
}

.template-card:hover .template-image {
  transform: scale(1.05);
}

/* ── Improved Button Groups ── */
.sop-cta-row {
  transition: gap .2s ease;
}

.sop-action-btn {
  position: relative;
  overflow: hidden;
}

.sop-action-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  transform: translate(-50%, -50%);
  transition: width .6s, height .6s;
}

.sop-action-btn:active::before {
  width: 300px;
  height: 300px;
}

/* ── Section Divider Enhancement ── */
.sop-field-group {
  position: relative;
  padding-bottom: 6px;
}

.sop-field-group:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 0, 255, .1), transparent);
}

/* ── Form Accessibility Improvements ── */
.form-label {
  user-select: none;
}

.sop-form-body .form-control:invalid {
  border-color: #fca5a5;
}

.sop-form-body .form-control:valid {
  border-color: #86efac;
}

/* ── Progress Bar Animation ── */
.sop-prog-fill {
  background: linear-gradient(90deg, #fff, #e0e7ff, #fff);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}