@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 - positioned at 0,0 underneath the body so it layout renders correctly without shift */
#pdf-template-container {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  width: 210mm;
  z-index: -9999;
  background: white;
}

/* When printing or generating PDF, style the template */
.pdf-page {
  width: 210mm;
  height: 297mm;
  padding: 15mm 15mm;
  box-sizing: border-box;
  background: white;
  color: black;
  font-family: 'Noto Serif Bengali', 'Noto Sans Bengali', Arial, serif;
  font-size: 11pt;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.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: 18pt;
  font-weight: bold;
  color: #15803d;
  margin: 0;
  text-align: center;
}

.pdf-org-subtitle {
  font-size: 9.5pt;
  margin: 2px 0 0 0;
  text-align: center;
  font-weight: 500;
}

.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-color: #e2e8f0;
  color: #0f172a;
  font-size: 10.5pt;
  font-weight: bold;
  padding: 3px 6px;
  margin-top: 10px;
  margin-bottom: 6px;
  border-left: 4px solid var(--cds-green);
}

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

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

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

.pdf-photo-box {
  width: 3.5cm;
  height: 4.5cm;
  border: 1px solid #000;
  text-align: center;
  font-size: 8pt;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.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;
}

/* 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;
  }
}
