/* ══════════════════════════════════════════════════════════
   Career Application Form — Polished Design
   ══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

.caf-wrap {
  --brand:        #E8A020;
  --brand-dark:   #c47f0a;
  --brand-glow:   rgba(232,160,32,0.18);
  --brand-light:  #fff9ee;
  --border:       #e8eaed;
  --border-focus: #E8A020;
  --text:         #111827;
  --text-sub:     #6b7280;
  --bg-field:     #f8f9fb;
  --bg-form:      #ffffff;
  --radius-form:  18px;
  --radius-field: 12px;
  --shadow-form:  0 4px 32px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --font:         'Plus Jakarta Sans', sans-serif;

  font-family: var(--font);
  max-width: 720px;
  margin: 0 auto;
  padding: 8px;
}

/* ── Form shell ─────────────────────────────────────── */
.caf-form {
  background: var(--bg-form);
  border-radius: var(--radius-form);
  padding: 40px 44px;
  box-shadow: var(--shadow-form);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Row ────────────────────────────────────────────── */
.caf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Base field wrapper ─────────────────────────────── */
.caf-field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.caf-field--full {
  grid-column: 1 / -1;
}

/* ── Floating-label inputs & textarea ──────────────── */
/*
  Structure: <input placeholder=" "> <label>
  Label floats up when input is focused or has value.
*/

.caf-field > input,
.caf-field > textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 22px 16px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-field);
  font-size: 14.5px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
  background: var(--bg-field);
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  resize: none;
  appearance: none;
  -webkit-appearance: none;
  line-height: 1.4;
}

.caf-field > textarea {
  padding-top: 24px;
  min-height: 110px;
}

.caf-field > input:focus,
.caf-field > textarea:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-glow);
}

/* Floating label — default (centered in field) */
.caf-field > label:not(.caf-file-label):not(.caf-select-label) {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  pointer-events: none;
  transition: top 0.18s ease, font-size 0.18s ease, color 0.18s ease, font-weight 0.18s ease;
  white-space: nowrap;
  line-height: 1;
}

/* Textarea label starts near top */
.caf-field > textarea ~ label:not(.caf-file-label) {
  top: 16px;
  transform: none;
}

/* Floated state — input focused OR has value */
.caf-field > input:focus ~ label:not(.caf-file-label),
.caf-field > input:not(:placeholder-shown) ~ label:not(.caf-file-label),
.caf-field > textarea:focus ~ label:not(.caf-file-label),
.caf-field > textarea:not(:placeholder-shown) ~ label:not(.caf-file-label) {
  top: 8px;
  transform: none;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.caf-field label span { color: #ef4444; }

/* ── Select fields ──────────────────────────────────── */
.caf-field--select {
  position: relative;
  display: flex;
  flex-direction: column;
}

.caf-field--select select {
  width: 100%;
  box-sizing: border-box;
  padding: 22px 42px 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-field);
  font-size: 14.5px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
  background: var(--bg-field);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  line-height: 1.4;
}

.caf-field--select select:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-glow);
}

.caf-field--select select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f0f1f3;
}

/* Static label always at top for selects */
.caf-select-label {
  position: absolute;
  top: 9px;
  left: 17px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  line-height: 1;
  z-index: 1;
}

.caf-select-label span { color: #ef4444; }

/* Custom arrow */
.caf-select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  pointer-events: none;
  display: flex;
  align-items: center;
  transition: color 0.18s;
}

.caf-field--select:focus-within .caf-select-arrow {
  color: var(--brand);
}

/* ── Error text ─────────────────────────────────────── */
.caf-error {
  font-size: 11.5px;
  color: #ef4444;
  margin-top: 4px;
  min-height: 0;
  line-height: 1.4;
  font-weight: 500;
}

/* Error border state */
.caf-field.has-error > input,
.caf-field.has-error > textarea,
.caf-field--select.has-error select {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

/* ── File upload ────────────────────────────────────── */
.caf-field--file {
  position: relative;
}

.caf-field--file input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.caf-file-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-field);
  background: var(--bg-field);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.caf-file-label:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}

.caf-file-label.has-file {
  border-color: var(--brand);
  border-style: solid;
  background: var(--brand-light);
}

.caf-file-icon {
  color: var(--brand);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.caf-file-text {
  flex: 1;
  min-width: 0;
}

.caf-file-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.caf-file-text small {
  font-size: 11.5px;
  color: var(--text-sub);
  font-weight: 400;
}

.caf-file-name {
  font-size: 12px;
  color: var(--text-sub);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
  transition: color 0.18s;
}

.caf-file-name.has-file {
  color: var(--brand-dark);
}

/* ── Submit row ─────────────────────────────────────── */
.caf-submit-row {
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.caf-submit-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 15px 52px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(232,160,32,0.3);
  outline: none;
}

.caf-submit-btn:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232,160,32,0.4);
}

.caf-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(232,160,32,0.3);
}

.caf-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner */
@keyframes caf-spin {
  to { transform: rotate(360deg); }
}
.caf-spin { animation: caf-spin 0.75s linear infinite; }

/* ── Form messages ──────────────────────────────────── */
.caf-form-msg {
  text-align: center;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.caf-form-msg.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.caf-form-msg.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Hide fields after success */
.caf-form.caf-submitted .caf-field,
.caf-form.caf-submitted .caf-row,
.caf-form.caf-submitted .caf-submit-row {
  display: none;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  .caf-form {
    padding: 28px 20px;
    border-radius: 14px;
  }
  .caf-row {
    grid-template-columns: 1fr;
  }
}
