/* ==========================================================================
   Narmada eServices — Resume Builder
   Stylesheet: form UI, template previews, and print-accurate A4 resumes
   ========================================================================== */

:root {
  --brand-primary: #0b5d52;
  --brand-primary-dark: #073f38;
  --brand-primary-light: #e7f2f0;
  --brand-accent: #c98a3e;
  --brand-accent-light: #faf1e2;
  --bg-page: #eef3f2;
  --surface: #ffffff;
  --border: #dde5e3;
  --border-strong: #bdccc8;
  --text-primary: #17231f;
  --text-muted: #5f746f;
  --text-faint: #8a9b96;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(13, 40, 35, 0.07);
  --shadow-md: 0 6px 20px rgba(13, 40, 35, 0.09);
  --shadow-lg: 0 24px 60px rgba(13, 40, 35, 0.22);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Poppins', 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

button { font-family: inherit; }

/* ==========================================================================
   Layout shell
   ========================================================================== */

.page-wrapper {
  min-height: 100vh;
  padding: 28px 16px 64px;
}

/* ==========================================================================
   Side Ad Boxes (left/right rails)
   ========================================================================== */

/* Mobile/tablet: ad boxes show as small full-width banners —
   promo-rail-left ફોર્મ ઉપર, promo-rail-right ફોર્મ નીચે (DOM order પ્રમાણે) */
.promo-rail {
  display: block;
  max-width: 880px;
  margin: 0 auto 16px;
}

.promo-rail-right {
  margin: 16px auto 0;
}

.promo-slot {
  width: 100%;
  min-height: 90px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (min-width: 1300px) {
  /* page-wrapper ને 3-કોલમ ગ્રીડ બનાવ્યું: left promo | main content | right promo.
     આ રીતે sticky promo-slot ફક્ત page-wrapper ની અંદર જ stick થશે,
     અને footer શરૂ થાય એ પહેલાં આપોઆપ સ્ક્રોલ થઈ જશે — footer સાથે overflow/overlap નહીં થાય. */
  .page-wrapper {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) 200px;
    gap: 20px;
    align-items: start;
  }

  /* Explicit column placement — blocker extensions often hide elements
     matched by generic class-name patterns (display:none). Without explicit
     grid-column, the grid auto-placement algorithm then shifts .main-content
     into the freed-up column, squishing the form to the left. Fixing each
     item's column keeps main-content centered even if a panel gets hidden. */
  .promo-rail-left  { grid-column: 1; }
  .main-content   { grid-column: 2; }
  .promo-rail-right { grid-column: 3; }

  .promo-rail {
    max-width: none;
    margin: 0;
    position: sticky;
    top: 120px;
  }

  .promo-slot {
    min-height: 420px;
  }
}

@media (min-width: 1600px) {
  /* મોટા મોનિટર પર columns અને slot height વધુ મોટા — વધુ space વાપરવા */
  .page-wrapper {
    grid-template-columns: 260px minmax(0, 1fr) 260px;
    gap: 28px;
  }

  .promo-slot {
    min-height: 600px;
  }
}

@media (min-width: 1920px) {
  /* Extra-wide / 2K+ monitors */
  .page-wrapper {
    grid-template-columns: 320px minmax(0, 1fr) 320px;
    gap: 32px;
  }

  .promo-slot {
    min-height: 720px;
  }
}

#formView .container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 40px 44px;
}

.app-header {
  text-align: center;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.app-header h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-primary-dark);
  margin: 0 0 8px;
}

.app-header h1 span {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-accent);
  background: var(--brand-accent-light);
  border: 1px solid #ecd6ae;
  border-radius: 999px;
  padding: 4px 12px;
  margin-left: 10px;
  vertical-align: middle;
  transform: translateY(-2px);
}

.app-subtitle {
  color: var(--text-muted);
  font-size: 14.5px;
  margin: 0;
}

.tpl-later-note {
  background: var(--brand-primary-light);
  border: 1px solid #cfe6e1;
  color: var(--brand-primary-dark);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13.5px;
  margin-bottom: 24px;
}

.error-box {
  background: var(--danger-light);
  border: 1px solid #f3c6c0;
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 13.5px;
}
.error-box ul { margin: 8px 0 0; padding-left: 20px; }
.error-box li { margin-bottom: 3px; }

/* ==========================================================================
   Form sections
   ========================================================================== */

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-md);
  padding: 22px 24px 24px;
  margin-bottom: 22px;
}

.form-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 18px;
}

.sec-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-2 + .grid-2, .grid-2 + .grid-3, .grid-3 + .grid-2, .grid-3 + .grid-3 { margin-top: 16px; }

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.grid-2 > .form-group, .grid-3 > .form-group { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.required-mark { color: var(--danger); }
.hint { color: var(--text-faint); font-weight: 400; font-size: 12px; }
.block-hint { margin: -4px 0 12px; font-size: 12.5px; }

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { resize: vertical; min-height: 70px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(11, 93, 82, 0.15);
}

input[type="file"] { padding: 8px; font-size: 13px; }

.upload-thumb {
  margin-top: 10px;
  width: 90px;
  height: 108px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}
.upload-thumb.sig-thumb { width: 140px; height: 60px; object-fit: contain; background: #fafafa; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}
.checkbox-group input { width: auto; accent-color: var(--brand-primary); }

/* ==========================================================================
   Checkbox multi-select dropdown ("checkdrop")
   ========================================================================== */

.checkdrop { position: relative; margin-top: 10px; }

.checkdrop-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--brand-primary-light);
  border: 1px dashed #b6d6cf;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand-primary-dark);
  cursor: pointer;
}
.checkdrop-arrow { transition: transform 0.15s ease; color: var(--brand-primary); }
.checkdrop.open .checkdrop-arrow { transform: rotate(180deg); }

.checkdrop-panel {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
}
.checkdrop.open .checkdrop-panel { display: grid; }

.checkdrop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  cursor: pointer;
  margin: 0;
}
.checkdrop-item:hover { background: var(--brand-primary-light); }
.checkdrop-item input { width: auto; accent-color: var(--brand-primary); }
.checkdrop-other { grid-column: 1 / -1; border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 10px; font-weight: 600; }

.checkdrop-custom-input {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.checkdrop-add-btn { margin-top: 10px; }

.tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-primary-light);
  border: 1px solid #c7e2db;
  color: var(--brand-primary-dark);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
}
.tag-remove {
  border: none;
  background: rgba(11, 93, 82, 0.14);
  color: var(--brand-primary-dark);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tag-remove:hover { background: var(--danger); color: #fff; }

/* ==========================================================================
   Tables (education / experience editors)
   ========================================================================== */

.table-scroll { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }

#educationTable, #experienceTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

#educationTable th, #experienceTable th {
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
}

#educationTable td, #experienceTable td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

#educationTable input, #experienceTable input, #experienceTable select {
  border: 1px solid var(--border);
  padding: 7px 8px;
  font-size: 13px;
  min-width: 100px;
}

.exp-fields-group { margin-top: 16px; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-add {
  background: var(--surface);
  border-color: var(--brand-primary);
  color: var(--brand-primary-dark);
}
.btn-add:hover { background: var(--brand-primary-light); }

.btn-add-tag {
  background: var(--brand-accent);
  color: #fff;
  font-size: 12.5px;
  padding: 8px 14px;
  margin-top: 10px;
}
.btn-add-tag:hover { background: #b57a34; }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #f3c6c0;
  font-size: 12.5px;
  padding: 6px 12px;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-reset {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-muted);
}
.btn-reset:hover { background: #f4f4f4; }

.btn-submit {
  background: var(--brand-primary);
  color: #fff;
  padding: 12px 26px;
  font-size: 14.5px;
  box-shadow: var(--shadow-sm);
}
.btn-submit:hover { background: var(--brand-primary-dark); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--brand-primary);
  color: var(--brand-primary-dark);
}
.btn-secondary:hover { background: var(--brand-primary-light); }

.btn-download {
  background: var(--brand-accent);
  color: #fff;
}
.btn-download:hover { background: #b57a34; }

.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);

}

/* ==========================================================================
   Preview view — toolbar, template picker, stage
   ========================================================================== */

#previewView { max-width: 1040px; margin: 0 auto; }

.preview-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.preview-toolbar-right { display: flex; gap: 10px; }

.template-selector-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px 20px;
  margin-bottom: 24px;
}
.template-selector-box > label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.tpl-select {
  width: 100%;
  max-width: 320px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.tpl-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: var(--surface);
}
.tpl-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.tpl-card.active { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(11,93,82,0.15); }

.tpl-card span { display: block; font-size: 11.5px; font-weight: 600; margin-top: 8px; color: var(--text-primary); }

.tpl-card-swatch {
  height: 46px;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
}
.tpl-card-swatch::before {
  content: "";
  position: absolute;
  inset: 0;
}
.tpl-card-swatch::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px; top: 20px; height: 3px;
  background: rgba(255,255,255,0.55);
  border-radius: 2px;
}
.tpl-card-swatch.tpl-1  { background: linear-gradient(135deg, #1b2a4a, #3b6fd6); }
.tpl-card-swatch.tpl-2  { background: linear-gradient(135deg, #f7f2e7, #7a2e2e); }
.tpl-card-swatch.tpl-3  { background: linear-gradient(135deg, #ffffff, #1a1a1a); }
.tpl-card-swatch.tpl-4  { background: linear-gradient(135deg, #eaf1fa, #14528c); }
.tpl-card-swatch.tpl-5  { background: linear-gradient(135deg, #fbeef1, #6e1f3a); }
.tpl-card-swatch.tpl-6  { background: linear-gradient(135deg, #ffffff, #b32424); }
.tpl-card-swatch.tpl-7  { background: linear-gradient(135deg, #f1f5f9, #475569); }
.tpl-card-swatch.tpl-8  { background: linear-gradient(135deg, #fbf6ec, #8a5a2b); }
.tpl-card-swatch.tpl-9  { background: linear-gradient(90deg, #0f766e 50%, #f97316 50%); }
.tpl-card-swatch.tpl-10 { background: linear-gradient(135deg, #fdf8f3, #c2673d); }

.preview-stage-wrap { position: relative; }

.preview-stage {
  position: relative;
  background: #dbe4e2;
  border-radius: var(--radius-lg);
  padding: 32px;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   Resume preview watermark — ફક્ત on-screen preview પર દેખાય.
   #print-preview-container ની બહાર sibling તરીકે mૂકેલું છે, એટલે
   generatePDF() (html2canvas) એને ક્યારેય capture નહીં કરે — ડાઉનલોડ
   થયેલ PDF હંમેશા clean/original જ રહેશે.
   ========================================================================== */
#print-preview-container { position: relative; z-index: 1; }

.resume-watermark-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-repeat: repeat;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='340' height='170'><text x='130' y='100' text-anchor='middle' font-family='Arial, sans-serif' font-size='19' font-weight='700' fill='rgba(15,76,92,0.11)' transform='rotate(-28 170 85)'>Narmada eServices Portal</text></svg>");
}

@media print {
  .resume-watermark-overlay { display: none !important; }
}

.mobile-scroll-hint { display: none; }

@media (max-width: 900px) {
  .preview-stage { justify-content: flex-start; }
  .mobile-scroll-hint {
    display: block;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-primary-dark);
    background: var(--brand-primary-light);
    border: 1px solid #cfe6e1;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-bottom: 12px;
  }
}

/* ==========================================================================
   Resume document — base (shared by all templates)
   ========================================================================== */

#print-preview-container { display: flex; justify-content: center; width: 100%; }

.resume-doc {
  width: 210mm;
  min-height: 297mm;
  flex-shrink: 0;
  background: #fff;
  box-shadow: var(--shadow-lg);
  padding: 16mm 18mm;
  font-family: var(--font-body);
  font-size: 10.6pt;
  line-height: 1.5;
  color: #1c1c1c;
}

.resume-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 2px solid #e4e4e4;
}

.candidate-meta h2 {
  font-family: var(--font-heading);
  font-size: 21pt;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.candidate-meta p { margin: 2px 0; font-size: 9.6pt; color: #444; }

.photo-box-print {
  width: 28mm;
  height: 34mm;
  flex-shrink: 0;
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5pt;
  color: #999;
  background: #fafafa;
}
.photo-box-print img { width: 100%; height: 100%; object-fit: cover; }

.resume-section { margin-top: 12px; break-inside: avoid; page-break-inside: avoid; }

.resume-section-title {
  font-family: var(--font-heading);
  font-size: 10.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0b5d52;
  border-bottom: 1.4px solid #0b5d52;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}

.info-item {
  display: flex;
  gap: 6px;
  font-size: 9.8pt;
  break-inside: avoid;
  page-break-inside: avoid;
}
.info-item.full-width-info { grid-column: 1 / -1; }
.info-label { font-weight: 700; color: #333; min-width: 118px; flex-shrink: 0; }
.info-value { color: #222; }

.resume-text { margin: 0; font-size: 9.8pt; color: #222; }

.qual-table { width: 100%; border-collapse: collapse; font-size: 9.4pt; margin-top: 2px; }
.qual-table th {
  text-align: left;
  background: #f2f6f5;
  color: #16443c;
  font-weight: 700;
  padding: 6px 8px;
  border: 1px solid #dfe6e4;
}
.qual-table td { padding: 6px 8px; border: 1px solid #e4e4e4; }
.qual-table tr { break-inside: avoid; page-break-inside: avoid; }

.declaration-box {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed #cfcfcf;
  font-size: 9.3pt;
  font-style: italic;
  color: #444;
}

.signature-area {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 26px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.sig-block { text-align: center; min-width: 130px; }
.sig-block .info-value { font-size: 9.6pt; text-align: left; margin-bottom: 4px; }
.sig-image-print { max-height: 40px; max-width: 130px; object-fit: contain; margin: 0 auto 4px; }
.sig-title { border-top: 1px solid #888; padding-top: 4px; font-size: 8.8pt; color: #555; }

/* ==========================================================================
   Template 1 — Modern Executive
   Dark navy header band, electric-blue accent, Poppins headings
   ========================================================================== */

.resume-doc.tpl-1 { font-family: 'Inter', sans-serif; padding: 0; }
.resume-doc.tpl-1 .resume-header {
  background: #16233f;
  color: #fff;
  padding: 14mm 18mm 12mm;
  margin: 0 0 8mm;
  border: none;
}
.resume-doc.tpl-1 .candidate-meta h2 { font-family: 'Poppins', sans-serif; color: #fff; }
.resume-doc.tpl-1 .candidate-meta p { color: #b9c6e6; }
.resume-doc.tpl-1 .photo-box-print { border: 2px solid #3b6fd6; background: #1f2f52; color: #9fb1de; }
.resume-doc.tpl-1 .resume-section, .resume-doc.tpl-1 .declaration-box, .resume-doc.tpl-1 .signature-area { padding-left: 18mm; padding-right: 18mm; }
.resume-doc.tpl-1 .declaration-box { padding-bottom: 6mm; }
.resume-doc.tpl-1 .signature-area { padding-bottom: 14mm; }
.resume-doc.tpl-1 .resume-section-title {
  font-family: 'Poppins', sans-serif;
  color: #16233f;
  border-bottom: none;
  border-left: 4px solid #3b6fd6;
  padding-left: 8px;
}
.resume-doc.tpl-1 .qual-table th { background: #eaf0fc; color: #16233f; }

/* ==========================================================================
   Template 2 — Classic Elegant
   Cream tone, serif display, burgundy accent, double gold rule
   ========================================================================== */

.resume-doc.tpl-2 { font-family: 'Merriweather', Georgia, serif; background: #fffdf8; }
.resume-doc.tpl-2 .candidate-meta h2 { font-family: 'Playfair Display', Georgia, serif; color: #7a2e2e; }
.resume-doc.tpl-2 .resume-header { border-bottom: none; position: relative; padding-bottom: 18px; }
.resume-doc.tpl-2 .resume-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #c98a3e 15%, #c98a3e 85%, transparent);
}
.resume-doc.tpl-2 .photo-box-print { border-radius: 50%; border: 3px solid #c98a3e; }
.resume-doc.tpl-2 .resume-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  color: #7a2e2e;
  border-bottom: 1px solid #c98a3e;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12pt;
}
.resume-doc.tpl-2 .qual-table th { background: #fbeef1; color: #7a2e2e; font-family: 'Merriweather', serif; }
.resume-doc.tpl-2 .declaration-box { font-family: Georgia, serif; }

/* ==========================================================================
   Template 3 — Minimalist Clean
   Pure black & white, hairlines, generous whitespace
   ========================================================================== */

.resume-doc.tpl-3 { font-family: 'Inter', sans-serif; color: #111; }
.resume-doc.tpl-3 .candidate-meta h2 { font-weight: 600; letter-spacing: 0.02em; color: #111; }
.resume-doc.tpl-3 .resume-header { border-bottom: 1px solid #111; align-items: flex-end; }
.resume-doc.tpl-3 .photo-box-print { border-radius: 0; border: 1px solid #111; background: #fff; }
.resume-doc.tpl-3 .resume-section-title {
  color: #111;
  border-bottom: 1px solid #111;
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: 9.5pt;
}
.resume-doc.tpl-3 .qual-table th { background: #fff; color: #111; border-bottom: 1px solid #111; border-top: none; border-left: none; border-right: none; }
.resume-doc.tpl-3 .qual-table td { border-left: none; border-right: none; border-top: none; }
.resume-doc.tpl-3 .info-label { color: #555; font-weight: 500; }

/* ==========================================================================
   Template 4 — Corporate Blue
   Structured, blue underline header, tab-style section titles
   ========================================================================== */

.resume-doc.tpl-4 .candidate-meta h2 { color: #14528c; }
.resume-doc.tpl-4 .resume-header { border-bottom: 3px solid #14528c; }
.resume-doc.tpl-4 .photo-box-print { border: 1px solid #14528c; border-radius: 2px; }
.resume-doc.tpl-4 .resume-section-title {
  display: inline-block;
  background: #14528c;
  color: #fff;
  border-bottom: none;
  padding: 4px 12px;
  border-radius: 2px 10px 2px 10px;
}
.resume-doc.tpl-4 .qual-table th { background: #14528c; color: #fff; }
.resume-doc.tpl-4 .qual-table { border: 1px solid #14528c; }
.resume-doc.tpl-4 .qual-table td { border-color: #cfe0ee; }

/* ==========================================================================
   Template 5 — Elegant Serif
   Wine accent, full serif, ornamental top/bottom rule
   ========================================================================== */

.resume-doc.tpl-5 { font-family: 'Merriweather', Georgia, serif; }
.resume-doc.tpl-5 .candidate-meta h2 { font-family: 'Merriweather', Georgia, serif; font-weight: 700; color: #6e1f3a; }
.resume-doc.tpl-5 .resume-header { border-bottom: 3px double #6e1f3a; }
.resume-doc.tpl-5 .photo-box-print { border: 1px solid #6e1f3a; }
.resume-doc.tpl-5 .resume-section-title {
  font-family: 'Merriweather', serif;
  color: #6e1f3a;
  border-bottom: 3px double #6e1f3a;
}
.resume-doc.tpl-5 .qual-table th { background: #fbeef4; color: #6e1f3a; }
.resume-doc.tpl-5 .declaration-box { border-top: 3px double #d8b6c4; }

/* ==========================================================================
   Template 6 — Government Official
   Formal serif, bordered page, tricolour strip, red section titles
   ========================================================================== */

.resume-doc.tpl-6 {
  font-family: 'Merriweather', 'Times New Roman', serif;
  border: 2px solid #1a1a1a;
  padding: 0;
}
.resume-doc.tpl-6 > .resume-header,
.resume-doc.tpl-6 > .resume-section,
.resume-doc.tpl-6 > .declaration-box,
.resume-doc.tpl-6 > .signature-area {
  padding-left: 16mm;
  padding-right: 16mm;
}
.resume-doc.tpl-6::before {
  content: "";
  display: block;
  height: 3mm;
  background: linear-gradient(90deg, #ff9933 33.3%, #ffffff 33.3% 66.6%, #138808 66.6%);
  border-bottom: 1px solid #1a1a1a;
}
.resume-doc.tpl-6 .resume-header { text-align: center; display: block; padding-top: 10mm; border-bottom: 2px solid #1a1a1a; padding-bottom: 8mm; }
.resume-doc.tpl-6 .candidate-meta h2 { text-transform: uppercase; letter-spacing: 0.06em; font-family: 'Merriweather', serif; }
.resume-doc.tpl-6 .candidate-meta p { text-align: center; }
.resume-doc.tpl-6 .photo-box-print { margin: 0 auto 8px; border: 1px solid #1a1a1a; border-radius: 0; }
.resume-doc.tpl-6 .resume-section-title {
  color: #b32424;
  border-bottom: 1px solid #b32424;
  font-family: 'Merriweather', serif;
}
.resume-doc.tpl-6 .qual-table th { background: #f7f7f7; border: 1px solid #1a1a1a; color: #1a1a1a; }
.resume-doc.tpl-6 .qual-table td { border: 1px solid #444; }
.resume-doc.tpl-6 .declaration-box { padding-bottom: 10mm; }
.resume-doc.tpl-6 .signature-area { padding-bottom: 12mm; }

/* ==========================================================================
   Template 7 — Compact Professional
   Tight spacing, small type, slate accent, two-column header
   ========================================================================== */

.resume-doc.tpl-7 { font-size: 9.6pt; line-height: 1.4; }
.resume-doc.tpl-7 .candidate-meta h2 { font-size: 17pt; color: #334155; }
.resume-doc.tpl-7 .resume-header { border-bottom: 1px solid #cbd5e1; padding-bottom: 8px; margin-bottom: 8px; }
.resume-doc.tpl-7 .photo-box-print { width: 22mm; height: 27mm; border: 1px solid #94a3b8; }
.resume-doc.tpl-7 .resume-section { margin-top: 8px; }
.resume-doc.tpl-7 .resume-section-title {
  color: #475569;
  border-bottom: 1px solid #94a3b8;
  font-size: 9.2pt;
  padding-bottom: 3px;
  margin-bottom: 5px;
}
.resume-doc.tpl-7 .info-grid { gap: 3px 16px; }
.resume-doc.tpl-7 .qual-table th { background: #f1f5f9; color: #334155; padding: 4px 6px; }
.resume-doc.tpl-7 .qual-table td { padding: 4px 6px; }

/* ==========================================================================
   Template 8 — Bordered Traditional
   Sepia tone, full ornamental frame, brown accent
   ========================================================================== */

.resume-doc.tpl-8 {
  font-family: Georgia, 'Merriweather', serif;
  background: #fbf6ec;
  border: 1px solid #8a5a2b;
  outline: 4px solid #fbf6ec;
  outline-offset: -10px;
  box-shadow: var(--shadow-lg), 0 0 0 1px #8a5a2b inset;
  position: relative;
}
.resume-doc.tpl-8 .candidate-meta h2 { color: #6b4321; }
.resume-doc.tpl-8 .resume-header { border-bottom: 1px solid #c8a97a; }
.resume-doc.tpl-8 .photo-box-print { border: 2px solid #8a5a2b; background: #f3e9d8; }
.resume-doc.tpl-8 .resume-section-title { color: #8a5a2b; border-bottom: 1px solid #c8a97a; }
.resume-doc.tpl-8 .qual-table th { background: #f3e9d8; color: #6b4321; }
.resume-doc.tpl-8 .qual-table td { border-color: #e3d3b8; }
.resume-doc.tpl-8 .declaration-box { border-top: 1px dashed #c8a97a; }

/* ==========================================================================
   Template 9 — Two-Tone Header
   Split-color header block, bold Poppins caps
   ========================================================================== */

.resume-doc.tpl-9 { padding: 0; }
.resume-doc.tpl-9 .resume-header {
  border: none;
  margin: 0 0 8mm;
  padding: 12mm 18mm;
  background: linear-gradient(100deg, #0f766e 0%, #0f766e 62%, #f97316 62%, #f97316 100%);
  color: #fff;
}
.resume-doc.tpl-9 .candidate-meta h2 { font-family: 'Poppins', sans-serif; text-transform: uppercase; letter-spacing: 0.03em; color: #fff; }
.resume-doc.tpl-9 .candidate-meta p { color: #eafff9; }
.resume-doc.tpl-9 .photo-box-print { border: 3px solid #fff; }
.resume-doc.tpl-9 .resume-section, .resume-doc.tpl-9 .declaration-box, .resume-doc.tpl-9 .signature-area { padding-left: 18mm; padding-right: 18mm; }
.resume-doc.tpl-9 .declaration-box { padding-bottom: 6mm; }
.resume-doc.tpl-9 .signature-area { padding-bottom: 14mm; }
.resume-doc.tpl-9 .resume-section-title {
  font-family: 'Poppins', sans-serif;
  color: #0f766e;
  border-bottom: 2px solid #f97316;
}
.resume-doc.tpl-9 .qual-table th { background: #e6f5f3; color: #0f766e; }

/* ==========================================================================
   Template 10 — Warm Professional
   Terracotta accent, rounded cards, friendly sans
   ========================================================================== */

.resume-doc.tpl-10 { background: #fdf8f3; }
.resume-doc.tpl-10 .candidate-meta h2 { color: #a1512e; }
.resume-doc.tpl-10 .resume-header { border-bottom: none; }
.resume-doc.tpl-10 .photo-box-print { border-radius: 10px; border: 2px solid #c2673d; }
.resume-doc.tpl-10 .resume-section {
  background: #fff;
  border: 1px solid #f1ddce;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(194, 103, 61, 0.06);
}
.resume-doc.tpl-10 .resume-section-title { color: #c2673d; border-bottom: 1px solid #f1ddce; }
.resume-doc.tpl-10 .qual-table th { background: #fbeee5; color: #a1512e; }
.resume-doc.tpl-10 .declaration-box { background: #fff; border: 1px solid #f1ddce; border-top: 1px solid #f1ddce; border-radius: 10px; padding: 10px 14px; }

/* ==========================================================================
   Mobile responsiveness (screen only)
   ========================================================================== */

@media (max-width: 760px) {
  .page-wrapper { padding: 16px 10px 48px; }
  #formView .container { padding: 22px 18px 28px; border-radius: var(--radius-md); }
  .app-header h1 { font-size: 22px; }
  .app-header h1 span { display: block; margin: 8px auto 0; width: fit-content; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-2 + .grid-2, .grid-2 + .grid-3, .grid-3 + .grid-2, .grid-3 + .grid-3 { margin-top: 0; }
  .form-section { padding: 18px 16px 20px; }
  .action-bar { flex-direction: column-reverse; }
  .action-bar .btn { width: 100%; }
  .preview-toolbar { flex-direction: column; align-items: stretch; }
  .preview-toolbar-right { flex-direction: column; }
  .tpl-grid { grid-template-columns: repeat(2, 1fr); }
  .preview-stage { padding: 18px 14px; }
}

/* ==========================================================================
   Print — A4 accurate output
   ========================================================================== */

@page {
  size: A4;
  margin: 0;
}

@media print {
  html, body { background: #fff !important; margin: 0; padding: 0; }
  /* Browsers skip background colors/gradients by default when printing
     (to save ink). Several templates rely on colored headers/bands
     (tpl-1, tpl-6 tricolor strip, tpl-9 gradient, tpl-10 cards), so force
     them to print exactly as shown in the on-screen preview. */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  .no-print,
  #formView,
  #header-placeholder,
  #footer-placeholder,
  .preview-toolbar,
  .template-selector-box,
  .mobile-scroll-hint {
    display: none !important;
  }
  .page-wrapper { padding: 0; }
  #previewView { max-width: none; margin: 0; }
  .preview-stage {
    background: #fff;
    padding: 0;
    border-radius: 0;
    display: block;
  }
  #print-preview-container { display: block; width: auto; }
  .resume-doc {
    box-shadow: none !important;
    outline: none !important;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
  }
  .resume-doc.tpl-8 { box-shadow: none !important; }
  .resume-section, .info-item, .qual-table tr, .signature-area {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .resume-header { break-after: avoid; page-break-after: avoid; }
}

/* ==========================================================================
   T&C (Terms & Conditions) overlay — shown before generating resume preview
   ========================================================================== */
.tnc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.tnc-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 28px;
}
.tnc-box h3 {
  margin: 0 0 14px;
  color: var(--brand-primary-dark);
  font-family: var(--font-heading);
  font-size: 19px;
}
.tnc-text {
  border: 1px solid var(--border);
  background: var(--brand-primary-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  max-height: 260px;
  overflow-y: auto;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.6;
}
.tnc-text p { margin: 0 0 10px; }
.tnc-text p:last-child { margin-bottom: 0; }
.tnc-actions {
  display: flex;
  margin-top: 20px;
}
.tnc-actions .btn { flex: 1; }
@media (max-width: 480px) {
  .tnc-box { padding: 20px; }
}

/* Inline agree-checkbox in the form (above the action bar) */
.tnc-inline {
  margin: 6px 0 14px;
}
.tnc-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
}
.tnc-checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: var(--brand-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.tnc-view-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--brand-primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.tnc-view-link:hover { color: var(--brand-accent); }
