@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  background-color: #f4f4f4;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* Container designed to mimic A4 paper */

.page-container {
  background: white;
  width: 210mm;
  padding: 15mm;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Header Layout: Centered Logo with side text */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.header-text h2 {
  font-size: 18px;
  margin-bottom: 2px;
}

.header-ar {
  text-align: right;
  direction: rtl;
}

.logo-box {
  text-align: center;
}

.logo-box img {
  width: 85px;
  height: auto;
}

.form-title {
  text-align: center;
  font-size: 14px;
  margin: 10px 0;
  border-bottom: 1px solid #000;
  padding-bottom: 5px;
}

/* Main Content Grid */

.main-form {
  display: flex;
  gap: 15px;
  margin-top: 10px;
  flex-direction: row-reverse;
}

.photo-area {
  width: 130px;
  height: 160px;
  border: 2px solid #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  flex-shrink: 0;
}

input {
  transition: border-color 0.3s;
}

.input-fields {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.label-en {
  min-width: 125px;
  font-size: 11px;
  font-weight: bold;
}

.label-ar {
  min-width: 90px;
  text-align: right;
  font-size: 12px;
  font-weight: bold;
  direction: rtl;
}

input[type="text"],
input[type="tel"],
input[type="date"] {
  flex-grow: 1;
  border: 1px solid #999;
  border-radius: 4px;
  padding: 4px;
  height: 26px;
  text-align: center;
  font-size: 12px;
}

/* Matches the double-input style in your screenshot */

.dual-inputs {
  display: flex;
  flex-grow: 1;
  gap: 5px;
}

#sex-container {
  transition: border ease;
}

.radio-section {
  display: flex;
  flex-grow: 1;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px 10px;
  align-items: center;
}

/* Lower Admin Boxes */

.bottom-boxes {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 10px;
}

.box {
  border: 1px solid #666;
  border-radius: 8px;
  height: 120px;
  padding: 10px;
  direction: rtl;
}

.box-admin {
  width: 65%;
  text-align: right;
}

.box-sign {
  width: 35%;
  text-align: right;
}

.box h4 {
  font-size: 13px;
  margin-bottom: 5px;
}

/* Declaration Text */

.declaration {
  margin-top: 15px;
  direction: rtl;
  text-align: justify;
  font-size: 12px;
  line-height: 1.8;
}

.line-input {
  border: none;
  border-bottom: 1px solid #000;
  width: 100px;
  text-align: center;
  outline: none;
}

/* Print Button */

.print-nav {
  background: #004d1a;
  color: white;
  padding: 10px 30px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 15px;
}

/* Page 2 Layout Styling */

.big-box {
  page-break-before: always;
  background: white;
  width: 210mm;
  padding: 15mm;
  margin-top: 50px;
  direction: rtl;
  border: 1px solid #eee; /* Light border for screen view */
}

.big-box,
.big-box * {
  box-sizing: border-box;
}

.page-2-header {
  text-align: center;
  margin-bottom: 20px;
}

.section-title {
  font-weight: bold;
  display: inline-block;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 3px;
}

.form-group input,
.form-group select {
  border: 1px solid #000;
  border-radius: 4px;
  padding: 5px;
  height: 32px;
  font-size: 12px;
}

.judgement-box {
  border: 1px solid #000;
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  width: 100%;
}

.judgement-box .details-input {
  flex: 1;
  min-width: 200px;
  border: none;
  border-bottom: 1px solid #000;
  background: transparent;
  padding: 2px 5px;
}

.official-lines {
  margin-top: 30px;
  width: 100%;
  overflow: hidden;
  line-height: 2.2;
  text-align: center;
}

.official-line {
  border-bottom: 1px solid #000;
  margin-bottom: 15px;
  width: 100%;
  display: block;
}

@media print {
  body {
    background: white;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .page-container {
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 10mm;
  }
}

@page {
  size: A4;
  margin: 0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f4f4f4;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* Page Containers */
.page-container,
.big-box {
  background: white;
  width: 210mm;
  padding: 10mm;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  position: relative;
  direction: rtl; /* Form globally RTL */
}

.big-box {
  margin-top: 0px;
  border: 1px solid #eee;
}

/* Header & Typography */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.header-text h2 {
  font-size: 18px;
  margin-bottom: 2px;
}
.logo-box img {
  width: 85px;
  height: auto;
}
.form-title,
.page-2-header {
  text-align: center;
  font-weight: bold;
  border-bottom: 1px solid #000;
  padding-bottom: 5px;
  margin: 10px 0;
}

/* Form Grids */
.row-3,
.row-2,
.row-1 {
  display: grid;
  gap: 8px;
  margin-bottom: 6px;
}
.row-3 {
  grid-template-columns: repeat(3, 1fr);
}
.row-2 {
  grid-template-columns: repeat(2, 1fr);
}
.row-1 {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label,
.input-with-label label {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 3px;
}
.form-group input,
.form-group select,
.input-with-label input {
  border: 1px solid #000;
  border-radius: 4px;
  padding: 5px;
  height: 32px;
  font-size: 12px;
}

/* Judgement Section: Fixed 1/3 scaling */
.judgement-grid-custom {
  display: grid;
  grid-template-columns: 1fr 100px 1.5fr;
  gap: 15px;
  align-items: center;
  margin-bottom: 25px;
  direction: rtl;
  width: 100%;
}

.radio-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding-bottom: 5px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.input-with-label {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.input-with-label label {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 4px;
}

.input-with-label input {
  width: 100%;
  height: 32px;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 5px;
}

.judgement-main-label {
  font-weight: bold;
  font-size: 12px;
  text-align: right;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 4px;
  text-align: right;
}

.input-group input {
  height: 32px;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 5px;
  width: 100%;
}

/* Official Use Lines */
.official-lines {
  margin-top: 30px;
  line-height: 2.2;
  text-align: center;
}
.official-line {
  border-bottom: 1px solid #000;
  margin-bottom: 15px;
  width: 100%;
  display: block;
}

/* Buttons & Printing */
.print-nav {
  background: #004d1a;
  color: white;
  padding: 10px 30px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 15px;
}
/* ================= PRINT LOGIC ================= */

@page {
  size: A4;
  margin: 10mm;
}

@media print {

  /* Hide print button */
  .no-print {
    display: none !important;
  }

  html, body {
    background: #fff;
    margin: 0;
    padding: 0;
    overflow: visible;
    zoom: 85%;   
  }

  /* Make each main section behave like a page */
  .page-container {
    page-break-after: always;
    break-after: page;
  }

  .big-box {
    page-break-before: always;
    break-before: page;
  }

  /* Prevent cutting inside sections */
  .input-row,
  .bottom-boxes,
  .declaration,
  .row,
  .table tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

}


table {
  width: 100%;
  border-collapse: collapse;
  direction: rtl;
  font-size: 13px;
  font-weight: 800;
}

table td {
  border: 1px solid #000;
  padding: 10px;
  vertical-align: middle;
}

table input[type="text"],
table input[type="tel"],
table input[type="date"],
table input[type="number"] {
  width: 100%;
  border: none;
  outline: none;
  font-size: 13px;
  background: transparent;
}
