@font-face {
  font-family: "Advertising Medium";
  src: url("./asset/AdvertisingMedium%20Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Al Mohanad";
  src: url("./asset/AL-Mohanad%20Thick.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kacst Qurn";
  src: url("./asset/mry_KacstQurn-Regular-3.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, "Noto Sans Arabic", sans-serif;
  background: #f0f0f0;
  color: #111;
}
body {
  min-height: 100vh;
}
button, input {
  font: inherit;
}
.app-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  background: #f0f0f0;
}
.controls-panel {
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d7d7d7;
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.controls-panel h2 {
  margin: 0 0 16px;
  font-size: 22px;
}
.saved-note {
  margin: -8px 0 16px;
  color: #667085;
  font-size: 12px;
}
#fields {
  display: grid;
  gap: 12px;
}
.photo-control-block {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid #e2e5e9;
  border-radius: 10px;
  background: #fafafa;
}
.photo-control-block h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
#photoControls {
  display: grid;
  gap: 10px;
}
.field-editor {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  align-items: center;
  gap: 8px 10px;
  padding: 10px;
  border: 1px solid #e2e5e9;
  border-radius: 9px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
}
.field-label {
  display: grid;
  gap: 2px;
  color: #2c2c2c;
  text-align: left;
  font-size: 15px;
}
.field-hint {
  color: #667085;
  font-size: 10px;
  font-weight: 400;
}
.field-editor > input[type="text"] {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: #fafafa;
  padding: 10px 12px;
  font-size: 14px;
}
.card-label-editor {
  color: #475467;
  font-size: 12px;
  font-weight: 500;
}
.field-editor > input[type="text"]:nth-of-type(2) {
  font-size: 13px;
}
.field-settings {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 400;
}
.field-settings summary {
  padding: 5px 0;
  color: #475467;
  cursor: pointer;
  font-weight: 600;
}
.field-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  padding-top: 8px;
}
.slider-section-title {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: #344054;
  font-size: 11px;
  font-weight: 600;
}
.slider-control {
  display: grid;
  gap: 3px;
  color: #475467;
  font-size: 11px;
  font-weight: 500;
}
.slider-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.slider-value {
  min-width: 2.5em;
  padding: 1px 5px;
  border-radius: 4px;
  background: #eef2f6;
  color: #344054;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.slider-control input {
  width: 100%;
  margin: 0;
  accent-color: #344054;
}
.slider-range-controls {
  display: grid;
  grid-template-columns: 1fr 30px 30px;
  align-items: center;
  gap: 6px;
}
.slider-step-button {
  min-width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid #cfd5dd;
  border-radius: 6px;
  background: #eef2f6;
  color: #344054;
  font-family: "Advertising Medium", sans-serif;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.slider-step-button:hover {
  background: #dfe5ec;
}
.slider-step-button:focus-visible {
  outline: 2px solid #344054;
  outline-offset: 2px;
}
.photo-upload {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}
.photo-upload input {
  width: 100%;
  font-size: 12px;
}
.photo-status {
  margin: 7px 0 0;
  color: #667085;
  font-size: 12px;
}
.clear-background {
  margin-top: 8px;
  padding: 7px 10px;
  background: #475467;
  font-size: 12px;
}
.actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
button, .button-link {
  border: 0;
  border-radius: 8px;
  background: #1d2939;
  color: #fff;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}
.preview-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
.id-card {
  position: relative;
  container-type: inline-size;
  flex: none;
  width: min(839px, 100%);
  aspect-ratio: 3.375 / 2.125;
  overflow: hidden;
  background: #f0f0f0;
}
.card-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.card-background-fill {
  position: absolute;
}
.card-background-fill[hidden],
.card-background img[hidden] {
  display: none;
}
.card-background img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transform-origin: center;
}
.photo-frame {
  position: absolute;
  left: 1.07%;
  top: 31.6%;
  width: 26.4%;
  height: 55.6%;
  background: #fff;
  border: 1px solid #b5b5b5;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
  background: #dfe0df;
}
.card-content {
  position: absolute;
  top: 0;
  bottom: 0;
  left: auto;
  right: 7.2%;
  width: 66%;
  height: 100%;
  text-align: right;
}
.title-wrap {
  position: absolute;
  top: 17.9%;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.2cqw;
  text-align: right;
}
.english-name {
  font-family: Arial, sans-serif;
  font-size: 3.15cqw;
  line-height: 1.1;
  letter-spacing: 0;
  color: #111;
  font-weight: 400;
  text-align: right;
}
.arabic-name {
  font-family: "Al Mohanad", "Noto Sans Arabic", Arial, sans-serif;
  font-size: 2.9cqw;
  line-height: 1.2;
  color: #111;
  font-weight: 700;
}
.meta-row {
  position: absolute;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4cqw;
  margin-top: 0;
  font-family: "Al Mohanad", "Noto Sans Arabic", Arial, sans-serif;
  font-size: 2.6cqw;
  line-height: 1.2;
  color: #111;
}
.card-content > .meta-row:nth-child(2) {
  top: 34%;
}
.card-content > .meta-row:nth-child(3) {
  top: 43.8%;
}
.card-content > .meta-row:nth-child(4) {
  top: 53.8%;
}
.card-content > .meta-row:nth-child(5) {
  top: 63.8%;
}
.card-content > .meta-row:nth-child(6) {
  top: 72.4%;
}
.card-content > .meta-row:nth-child(7) {
  top: 82.4%;
}
.meta-item-version {
  margin-right: 3.5cqw;
}
.card-content > .meta-row:nth-child(4) {
  gap: 0;
}
.card-content > .meta-row:nth-child(4) > .meta-item-issueAr,
.card-content > .meta-row:nth-child(4) > .meta-item-birth {
  position: absolute;
  top: 0;
  white-space: nowrap;
}
.card-content > .meta-row:nth-child(4) > .meta-item-issueAr {
  right: 0;
}
.card-content > .meta-row:nth-child(4) > .meta-item-birth {
  left: 0;
}
.card-content > .meta-row:nth-child(6) {
  gap: 17cqw;
}
.meta-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.2cqw;
}
.meta-item-nationality {
  gap: 3cqw;
}
.meta-item-job {
  gap: 3cqw;
}
.meta-item-employer {
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 2.5cqw;
}
.meta-item-employer .meta-label {
  flex: 0 0 auto;
  white-space: nowrap;
}
.meta-item-employer .meta-value {
  flex: 1 1 55%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
.controls-panel h2,
.saved-note,
.photo-control-block h3,
.photo-upload,
.photo-status,
.field-label,
.field-hint,
.card-label-editor,
.field-settings summary,
.slider-section-title,
.slider-control,
.slider-heading,
.meta-label,
.meta-value,
button,
.button-link {
  font-family: "Advertising Medium", "Noto Sans Arabic", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.3;
}
.meta-label {
  display: inline-block;
  font-family: "Advertising Medium", sans-serif;
  font-weight: 400;
}
.meta-value {
  display: inline-block;
  font-family: "Al Mohanad", sans-serif;
  font-weight: 700;
}
.meta-value[data-key="number"] {
  font-family: Arial, sans-serif;
  font-weight: 700;
}
.arabic-text,
.arabic-text.meta-value {
  font-family: "Al Mohanad", sans-serif;
}
.arabic-numbers {
  font-family: "Kacst Qurn", sans-serif;
  font-weight: 400 !important;
}
.arabic-text.arabic-numbers {
  font-family: "Kacst Qurn", sans-serif;
}
.meta-value[data-key="number"].arabic-numbers {
  font-family: "Kacst Qurn", sans-serif;
  font-weight: 400;
}
.barcode-wrap {
  position: absolute;
  left: 1.43%;
  top: 90.69%;
  width: 26.7%;
  text-align: center;
}
.barcode {
  display: flex;
  width: 100%;
  height: 2.62cqw;
  background: #fff;
}
.barcode .bar,
.barcode .space {
  flex-basis: 0;
}
.barcode .bar {
  background: #000;
}
.barcode-number {
  position: relative;
  top: -0.8cqw;
  margin-top: 0.7cqw;
  font-size: 2.2cqw;
  font-family: Arial, sans-serif;
  letter-spacing: 0.12cqw;
  color: #111;
}
.preview-shell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 32px 20px;
}
.bottom-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .controls-panel {
    order: 2;
  }
  .preview-panel {
    order: 1;
  }
  .id-card {
    width: min(839px, 100%);
  }
  .photo-frame {
    left: 1.07%;
    top: 31.6%;
    width: 26.4%;
    height: 55.6%;
  }
  .barcode-wrap {
    left: 1%;
    top: 88.4%;
    width: 26.5%;
  }
}

@page {
  size: 3.375in 2.125in;
  margin: 0;
}
@media print {
  html, body {
    width: 100%;
    min-height: 0;
    margin: 0;
    background: #fff;
  }
  .preview-shell {
    display: block;
    min-height: 0;
    padding: 0;
  }
  .preview-shell .id-card,
  .app-shell:not(.preview-shell) .id-card {
    width: 3.375in;
    height: 2.125in;
    max-width: none;
    margin: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .app-shell:not(.preview-shell) {
    display: block;
    min-height: 0;
    padding: 0;
  }
  .app-shell:not(.preview-shell) .controls-panel {
    display: none;
  }
  .app-shell:not(.preview-shell) .preview-panel {
    display: block;
    padding: 0;
  }
  .bottom-actions,
  .actions {
    display: none;
  }
}
