/* General Interface & Micro-typography */
body {
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
  background-color: #0b0f19;
}

/* Custom form container dark scroll */
#panel-form::-webkit-scrollbar {
  width: 6px;
}
#panel-form::-webkit-scrollbar-track {
  background: #020617;
}
#panel-form::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 99px;
}
#panel-form::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Form inputs & styling */
.form-input {
  width: 100%;
  background-color: #020617;
  color: #f8fafc;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 400;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.1);
  background-color: #090d16;
}

.form-input::placeholder,
.form-textarea::placeholder,
.form-select::placeholder {
  color: #64748b;
  opacity: 1;
}

.form-textarea {
  width: 100%;
  background-color: #020617;
  color: #f8fafc;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 400;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  resize: vertical;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  -webkit-appearance: none;
  appearance: none;
}
.form-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.1);
  background-color: #090d16;
}

.form-select {
  width: 100%;
  background-color: #020617;
  color: #f8fafc;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}
.form-select:focus {
  outline: none;
  border-color: #6366f1;
}

/* Custom Citizenship Switcher Buttons */
.switch-btn {
  padding: 5px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.switch-btn:hover {
  color: #f1f5f9;
}
.switch-btn.active {
  background-color: #1e1b4b;
  color: #818cf8;
  border: 1px solid rgba(129, 140, 248, 0.2);
}

/* Realistic A4 Preview Styling */
#pdf-container {
  font-family: 'PT Serif', Georgia, Times, 'Times New Roman', serif;
  box-sizing: border-box;
}

.placeholder-span {
  display: inline;
  border-bottom: 1px solid #0f172a;
  font-weight: 700;
  color: #0f172a;
  padding: 0 1px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
  vertical-align: baseline;
  transition: background-color 0.2s ease;
}
.placeholder-span.empty {
  display: inline-block;
  min-width: 11em;
  color: #64748b;
  font-style: italic;
  font-weight: 400;
  border-bottom: 1px solid #94a3b8;
}

/* Focus highlighting in the preview panel */
.preview-focus-highlight {
  background-color: #e0e7ff !important;
  color: #1e1b4b !important;
  border-radius: 2px;
  box-shadow: 0 0 0 2px #c7d2fe;
}

/* Meta / signature tables — Chrome print and Google Docs keep table cells,
   unlike flex/grid which collapse into one text stream. */
.print-meta-table,
.print-sign-table,
.print-sign-line {
  width: 100%;
  border-collapse: collapse;
  border: none;
}
.print-meta-table td,
.print-sign-table td,
.print-sign-line td {
  border: none;
  vertical-align: top;
  padding: 0;
}
.print-sign-table {
  table-layout: fixed;
}
.print-sign-col {
  width: 50%;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}
.print-sign-table tr > .print-sign-col:first-child {
  padding-right: 22px;
  padding-left: 0;
}
.print-sign-table tr > .print-sign-col:last-child {
  padding-left: 22px;
  padding-right: 0;
}
.print-sign-col > div {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.print-sign-line {
  margin-top: 10px;
}
.print-sign-label {
  width: 1%;
  white-space: nowrap;
  padding-right: 8px !important;
  color: #64748b;
  font-size: 10px;
  vertical-align: bottom !important;
}
.print-sign-blank {
  border-bottom: 1px solid #000 !important;
  height: 18px;
}

/* Elements print page-break management */
.print-avoid-break {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

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

/* html2canvas на iOS падает на transform: scale() у листа */
body.pdf-exporting #pdf-container {
  transform: none !important;
}

/* Print CSS Media Query with perfect pixel bounds */
@media print {

  html, body {
    background: white !important;
    color: black !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  header, #panel-form, #tab-form-btn, #tab-preview-btn, .print\:hidden, [id^="btn-"], .lucide {
    display: none !important;
  }

  main {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #panel-preview {
    display: block !important;
    width: auto !important;
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  #pdf-container {
    display: block !important;
    box-shadow: none !important;
    border: none !important;
    padding: 18mm 20mm !important;
    margin: 0 !important;
    width: auto !important;
    max-width: none !important;
    min-height: auto !important;
    transform: none !important;
    text-align: left !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  #pdf-container h2 {
    display: block !important;
    text-align: center !important;
    letter-spacing: normal !important;
  }

  #pdf-container p {
    display: block !important;
    text-align: justify !important;
    margin: 0 0 4pt !important;
  }
}
