:root { --primary-color: #4E1B69;
  	--secondary-color: #7d68b8;
	--accent-color: #f59e0b;
	--light-bg: #f0f7ff;
	--field-h: 44px;
	 --primary-disabled-bg: #a99ad0;
  	--primary-disabled-border: #9382be;
  	--primary-disabled-text: #f1eff7;
	--secondary-hover-bg: rgba(98,69,149,.08);
	--secondary-active-bg: rgba(98,69,149,.14);
	--secondary-disabled: #c7bedf;
	--bs-primary-rgb: 78, 27, 105;
  	--bs-focus-ring-color: rgba(197, 132, 225, 0.3);      
  	--ah-primary-2: #6C2C8F;
  	--ah-accent: #E6D9F2;
  	--ah-glow-1: rgba(255,255,255,.18);
  	--ah-glow-2: rgba(255,255,255,.10);
}

body {
	background-color: #F4F4F4;
	color: #333;
	padding-top: 20px;
}

/* ===== Modern Airline Header ===== */
.airline-header{
  position: relative;
  overflow: hidden;
  color: #fff;
  border-radius: 20px;
  padding: clamp(20px, 4vw, 36px) clamp(20px, 4vw, 40px);
  margin-bottom: 18px;
  /* layered background: gradient + subtle grid */
  background:
    radial-gradient(1200px 500px at 80% -20%, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 60%),
    linear-gradient(135deg, var(--primary-color) 0%, var(--ah-primary-2) 100%);
  box-shadow: 0 10px 30px rgba(31, 20, 46, .25);
  isolation: isolate; /* keep glows behind text */
}

/* soft grid lines (very subtle) */
.airline-header::before{
  content:"";
  position:absolute; inset:0;
  background:
    linear-gradient(to right, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 36px 100%,
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px) 0 0 / 100% 20px;
  mix-blend-mode: soft-light;
  opacity:.35;
  pointer-events:none;
}

/* diagonal light sweep & bottom accent line */
.airline-header::after{
  content:"";
  position:absolute; inset:0;
  background:
    linear-gradient( to right, transparent 0%, rgba(255,255,255,.12) 40%, transparent 70% ),
    linear-gradient( to bottom, transparent calc(100% - 2px), rgba(255,255,255,.35) 2px );
  mix-blend-mode: soft-light;
  pointer-events:none;
}

/* floating glow chips */
.ah-inner::before,
.ah-inner::after{
  content:"";
  position:absolute;
  filter: blur(24px);
  pointer-events:none;
}
.ah-inner::before{
  width:220px; height:220px; border-radius:50%;
  left:-60px; top:-40px;
  background: radial-gradient(circle at 30% 30%, var(--ah-glow-1), transparent 60%);
}
.ah-inner::after{
  width:260px; height:260px; border-radius:50%;
  right:-80px; bottom:-60px;
  background: radial-gradient(circle at 70% 60%, var(--ah-glow-2), transparent 65%);
}

/* content */
.ah-inner{
  position: relative;
  z-index: 1;
  text-align: center;
}

.ah-eyebrow{
  display:inline-block;
  font-size: .875rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #EDE7F6;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  backdrop-filter: blur(4px);
}

.ah-title{
  margin: 6px 0 2px;
  font-weight: 800;
  line-height: 1.15;
  font-size: clamp(1.4rem, 2.5vw + 1rem, 2.4rem);
  letter-spacing: .2px;
}

.ah-sub{
  margin: 0;
  color: #F5EFFA;
  font-size: clamp(.95rem, .4vw + .9rem, 1.1rem);
  opacity: .95;
}

/* subtle top edge “shine” for depth */
.airline-header {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.15),
    0 10px 30px rgba(31, 20, 46, .25);
}

/* motion-respect */
@media (prefers-reduced-motion: reduce){
  .airline-header,
  .airline-header::before,
  .airline-header::after { transition: none !important; }
}

@media (max-width: 767.98px){
  .ah-inner
  {
    padding: 10px !important;
  }
}

/* ===== Stepbar layout ===== */
.stepbar{
  display: flex;
  align-items: center;
  gap: 0;
  padding-left: 0;
  margin-bottom: 16px !important;
}

/* Equal-width steps; grid splits [content] | [connector] */
.stepbar .step{
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: center;
  column-gap: 12px;
}

.stepbar .step-link{
  grid-column: 1 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  width: auto;
  color: inherit;
  cursor: default; /* display-only */
}

.stepbar .step-circle{
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid #393939;
  display: grid; place-items: center;
  font-weight: 600; line-height: 1;
  flex: 0 0 auto;
  margin: 0;
}
.stepbar .step-label{
  white-space: nowrap;
}

@media (max-width: 768px){
  .stepbar .step-link{ flex-direction: column; }
  .stepbar .step-label{ white-space: normal; font-size: .875rem; line-height: 1.2; }
}

/* CURRENT (dominant) */
.stepbar .step.is-current .step-circle{
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #fff !important;
}
.stepbar .step.is-current .step-label{
  color: var(--primary-color) !important;
  font-weight: 600 !important;
}

/* COMPLETE (persist on non-current steps) */
.stepbar .step.is-complete .step-circle{
  background: var(--bs-success);
  border-color: var(--bs-success);
  color: transparent;
  position: relative;
}
.stepbar .step.is-complete .step-circle::after{
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1rem;
}
.stepbar .step.is-complete .step-label{
  color: var(--bs-success);
  font-weight: 600;
}

.stepbar .step.is-locked{
  --line-color: #e5e7eb;
}
.stepbar .step.is-locked .step-link{
  pointer-events: none;
  cursor: not-allowed;
}
.stepbar .step.is-locked .step-circle{
  background: #f3f4f6 !important;
  border-color: #d1d5db !important;
  color: #9aa3af !important;
}
.stepbar .step.is-locked .step-label{
  color: #9aa3af !important;
  font-weight: 500;
}

/* Prevent locked from being overridden */
.stepbar .step.is-locked.is-current .step-circle,
.stepbar .step.is-locked.is-complete .step-circle{
  background: #f3f4f6 !important;
  border-color: #d1d5db !important;
  color: #9aa3af !important;
}
.stepbar .step.is-locked.is-current .step-label,
.stepbar .step.is-locked.is-complete .step-label{
  color: #9aa3af !important;
}

.form-container {
	background-color: white;
	border-radius: 12px;
	padding:	 30px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
	margin-bottom: 30px;
}

.section-title {
	color: var(--primary-color);
	border-bottom: 2px solid var(--primary-color);
	padding-bottom: 16px;
	margin-bottom: 25px;
	font-weight: 600;
}

.section-title-confirm {
	border-bottom: 2px solid var(--primary-color);
	padding-bottom: 16px;
	margin-bottom: 25px;
	display: flex;
	justify-content: space-between;
    align-items: center;
}

.form-label {
	font-weight: 500;
	color: #444;
}

.required-field::after {
	content: " *";
	color: #e32;
}

.subhead {
  color: var(--secondary-color);
  font-weight: 600;
  font-size: clamp(.95rem, .9rem + .2vw, 1.1rem);
  margin: .25rem 0 .75rem;
  padding-left: .6rem;
  border-left: .25rem solid #6f42c1;
  line-height: 1.2;
}

.form-control:not(textarea):not([type="file"]):not([type="range"]),
.form-select:not(.js-choices){
  height: var(--field-h);
  padding-top: .5rem; padding-bottom: .5rem;
  border-width: 1px;
  box-sizing: border-box;
}

input[type="date"], input[type="time"]{
  min-height: var(--field-h);
}

.btn-primary {
	background-color: var(--primary-color);
	border-color: var(--primary-color);
	padding: 12px 30px;
	font-weight: 600;
	border-radius: 8px;
	transition: all 0.3s;
}

.btn-primary:hover {
	background-color: #2d103d;
	border-color: #2d103d;
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary:disabled,
.btn-primary.disabled,
.btn-primary[disabled] {
  background-color: var(--primary-disabled-bg) !important;
  border-color: var(--primary-disabled-border) !important;
  color: var(--primary-disabled-text) !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary:disabled:hover,
.btn-primary.disabled:hover,
.btn-primary:disabled:focus,
.btn-primary.disabled:focus {
  background-color: var(--primary-disabled-bg) !important;
  border-color: var(--primary-disabled-border) !important;
  box-shadow: none !important;
  transform: none !important;
}

.secondary-btn {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
  background-color: transparent;
  padding: 12px 30px;
  font-weight: 600;
  border-radius: 8px;
  transition: all .3s;
}

.secondary-btn:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background-color: var(--secondary-hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,.10);
}

.secondary-btn:active {
  transform: translateY(0);
  background-color: var(--secondary-active-bg);
  box-shadow: none;
}

.secondary-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .25rem rgba(98,69,149,.25);
}

/* Disabled */
.secondary-btn:disabled,
.secondary-btn.disabled,
.secondary-btn[disabled] {
  color: var(--secondary-disabled) !important;
  border-color: var(--secondary-disabled) !important;
  background-color: transparent !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

.btn-pdf {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
  background-color: transparent;
  font-weight: 600;
  border-radius: 8px;
  transition: all .3s;
}

.btn-success {
  padding: 12px 30px;
  font-weight: 600;
  border-radius: 8px; 
  transition: all .3s;
}

.btn-success:hover {
  background-color: #1c885b;
  border-color: #1c885b;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,.15);
}

.btn-success:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-success:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .25rem var(--success-focus-ring);
}


.upload-area {
	border: 2px dashed #ccc;
	border-radius: 8px;
	padding: 25px;
	text-align: center;
	background-color: #f9f9f9;
	cursor: pointer;
	transition: all 0.3s;
}

.upload-area:hover {
	border-color: var(--secondary-color);
	background-color: #edf5ff;
}

.upload-icon {
	font-size: 48px;
	color: var(--primary-color);
	margin-bottom: 15px;
}

#previewImage   {
	max-width: 100%;
	max-height: clamp(220px, 40vh, 360px); 
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#previewBox{
  min-height: 260px;
  overflow: hidden;
}

.language-badge {
	margin-right: 5px;
	margin-bottom: 5px;
	background-color: var(--secondary-color);
}

footer {
	text-align: center;
	padding: 20px;
	color: #666;
	font-size: 0.9rem;
}

/* Desktop: show full stepbar, hide compact */
.stepbar-compact { display: none; }

.stepbar-compact .sc-wrap{
  display:flex; align-items:center; gap:12px; width:100%;
  padding:16px 24px; border:1px solid #eee; border-radius:12px; background:#fff;
}

/* circle size: just a bit bigger than text */
.stepbar-compact .sc-circle{
  --size: 4em; 
  --stroke: 4px;
  --accent: var(--primary-color, #624595);
  position: relative;
  width: var(--size); height: var(--size);
  display:inline-grid; place-items:center;
}

.stepbar-compact .sc-ring{ width:100%; height:100%; transform: rotate(-90deg); }
.stepbar-compact .sc-ring circle{ fill:none; stroke-linecap: round; }

/* track (bg) */
.stepbar-compact .sc-track{
  stroke:#e5e7eb; 
  stroke-width: var(--stroke);
}

/* progress stroke */
.stepbar-compact .sc-progress{
  stroke: var(--accent);
  stroke-width: var(--stroke);
  stroke-dasharray: 100;  
  stroke-dashoffset: 100; 
  transition: stroke-dashoffset .25s ease;
}

/* 2 of 6 text inside ring */
.stepbar-compact .sc-count{
  position:absolute; inset:0; display:grid; place-items:center;
  font-size: .9rem; font-weight: 600; color:#444;
}

/* text area */
.stepbar-compact .sc-text{ min-width:0; margin-left: auto; text-align: right; flex:1; color: var(--primary-color);}
.stepbar-compact .sc-current {
	color: var(--primary-color);
	font-size: 20px;
	font-weight: 700 !important;
}
.stepbar-compact .sc-current, .stepbar-compact .sc-next{
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* base: <1200px — circle on top, label below */
nav[aria-label="Application steps"] .stepbar{
  display: flex;
  justify-content: space-evenly; /* กระจายเท่า ๆ กันทั้งแทบ */
  align-items: center;
  width: 100%;
  padding: 8px 0;
  gap: 0;
}

.stepbar .step{
  flex: 1 1 0;
  display: flex;
  justify-content: center;        /* กึ่งกลางแต่ละ step */
}

.stepbar .step .step-link{
  display: flex;
  flex-direction: column;         /* ⬅️ circle บน, label ล่าง */
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  width: 100%;
}

.stepbar .step .step-circle{ margin: 0; }

.stepbar .step .step-label{
  display: block;
  margin-top: 4px;
  line-height: 1.1;
  white-space: normal;
  text-wrap: balance; 
  max-width: 16ch; 
}

/* ≥1200px — circle left, label right */
@media (min-width: 1200px) {
  .stepbar .step .step-link{
    flex-direction: row; 
    text-align: left;
    gap: 8px;
  }
  .stepbar .step .step-label{
    margin-top: 0;
    white-space: nowrap; 
    max-width: none;
  }
}

@media (max-width: 767.98px){
  nav[aria-label="Application steps"] .stepbar { display: none; }
  .stepbar-compact { display: block; }
}




/* ==========================================
   Mobile/Tablet chunk separators for add-rows
   Show only on small/medium screens
   ========================================== */
@media (max-width: 768px){ /* include iPad portrait */

  /* 1) Initialize per-list counters and default label */
  #otherLangList, #eduList, #workBlock{
    counter-reset: chunkIndex;        /* restart counter per list */
    --chunk-label: "Entry ";          /* default label, can be overridden per list */
    --chunk-rule: #d9d6ea;            /* soft divider color */
    --chunk-badge-bg: #F8F6FF;        /* soft tag background */
    --chunk-badge-border: #E6E0F6;    /* tag border */
    --chunk-badge-color: #624595;     /* tag text (purple) */
  }

  /* 1.1) Override label per section (optional; adjust wording here) */
  #otherLangList{ --chunk-label: "Language "; }
  #eduList      { --chunk-label: "Education "; }
  #workBlock    { --chunk-label: "Work "; }

  /* 2) Each row becomes a positioning context and increments the counter */
  #otherLangList > .other-lang-row,
  #eduList      > .edu-row,
  #workBlock    > .work-row{
    position: relative;
    margin-top: 12px;
    counter-increment: chunkIndex;
  }

  /* 3) Full-width divider BEFORE every row except the first.
        Use Bootstrap gutter var to stretch beyond .row negative margins. */
  #otherLangList > .other-lang-row:not(:first-child)::before,
  #eduList      > .edu-row:not(:first-child)::before,
  #workBlock    > .work-row:not(:first-child)::before{
    content: "";
    position: absolute;
    top: -8px;
    left:  calc(var(--bs-gutter-x, 1.5rem) * -0.5);
    right: calc(var(--bs-gutter-x, 1.5rem) * -0.5);
    height: 1px;
    background: var(--chunk-rule);
  }

  /* 4) Small badge AFTER the rule to emphasize each chunk number */
  #otherLangList > .other-lang-row:not(:first-child)::after,
  #eduList      > .edu-row:not(:first-child)::after,
  #workBlock    > .work-row:not(:first-child)::after{
    content: var(--chunk-label) counter(chunkIndex); /* e.g., "Language 2" */
    position: absolute;
    top: -16px;
    left: 0;
    font-size: 12px;
    line-height: 1;
    color: var(--chunk-badge-color);
    background: var(--chunk-badge-bg);
    border: 1px solid var(--chunk-badge-border);
    border-radius: 999px;
    padding: 3px 8px;
    z-index: 1; /* sit above the rule */
  }

  /* 5) Minor vertical alignment tweak for the rightmost button column when stacked */
  #otherLangList > .other-lang-row .d-grid,
  #eduList      > .edu-row .d-grid,
  #workBlock    > .work-row .d-grid{
    margin-top: 4px;
  }
}

/* Add a small top margin for the action button column (Add / Clear / Remove)
   Applies to: .other-lang-row, .edu-row, .work-row  */
/* Desktop/tablet default */
#otherLangList .other-lang-row .d-grid,
#eduList      .edu-row        .d-grid,
#workBlock    .work-row       .d-grid{
  margin-top: 6px; /* subtle breathing space */
}

/* On narrow screens give a bit more space when rows stack */
@media (max-width: 768px){
  #otherLangList .other-lang-row .d-grid,
  #eduList      .edu-row        .d-grid,
  #workBlock    .work-row       .d-grid{
    margin-top: 10px;
  }
}


/* Change: make the confirmation image responsive and centered on small screens */
.form-container[data-step="5"] .col-md-auto img{
  max-width: 180px;          /* safe size for mobile */
  height: auto;
  border-radius: 12px;
}

/* Change: improve spacing of the top row (image + content) on small screens */
@media (max-width: 768px){
  .form-container[data-step="5"] .row.g-4{
    row-gap: 1rem;           /* tighten vertical gap a bit */
  }
}

/* ========== Key–Value rows inside confirmation ========== */

/* Change: always allow text to wrap in value cells to avoid overflow */
.form-container[data-step="5"] .d-flex > .flex-grow-1{
  overflow-wrap: anywhere;    /* modern wrap for long words/emails/IDs */
  word-break: break-word;     /* fallback for older browsers */
  min-width: 0;               /* prevent flex overflow */
}

/* Change: desktop/tablet keep two-column look but allow shrink */
@media (min-width: 769px){
  .form-container[data-step="5"] .d-flex{
    flex-wrap: nowrap;        /* keep side-by-side on larger screens */
  }
  .form-container[data-step="5"] .d-flex > .text-muted{
    min-width: 200px !important;  /* respect original label width */
    max-width: 40%;               /* but don't let it overgrow */
  }
}

/* Change: on mobile stack label above value, kill fixed min-width from inline style */
@media (max-width: 768px){
  .form-container[data-step="5"] .d-flex{
    flex-wrap: wrap;          /* allow wrapping to next line */
  }
  .form-container[data-step="5"] .d-flex > .text-muted{
    min-width: 0 !important;  /* override inline min-width:180px */
    width: 100%;              /* full width label on its own line */
    margin-right: 0 !important;
    margin-bottom: .25rem;    /* small separation from value */
  }
  .form-container[data-step="5"] .d-flex > .flex-grow-1{
    width: 100%;              /* value takes full width on next line */
  }
}

/* ========== Bordered groups (Other languages / Education / Work / Appointment) ========== */
/* Change: reduce left padding that comes from "ps-4" utility so phones don't feel cramped */
@media (max-width: 768px){
  .form-container[data-step="5"] .border.rounded-3{
    padding-left: 12px !important;  /* neutralize .ps-4 on mobile */
    padding-right: 12px;            /* balance */
  }
}

/* Optional (section headers): ensure subheads don’t wrap awkwardly */
.form-container[data-step="5"] .subhead{
  overflow-wrap: anywhere;
}

/* === Base focus (keeps your purple for normal focus) === */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="search"],
select,
textarea,
.form-control,
.form-select{
  transition: box-shadow .2s ease, border-color .2s ease;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus{
  outline: none;
  border-color: var(--primary-color, #4E1B69);
  box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color, rgba(197,132,225,.3));
}

/* === Validation override when we are showing validation feedback ===
   EN: When the form has .showing-validation, invalid fields get RED border and RED focus ring.
   This overrides the purple focus style above only for invalid elements. */
#candidateForm.showing-validation input:invalid,
#candidateForm.showing-validation select:invalid,
#candidateForm.showing-validation textarea:invalid,
#candidateForm.showing-validation .form-control:invalid,
#candidateForm.showing-validation .form-select:invalid{
  border-color: var(--bs-danger, #dc3545) !important;
}

#candidateForm.showing-validation input:invalid:focus,
#candidateForm.showing-validation select:invalid:focus,
#candidateForm.showing-validation textarea:invalid:focus,
#candidateForm.showing-validation .form-control:invalid:focus,
#candidateForm.showing-validation .form-select:invalid:focus{
  border-color: var(--bs-danger, #dc3545) !important;
  box-shadow: 0 0 0 .25rem rgba(220,53,69,.25) !important;
}

.force-invalid,
.force-invalid:focus {
  border-color: #dc3545 !important;                 /* Bootstrap danger */
  box-shadow: 0 0 0 .25rem rgba(220,53,69,.25) !important;
}

.stepbar .step-link:focus,
.stepbar .step-link:focus-visible{
  outline: none;
  box-shadow: none;
}

/* === Confirmation edit controls (added) === */
/* EN: layout wrapper puts Edit on the right side of each subhead */
.confirm-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
}

/* EN: subtle text-only button on desktop; purple-ish hover ring */
.edit-link{
  appearance:none;
  border:0;
  background:transparent;
  color:#8a8a8a; 
  font-weight:600;
  font-size:.9rem;
  padding:4px 8px;
  border-radius:8px;
  cursor:pointer;
  transition:color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.edit-link:hover{
  color: var(--primary-color);   /* hover: purple text */
  background: rgba(98,69,149,.08);
}

.edit-link:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(98,69,149,.25); 
}


/* EN: on mobile, make the edit link more prominent and easier to tap */
@media (max-width: 768px){
  .edit-link{
    color:#5a5a5a; 
    font-weight:600;
    padding:6px 10px; 
    background: rgba(98,69,149,.06);
  }
}

.pdf-exporting #receiptCard{
  max-width: none !important; /* force full custom width */
}

/* Hide floating/mobile action buttons during capture if needed */
.pdf-exporting .receipt-actions{
  visibility: hidden !important;
}

/* Kill animations/transitions for consistency while capturing */
.pdf-exporting *{
  animation: none !important;
  transition: none !important;
}