@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@300;400;500;600;700&family=Noto+Serif+Bengali:wght@400;700&display=swap');

/* Color Variables */
:root {
  --cds-green: #3A7D5C;
  --cds-green-hover: #2d6248;
  --cds-green-light: #eaf2ed;
  --cds-border: #ffb3b3;
  --cds-border-focus: #3A7D5C;
  --cds-bg-light: #f7faf8;
  --cds-text-dark: #212529;
  --office-bg: #f1f5f9;
}

body {
  font-family: 'Noto Sans Bengali', 'SolaimanLipi', Arial, sans-serif;
  background-color: var(--cds-bg-light);
  color: var(--cds-text-dark);
}

/* Header & Banner Styles */
.cds-banner {
  background-color: #fff;
  border-bottom: 4px solid var(--cds-green);
  border-top: 4px solid var(--cds-green);
}

.cds-nav-bar {
  background-color: var(--cds-green);
  color: white;
  padding: 8px 15px;
  font-size: 14px;
}

.cds-nav-bar a {
  color: white;
  text-decoration: none;
  margin-right: 15px;
}

.cds-nav-bar a:hover {
  text-decoration: underline;
}

/* Section Card Header (BSDB Government style) */
.cds-section-header {
  background-color: var(--cds-green);
  color: white;
  font-weight: bold;
  padding: 8px 15px;
  margin-top: 25px;
  margin-bottom: 15px;
  border-radius: 4px;
  font-size: 16px;
  border-left: 5px solid #eab308;
}

/* Form Styles */
.form-container {
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border-radius: 8px;
  padding: 20px;
}

/* Red borders for inputs like BSDB */
.form-control, .form-select {
  border: 1px solid var(--cds-border);
  border-radius: 4px;
  padding: 0.375rem 0.75rem;
  font-size: 0.95rem;
  background-color: #fff;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
  border-color: var(--cds-border-focus);
  box-shadow: 0 0 0 0.25rem rgba(58, 125, 92, 0.25);
}

/* Required fields indicator */
.required-star {
  color: #dc3545;
  margin-left: 3px;
  font-weight: bold;
}

.error-feedback {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 4px;
  display: none;
}

.is-invalid {
  border-color: #dc3545 !important;
}

.is-invalid + .error-feedback,
.is-invalid ~ .error-feedback {
  display: block;
}

/* Photo and Signature Box */
.photo-box {
  width: 132px; /* Approx 3.5cm */
  height: 170px; /* Approx 4.5cm */
  border: 2px dashed #94a3b8;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f8fafc;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  padding: 5px;
}

.photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-box span {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

/* Signature Box */
.sig-box {
  width: 150px;
  height: 50px;
  border: 2px dashed #94a3b8;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8fafc;
  cursor: pointer;
  overflow: hidden;
}

.sig-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sig-box span {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

/* Office Use Only Section CSS */
.office-section {
  background-color: var(--office-bg);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 15px;
}

.office-badge {
  background-color: #64748b;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Action Buttons */
.btn-cds-primary {
  background-color: var(--cds-green);
  color: white;
  border: none;
  font-weight: bold;
  padding: 10px 24px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.btn-cds-primary:hover {
  background-color: var(--cds-green-hover);
  color: white;
}

.btn-cds-secondary {
  background-color: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: bold;
  padding: 10px 24px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.btn-cds-secondary:hover {
  background-color: #cbd5e1;
  color: #1e293b;
}

/* --- PDF Export Styles --- */
/* The hidden PDF container - controls display toggling */
#pdf-template-container {
  display: none;
}

/* Styled for the Preview Screen */
#pdf-template {
  margin: 0 auto;
  width: 794px;
  background: white;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* When printing or generating PDF, style the template */
.pdf-page {
  width: 794px;
  height: 1119px; /* slightly under full A4 (1123px) so sub-pixel rounding never overflows into an extra blank page */
  padding: 26px 34px 23px;
  box-sizing: border-box;
  background: #e7f4ee; /* light mint background to match the printed design */
  color: #0f172a;
  font-family: 'Noto Serif Bengali', 'Noto Sans Bengali', Arial, serif;
  font-size: 9.5pt;
  line-height: 1.35;
  position: relative;
  overflow: hidden;
  border: 2px solid #2a9d8f;        /* teal frame around the page */
  border-bottom: 9px solid #16335a; /* dark navy strip at the bottom */
}

.page-break {
  page-break-after: always;
  break-after: page;
}

/* PDF Form Elements styling */
.pdf-header {
  border-bottom: 2px solid #000;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.pdf-logo {
  width: 65px;
  height: 65px;
}

.pdf-org-title {
  font-family: 'Noto Serif Bengali', serif;
  font-size: 16pt;
  font-weight: bold;
  color: #15803d;
  margin: 0;
  text-align: center;
}

.pdf-org-subtitle {
  font-size: 10pt;
  margin: 1px 0 0 0;
  text-align: center;
  font-weight: bold;
  color: #1e3a8a;
}

.pdf-org-tagline {
  font-size: 8pt;
  color: #1e3a8a;
  margin: 2px 0 0 0;
  text-align: center;
  font-weight: 600;
}

.pdf-form-title-badge {
  background-color: #dc2626;
  color: white;
  font-size: 12pt;
  font-weight: bold;
  padding: 4px 15px;
  border-radius: 4px;
  display: inline-block;
  text-align: center;
  margin: 0 auto;
}

.pdf-section-title {
  background: linear-gradient(90deg, #137a55, #25a87e);
  color: #ffffff;
  font-size: 10pt;
  font-weight: bold;
  padding: 3px 9px;
  margin-top: 8px;
  margin-bottom: 5px;
  border-radius: 2px;
}

/* General dot leaders / lines for PDF data fields */
.pdf-field-line {
  border-bottom: 1px dotted #334155;
  display: inline-block;
  min-height: 15px;
  vertical-align: bottom;
  padding-left: 6px;
  padding-right: 6px;
  color: #0f172a;
  font-weight: bold;
}

/* Form-number cell rendered as a solid white box (per design) */
.pdf-box-field {
  border: 1px solid #555;
  border-radius: 2px;
  background: #fff;
  min-height: 17px;
}

/* Soft teal separator bar holding the form number + red badge */
.pdf-meta-bar {
  border-top: 1px solid #2a9d8f;
  border-bottom: 1px solid #2a9d8f;
  padding: 3px 0;
  margin-top: 3px;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 5px;
}

.pdf-table td {
  padding: 2px 2px;
  vertical-align: middle;
}

.pdf-photo-box {
  width: 2.8cm;
  height: 3.6cm;
  border: 1px solid #555;
  background: #fff;
  color: #555;
  text-align: center;
  font-size: 7.5pt;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  margin-left: auto;
}

.pdf-photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdf-checkbox {
  width: 12px;
  height: 12px;
  border: 1px solid #000;
  display: inline-block;
  margin-right: 4px;
  text-align: center;
  line-height: 11px;
  font-size: 8.5pt;
  font-weight: bold;
  vertical-align: middle;
}

.pdf-checkbox-checked {
  background-color: #f1f5f9;
}

/* Two-column layout helper for addresses */
.pdf-col-2 {
  display: flex;
  justify-content: space-between;
}

.pdf-address-col {
  width: 48%;
}

.pdf-office-table {
  border: 1px solid #000;
  width: 100%;
  border-collapse: collapse;
}

.pdf-office-table td, .pdf-office-table th {
  border: 1px solid #000;
  padding: 4px 6px;
  font-size: 9.5pt;
}

.pdf-office-title {
  background-color: #cbd5e1;
  font-weight: bold;
}

.pdf-footer-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
}

.pdf-signature-line {
  border-top: 1px dashed #000;
  width: 180px;
  text-align: center;
  padding-top: 3px;
  font-size: 9.5pt;
}

/* "কেন সদস্য হতে চান" free-text box */
.pdf-reason-box {
  border-bottom: 1px dotted #334155;
  min-height: 26px;
  padding: 3px 4px;
  font-weight: bold;
  font-size: 9pt;
}

/* Interest-area checkbox grid */
.pdf-interest-table {
  width: 100%;
  margin-top: 3px;
  font-size: 8.5pt;
  border-collapse: collapse;
}

.pdf-interest-table td {
  padding: 2px 2px;
  vertical-align: middle;
}

/* Footer note line on page 1 */
.pdf-note {
  margin-top: 8px;
  border-top: 1px dotted #94a3b8;
  padding-top: 4px;
  font-style: italic;
  font-size: 8pt;
  color: #475569;
}

/* Responsive adjustments for mobile screens */
@media (max-width: 768px) {
  .cds-banner h1 {
    font-size: 1.5rem !important;
  }
  .cds-banner h2 {
    font-size: 0.95rem !important;
  }
  .cds-banner p {
    font-size: 0.75rem !important;
  }
  .photo-box {
    margin: 10px auto;
  }
  .form-container {
    padding: 15px 10px;
  }
  .cds-section-header {
    font-size: 14px;
    padding: 6px 10px;
  }
  .btn-cds-primary, .btn-cds-secondary {
    width: 100%;
    padding: 10px 16px;
    text-align: center;
    justify-content: center;
  }
  .d-flex.justify-content-center.gap-3 {
    flex-direction: column;
    gap: 10px !important;
  }
}
