/* ============================================
   ROOT VARIABLES
   ============================================ */
:root {
  --bg-main: #f5f9f7;
  --bg-card: #ffffff;
  --border-soft: #d4e2db;
  --accent-primary: #007b5e;
  --accent-secondary: #0055a4;
  --text-main: #1f2933;
  --text-muted: #6b7785;
  --danger: #b91c1c;

  --radius: 14px;
  --shadow-soft: 0 6px 20px rgba(0,0,0,.08);
}

/* ============================================
   RESET / BASE
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #f0f8ff, #f5f9f7);
  color: var(--text-main);
  line-height: 1.5;
}

/* ============================================
   HEADER (MOBILE FIRST)
   ============================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 12px 14px;
  background: radial-gradient(circle at left, #0055a4, #012a4a);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.logo-block,
.chairman-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo,
.chairman-photo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 999px;
  flex-shrink: 0;
}

.chairman-photo {
  border: 2px solid #fff;
}

.brand-text,
.chairman-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lga-name {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.scheme-name {
  font-size: 0.85rem;
  opacity: .95;
}

.chairman-name {
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
}

.chairman-label {
  font-size: 0.55rem;
  opacity: .9;
}

/* ============================================
   PAGE WRAPPER
   ============================================ */
.page {
  max-width: 960px;
  margin: 16px auto;
  padding: 0 14px 24px;
}

/* ============================================
   HERO CARD
   ============================================ */
.hero-card {
  background: linear-gradient(135deg, #fff, #f1f8ff, #e8f7f0);
  border-radius: var(--radius);
  padding: 20px 18px;
  border: 1px solid rgba(148,163,184,.35);
  box-shadow: var(--shadow-soft);
}

.hero-card h1 {
  font-size: clamp(1.15rem, 3.5vw, 1.4rem);
  margin: 0 0 8px;
}

.hero-card p {
  font-size: .95rem;
  color: var(--text-muted);
}

/* ============================================
   BUTTONS (TOUCH FRIENDLY)
   ============================================ */
.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 48px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-primary), #00966d);
  color: #fff;
}

.secondary-btn {
  background: #fff;
  border: 2px solid var(--accent-secondary);
  color: var(--accent-secondary);
}

/* ============================================
   FORMS
   ============================================ */
.form-section {
  margin-top: 24px;
}

.form-card,
.notice-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: box-shadow 0.2s ease;
}

.form-card:hover,
.notice-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.form-card h3,
.notice-card h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  color: var(--accent-secondary);
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-soft);
}

.hint {
  margin: 0.25rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.micro {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.passport-preview-wrap {
  margin-top: 0.6rem;
  width: 160px;
  max-width: 100%;
  aspect-ratio: 35 / 45;
  border: 1px dashed rgba(0,0,0,0.25);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

.passport-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.passport-placeholder {
  text-align: center;
  padding: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.print-summary {
  display: none;
}

/* Show passport photo section on screen - positioned professionally */
.passport-photo-print-section {
  display: block;
  margin-bottom: 20px;
  text-align: center;
}

.passport-photo-print-section h3 {
  margin-bottom: 12px;
}

.passport-print-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 12px 0;
}

.passport-print-placeholder {
  width: 140px;
  height: 180px;
  border: 2px dashed var(--accent-primary);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  text-align: center;
  padding: 12px;
  transition: all 0.3s ease;
}

.passport-print-placeholder:hover {
  border-color: var(--accent-secondary);
  background: #f0f9ff;
}

.passport-print-placeholder span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  display: block;
}

.passport-print-placeholder small {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.print-instruction {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* iOS zoom fix */
  border-radius: 10px;
  border: 2px solid #cbd5e1;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(0,123,94,.1);
}

/* ============================================
   GRID (STACK BY DEFAULT)
   ============================================ */
.grid-2,
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ============================================
   ACTIONS & STATUS
   ============================================ */
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-message {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: .95rem;
}

/* ============================================
   TABLET & UP
   ============================================ */
@media (min-width: 768px) {
  .logo,
  .chairman-photo {
    width: 72px;
    height: 72px;
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .actions {
    flex-direction: row;
  }

  .primary-btn,
  .secondary-btn {
    width: auto;
  }
}

/* ============================================
   DESKTOP
   ============================================ */
@media (min-width: 1024px) {
  .top-bar {
    padding: 18px 32px;
  }

  .logo,
  .chairman-photo {
    width: 96px;
    height: 96px;
  }
}


/* ============================================
   PRINT — ONE PAGE A4 FORM (HARD LOCK)
   ============================================ */
@media print {

  /* ===== PAGE SETUP ===== */
  @page {
    size: A4;
    margin: 5mm;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 8pt;
    line-height: 1.3;
    background: #ffffff !important;
    height: auto !important;
  }

  /* ===== REMOVE NON-FORM ELEMENTS ===== */
  .hero-card,
  .notice-card,
  .actions,
  .status-message,
  .footer,
  .section-caption {
    display: none !important;
  }

  /* Show passport photo print section only when printing */
  .passport-photo-print-section {
    display: block !important;
  }

  /* Hide file upload controls on paper */
  input[type="file"],
  .file-help,
  #uploadsSection {
    display: none !important;
  }

  /* Passport photo section for print - prominently displayed */
  .passport-photo-print-section {
    display: block !important;
    page-break-inside: avoid !important;
    margin-bottom: 3mm !important;
    margin-top: 2mm !important;
    text-align: center !important;
    border: 1px solid #cbd5e1 !important;
    padding: 2.5mm !important;
    background: #fff !important;
  }

  .passport-photo-print-section h3 {
    font-size: 8pt !important;
    margin: 0 0 1.5mm !important;
    border-bottom: 1.5px solid #cbd5e1 !important;
    padding-bottom: 0.8mm !important;
    text-align: center !important;
    font-weight: 700 !important;
    color: #012a4a !important;
  }

  .passport-print-box {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 2mm 0 !important;
  }

  .passport-print-placeholder {
    width: 35mm !important;
    height: 45mm !important;
    border: 2.5px solid #000 !important;
    border-radius: 2mm !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fff !important;
    text-align: center !important;
    padding: 2.5mm !important;
  }

  .passport-print-placeholder span {
    font-size: 7pt !important;
    font-weight: 700 !important;
    color: #000 !important;
    margin-bottom: 1.5mm !important;
    line-height: 1.3 !important;
  }

  .passport-print-placeholder small {
    font-size: 6pt !important;
    color: #333 !important;
    font-weight: 500 !important;
  }

  .print-instruction {
    font-size: 6.5pt !important;
    color: #333 !important;
    margin: 1.5mm 0 0 !important;
    text-align: center !important;
    font-style: italic !important;
  }

  /* Hide passport preview in upload section when printing */
  .passport-preview-wrap {
    display: none !important;
  }

  /* ===== PREVENT PAGE BREAKS ===== */
  * {
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;

    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
    transform: none !important;
  }

  /* ===== HEADER ===== */
  .top-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 3mm !important;
    margin-bottom: 2mm !important;
    background: #012a4a !important;
  }

  .logo,
  .chairman-photo {
    width: 14mm !important;
    height: 14mm !important;
  }

  .lga-name {
    font-size: 8pt !important;
    line-height: 1.1 !important;
    color: #fff !important;
  }

  .scheme-name {
    font-size: 9pt !important;
    color: #fff !important;
  }

  .chairman-name {
    font-size: 5.5pt !important;
    color: #fff !important;
    white-space: nowrap !important;
  }

  .chairman-label {
    font-size: 5pt !important;
    color: #fff !important;
  }

  /* ===== PAGE WRAPPER ===== */
  .page {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* ===== FORM SECTION ===== */
  .form-section {
    margin: 0 !important;
    padding: 2mm 0 !important;
    width: 100% !important;
    position: relative !important;
  }

  .form-section h2 {
    font-size: 10pt !important;
    margin: 0 0 2mm !important;
    font-weight: 700 !important;
  }

  /* Passport Photo Box - Print Only (appears at top right) */
  .form-section::before {
    content: "PASSPORT PHOTO" !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    width: 35mm !important;
    height: 45mm !important;
    border: 2.5px solid #000 !important;
    border-radius: 2mm !important;
    background: #fff !important;
    font-size: 6.5pt !important;
    font-weight: 700 !important;
    color: #000 !important;
    text-align: center !important;
    padding: 8mm 2mm 2mm 2mm !important;
    box-sizing: border-box !important;
    z-index: 10 !important;
    page-break-inside: avoid !important;
    line-height: 1.2 !important;
  }

  .form-section::after {
    content: "(35mm x 45mm)" !important;
    display: block !important;
    position: absolute !important;
    top: 38mm !important;
    right: 0 !important;
    width: 35mm !important;
    font-size: 5.5pt !important;
    font-weight: 500 !important;
    color: #333 !important;
    text-align: center !important;
    z-index: 11 !important;
  }

  /* ===== FORM CARDS ===== */
  .form-card,
  .notice-card {
    border: 1px solid #cbd5e1 !important;
    padding: 3mm !important;
    margin-bottom: 2.5mm !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
  }

  /* Adjust first form card to make room for passport photo */
  .form-card:first-of-type {
    margin-right: 45mm !important;
  }

  .form-card h3,
  .notice-card h3 {
    font-size: 9pt !important;
    margin: 0 0 2mm !important;
    border-bottom: 1.5px solid #cbd5e1 !important;
    padding-bottom: 1mm !important;
    font-weight: 700 !important;
  }

  /* ===== GRID — SPREAD OUT ===== */
  .grid-2 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2mm 3mm !important;
  }

  .grid-3 {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2mm 3mm !important;
  }

  /* ===== FORM FIELDS ===== */
  .field {
    margin-bottom: 2mm !important;
  }

  .field label {
    font-size: 7pt !important;
    margin-bottom: 0.8mm !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
  }

  .field input,
  .field select,
  .field textarea {
    font-size: 7.5pt !important;
    padding: 1.5mm !important;
    height: 6mm !important;
    border: 1px solid #94a3b8 !important;
    border-radius: 1px !important;
  }

  /* ===== TEXTAREA HARD LIMIT ===== */
  textarea,
  #residentialAddress {
    min-height: 12mm !important;
    max-height: 12mm !important;
    overflow: hidden !important;
    padding: 1.5mm !important;
  }

  /* ===== CHECKBOX ===== */
  .checkbox-field {
    display: flex !important;
    align-items: center !important;
    gap: 2mm !important;
    margin-bottom: 2mm !important;
  }

  .checkbox-field input {
    width: 4mm !important;
    height: 4mm !important;
  }

  .checkbox-field label {
    font-size: 7pt !important;
    line-height: 1.2 !important;
  }

  /* ===== NOTICE ===== */
  .notice-card {
    border-left: 2mm solid var(--accent-secondary) !important;
  }

  .notice-card ul {
    padding-left: 4mm !important;
    margin: 0.5mm 0 !important;
  }

  .notice-card li {
    font-size: 6.3pt !important;
    margin-bottom: 0.3mm !important;
  }

}
