/* Motaz CV Builder v38 — safe presentation and export layer.
   The archived React/Vinext runtime remains byte-for-byte unchanged. */

:root {
  --v38-ink: #142f3e;
  --v38-blue: #174f6a;
  --v38-blue-2: #237594;
  --v38-gold: #c4a064;
  --v38-line: #d7e1e6;
  --v38-soft: #f4f8fa;
}

/* A CV should contain the applicant's content, never product branding. */
.cv-watermark {
  display: none !important;
}

button,
a,
summary,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #2b85aa !important;
  outline-offset: 2px !important;
}

.field input,
.field textarea,
.custom-field-row input,
.list-item-row input {
  line-height: 1.45;
}

.template-language-toggle button,
.ui-language-toggle button {
  position: relative;
  z-index: 1;
  min-height: 38px;
}

.template-language-toggle button.active,
.ui-language-toggle button.active {
  box-shadow: inset 0 -3px var(--v38-gold), 0 4px 12px #102e3c17;
}

/* Precise photo movement: visible buttons complement the sliders. */
.v38-photo-nudges {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--v38-line);
}

.v38-photo-nudge-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.v38-photo-nudge-copy b {
  color: var(--v38-ink);
  font-size: 12px;
}

.v38-photo-nudge-copy small {
  color: #6e7f88;
  font-size: 10px;
  line-height: 1.45;
}

.v38-photo-nudge-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.v38-photo-nudge-grid button {
  min-width: 0;
  min-height: 47px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #244d62;
  border: 1px solid #cbdbe3;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff, #eef5f8);
  box-shadow: 0 4px 12px #173c4e0d;
}

.v38-photo-nudge-grid button:hover {
  border-color: #7eaabc;
  background: #fff;
  transform: translateY(-1px);
}

.v38-photo-nudge-grid button span {
  font-size: 17px;
  line-height: 1;
}

.v38-photo-nudge-grid button b {
  font-size: 9px;
}

/* Readability: keep the CV's A4 typography intact and enlarge only the app UI. */
@media (min-width: 761px) {
  .editor-head p,
  .panel-heading p,
  .format-heading small,
  .template-switcher small,
  .group-title small,
  .v26-map-steps small,
  .v26-context-guide li,
  .v26-field-hint,
  .sample-data-alert p,
  .quick-start summary small,
  .quick-start-body li small {
    font-size: 11px !important;
    line-height: 1.55 !important;
  }

  .field,
  .panel-tabs button,
  .template-buttons button,
  .format-buttons button,
  .quick-start-actions button,
  .sample-alert-actions button,
  .workspace-dashboard-actions button,
  .preview-save-actions button {
    font-size: 12px !important;
  }

  .field input,
  .field textarea,
  .custom-field-row input,
  .list-item-row input {
    min-height: 44px;
    font-size: 14px !important;
  }

  .v26-builder-map b,
  .quick-start summary b,
  .format-switcher b,
  .template-switcher b,
  .completion-info b,
  .workspace-dashboard-status b,
  .panel-route-tip b,
  .group-title b {
    font-size: 13px !important;
  }

  .panel-route-tip p,
  .workspace-dashboard-status small {
    font-size: 11px !important;
    line-height: 1.55 !important;
  }
}

@media (min-width: 761px) and (max-width: 1279px) {
  .builder-layout {
    width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: minmax(390px, 46vw) minmax(0, 1fr) !important;
  }

  .editor,
  .preview-stage {
    min-width: 0 !important;
  }

  .preview-stage {
    overflow: auto !important;
  }

  .app-header {
    grid-template-columns: auto 1fr auto !important;
    gap: 10px !important;
    padding-inline: 14px !important;
  }

  .header-copy {
    display: none !important;
  }

  .header-actions {
    gap: 6px !important;
  }

  .header-actions button {
    padding: 8px 9px !important;
    font-size: 10px !important;
  }
}

@media (max-width: 760px) {
  .editor-head h1 {
    font-size: 22px !important;
  }

  .editor-head p,
  .panel-heading p,
  .sample-data-alert p,
  .quick-start summary small,
  .quick-start-body li small,
  .format-heading small,
  .template-switcher small,
  .group-title small,
  .v26-map-steps small,
  .v26-context-guide li,
  .v26-field-hint,
  .panel-route-tip p,
  .workspace-dashboard-status small,
  .preview-save-copy span {
    font-size: 12px !important;
    line-height: 1.55 !important;
  }

  .panel-heading h2 {
    font-size: 22px !important;
  }

  .field,
  .field > span,
  .group-title b,
  .quick-start summary b,
  .quick-start-body li b,
  .format-switcher b,
  .template-switcher b,
  .v26-builder-map b,
  .v26-map-steps b,
  .v26-context-guide b,
  .panel-route-tip b,
  .sample-data-alert b,
  .workspace-dashboard-status b {
    font-size: 13px !important;
    line-height: 1.45 !important;
  }

  .field input,
  .field textarea,
  .custom-field-row input,
  .list-item-row input {
    min-height: 48px !important;
    padding: 12px !important;
    font-size: 16px !important;
  }

  .panel-tabs button,
  .template-buttons button,
  .format-buttons button,
  .quick-start-actions button,
  .sample-alert-actions button,
  .workspace-dashboard-actions button,
  .preview-save-actions button,
  .photo-actions button,
  .form-step-actions button {
    min-height: 44px !important;
    font-size: 12px !important;
  }

  .panel-tabs button {
    min-width: 112px !important;
  }

  .mobile-app-dock button > b {
    font-size: 10px !important;
  }

  .preview-actions > button > b,
  .preview-more > summary > b {
    font-size: 9px !important;
  }

  .v38-photo-nudge-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .v38-photo-nudge-grid {
    gap: 5px;
  }

  .v38-photo-nudge-grid button {
    min-height: 54px;
  }

  .v38-photo-nudge-grid button b {
    font-size: 10px;
  }
}

/* If a cached runtime ever fails, show a useful recovery state instead of white. */
.v38-recovery {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  color: #173747;
  background:
    radial-gradient(circle at 85% 10%, #d5ecf4 0, transparent 30rem),
    radial-gradient(circle at 12% 90%, #f3e4c7 0, transparent 28rem),
    #eef3f5;
  font-family: Arial, Tahoma, sans-serif;
}

.v38-recovery > section {
  width: min(620px, 100%);
  padding: 34px;
  border: 1px solid #d8e3e8;
  border-radius: 24px;
  background: #fffffff2;
  box-shadow: 0 28px 80px #102d3c24;
}

.v38-recovery-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #f2ddb6;
  border-radius: 16px;
  background: linear-gradient(145deg, #10394e, #237594);
  font: 700 19px/1 Georgia, serif;
}

.v38-recovery small {
  display: block;
  margin-top: 18px;
  color: #98723a;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .11em;
}

.v38-recovery h1 {
  margin: 8px 0;
  font-size: clamp(25px, 5vw, 38px);
  line-height: 1.25;
}

.v38-recovery p {
  margin: 0;
  color: #657984;
  font-size: 14px;
  line-height: 1.8;
}

.v38-recovery div {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.v38-recovery button,
.v38-recovery a {
  min-height: 48px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd9df;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.v38-recovery button {
  color: #fff;
  border-color: #1e6685;
  background: linear-gradient(135deg, #123c52, #287796);
}

.v38-recovery button:disabled {
  opacity: .65;
}

.v38-recovery a {
  color: #3f5966;
  background: #fff;
}

/* Deterministic PDF: exactly the CV page, always light, never app chrome. */
@media print {
  @page {
    size: A4;
    margin: 0;
  }

  html,
  html.v30-dark,
  body {
    width: 210mm !important;
    min-width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    color-scheme: light !important;
    background: #fff !important;
    overflow: visible !important;
  }

  body::before,
  body::after,
  .app-header,
  .editor,
  .mobile-switch,
  .v31-mobile-tools,
  .v31-install-button,
  .v31-mobile-install,
  .v30-theme-toggle,
  .mobile-install-cta,
  .mobile-app-dock,
  .mobile-preview-dock,
  .mobile-section-navigator,
  .preview-toolbar,
  .preview-design-studio,
  .preview-save-card,
  .preview-note,
  .preview-more,
  .section-journey,
  .section-organizer,
  .workspace-dashboard,
  .creator-credit,
  .quick-start,
  .panel-route-tip,
  .form-step-actions,
  .sample-data-alert,
  .demo-data-chip,
  .welcome-overlay,
  .save-confirm-overlay,
  .v27-guide-modal,
  .v26-toast,
  .toast,
  .v38-recovery,
  .cv-watermark {
    display: none !important;
  }

  .app-shell,
  .builder-layout,
  .preview-stage,
  .preview-canvas,
  .preview-scale {
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: visible !important;
    position: static !important;
    inset: auto !important;
    transform: none !important;
    zoom: 1 !important;
    display: block !important;
  }

  .preview-stage > * {
    display: none !important;
  }

  .preview-stage > .preview-canvas,
  .preview-canvas > .preview-scale {
    display: block !important;
  }

  #cv-document,
  #cv-document.cv-sheet {
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 297mm !important;
    height: auto !important;
    margin: 0 !important;
    transform: none !important;
    zoom: 1 !important;
    box-shadow: none !important;
    background: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #cv-document.cv-sheet:not(.europass-sheet):not(.german-minimal-sheet):not(.german-simple-sheet) {
    padding: 11.6mm 14.55mm 11mm !important;
  }

  #cv-document.cv-sheet.europass-sheet,
  #cv-document.cv-sheet.german-minimal-sheet {
    padding: 0 0 11mm !important;
  }

  #cv-document.cv-sheet.german-simple-sheet {
    padding: 0 19mm 11mm !important;
  }

  .cv-record,
  .experience-record,
  .education-record,
  .german-signature,
  .cv-footer-grid > section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
