/* Modal styles (apply guide, request, login). Moved out of footer.php. */
.ag-overlay,.ja-overlay,.ja-confirm-overlay,.auth-overlay{opacity:0;pointer-events:none}
.ag-modal,.ja-modal,.auth-modal{transform:translateY(100%);pointer-events:none}
@media(min-width:560px){.ag-modal,.ja-modal,.auth-modal{opacity:0;transform:translate(-50%,-40%) scale(0.96)}}

/* ============================================================
   JOB APPLICATION MODAL
   ============================================================ */
.ja-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.42);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.ja-overlay.open { opacity: 1; pointer-events: auto; }

.ja-modal {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 201;
  background: var(--surface-modal, var(--surface-white));
  border-radius: 20px 20px 0 0;
  padding: 16px 20px 32px;
  max-width: 512px; margin: 0 auto;
  transform: translateY(100%);
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.32,0.72,0,1);
  direction: rtl;
  max-height: 90vh; overflow-y: auto;
}
.ja-modal.open { transform: translateY(0); pointer-events: auto; }

@media (min-width: 560px) {
  .ja-modal {
    bottom: auto; top: 50%; left: 50%; right: auto;
    width: 92%; border-radius: 16px; overflow: visible;
    transform: translate(-50%, -40%) scale(0.96);
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
  .ja-modal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.ja-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--outline-gray-2); margin: 0 auto 12px;
}
@media (min-width: 560px) { .ja-handle { display: none; } }

.ja-close-btn {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  border: none; background: transparent;
  color: var(--ink-gray-5); cursor: pointer;
  transition: background 0.15s;
}
.ja-close-btn:hover { background: var(--surface-gray-2); }

.ja-title {
  font-size: 17px; font-weight: 700;
  color: var(--ink-gray-9); text-align: center; margin: 0;
}
.ja-subtitle {
  font-size: 12px; color: var(--ink-gray-5);
  text-align: center; margin: 4px 0 0;
}

.ja-form { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.ja-field { display: flex; flex-direction: column; gap: 3px; }
.ja-input-wrap { position: relative; }
.ja-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-gray-4); pointer-events: none;
}
.ja-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--outline-gray-2);
  border-radius: 8px; background: var(--surface-gray-1);
  padding: 10px 40px 10px 12px;
  font-size: 14px; color: var(--ink-gray-8); direction: rtl;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.ja-input::placeholder { color: var(--ink-gray-4); }
.ja-input:focus {
  outline: none;
  border-color: var(--ink-blue-4, #2563eb);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.ja-input:disabled { opacity: 0.5; }
.ja-input.ja-error { border-color: #ef4444; }
.ja-field-err { font-size: 12px; color: #ef4444; margin: 0; }

.ja-job-row { display: flex; gap: 8px; }
.ja-job-title-chip {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--outline-gray-2);
  border-radius: 8px; background: var(--surface-gray-2);
  padding: 8px 12px; font-size: 12px; color: var(--ink-gray-5);
  overflow: hidden;
}
.ja-job-title-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ja-job-id-chip {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 5px;
  border: 1px solid var(--outline-gray-2);
  border-radius: 8px; background: var(--surface-gray-2);
  padding: 8px 12px; font-size: 12px; color: var(--ink-gray-5);
  white-space: nowrap;
}

.ja-actions { display: flex; gap: 8px; padding-top: 4px; }
.ja-submit-btn {
  flex: 1; border: none; border-radius: 8px;
  background: #16a34a; color: #fff;
  font-size: 14px; font-weight: 700;
  padding: 11px 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s;
}
.ja-submit-btn:hover { background: #15803d; }
.ja-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ja-cancel-btn {
  border: 1px solid var(--outline-gray-2); border-radius: 8px;
  background: transparent; color: var(--ink-gray-6);
  font-size: 14px; padding: 11px 16px; cursor: pointer;
  transition: background 0.15s;
}
.ja-cancel-btn:hover { background: var(--surface-gray-1); }
.ja-cancel-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ja-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff; border-radius: 50%;
  animation: ja-spin 0.7s linear infinite;
}
@keyframes ja-spin { to { transform: rotate(360deg); } }

/* Confirmation overlay */
.ja-confirm-overlay {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.ja-confirm-overlay.open { opacity: 1; pointer-events: auto; }
.ja-confirm-box {
  background: var(--surface-white);
  border-radius: 16px; width: 300px;
  overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transform: scale(0.9); opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.ja-confirm-overlay.open .ja-confirm-box { transform: scale(1); opacity: 1; }
.ja-confirm-icon {
  display: flex; justify-content: center;
  padding: 24px 0 8px;
}
.ja-confirm-icon svg {
  width: 56px; height: 56px;
  background: rgba(251,191,36,0.15);
  border-radius: 50%; padding: 12px; box-sizing: border-box;
}
.ja-confirm-title {
  font-size: 17px; font-weight: 700;
  color: var(--ink-gray-9); text-align: center;
  margin: 0; padding: 0 24px;
}
.ja-confirm-msg {
  font-size: 13px; color: var(--ink-gray-6);
  text-align: center; padding: 8px 24px 24px;
  margin: 0; line-height: 1.6;
}
.ja-confirm-actions {
  display: flex;
  border-top: 1px solid var(--outline-gray-1);
}
.ja-confirm-cancel {
  flex: 1; padding: 14px;
  border: none; border-left: 1px solid var(--outline-gray-1);
  background: transparent;
  font-size: 14px; font-weight: 500; color: #ef4444;
  cursor: pointer; transition: background 0.15s;
}
.ja-confirm-cancel:hover { background: var(--surface-gray-1); }
.ja-confirm-ok {
  flex: 1; padding: 14px;
  border: none; background: transparent;
  font-size: 14px; font-weight: 700;
  color: var(--ink-blue-4, #2563eb);
  cursor: pointer; transition: background 0.15s;
}
.ja-confirm-ok:hover { background: var(--surface-gray-1); }

/* Toast */
.ja-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 300; padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  white-space: nowrap; transition: opacity 0.3s ease;
}
.ja-toast.success { background: #16a34a; }
.ja-toast.error   { background: #dc2626; }

/* Make apply-btn work as a button */
button.apply-btn {
  width: 100%;
  font-family: inherit;
}

/* ── #appModal state panels ── */
.app-state[hidden] { display: none !important; }
.app-state { display: flex; flex-direction: column; align-items: center; text-align: center; }

/* ── State icon circle (shared with #appModal states) ── */
.ja-state-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 12px;
}
.ja-state-icon--lock {
  background: rgba(99,102,241,0.1);
  color: #6366f1;
}
.ja-state-icon--check {
  background: rgba(22,163,74,0.12);
  color: #16a34a;
}

/* Progress tracker */
.ja-tracker {
  display: flex; flex-direction: column; gap: 0;
  margin-top: 20px; padding: 0 4px;
  position: relative;
}
.ja-tracker::before {
  content: '';
  position: absolute; right: 14px; top: 14px; bottom: 14px;
  width: 2px; background: var(--outline-gray-2);
}
.ja-tracker-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  position: relative; z-index: 1;
}
.ja-tracker-dot {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--outline-gray-2);
  background: var(--surface-white);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-gray-4);
  transition: border-color 0.2s, background 0.2s;
}
.ja-tracker-done .ja-tracker-dot {
  border-color: #16a34a; background: #16a34a; color: #fff;
}
.ja-tracker-active .ja-tracker-dot {
  border-color: #2563eb; background: #2563eb;
  animation: ja-pulse 1.4s ease-in-out infinite;
}
@keyframes ja-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(37,99,235,0); }
}
.ja-tracker-label {
  font-size: 13px; color: var(--ink-gray-7); font-weight: 500;
}
.ja-tracker-done .ja-tracker-label { color: #16a34a; }
.ja-tracker-active .ja-tracker-label { color: #2563eb; font-weight: 600; }

/* ============================================================
   APPLY GUIDE MODAL
   ============================================================ */
.ag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.42);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.ag-overlay.open { opacity: 1; pointer-events: auto; }

.ag-modal {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 201;
  background: var(--surface-modal, var(--surface-white));
  border-radius: 20px 20px 0 0;
  max-width: 512px;
  margin: 0 auto;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.32,0.72,0,1);
}
.ag-modal.open { transform: translateY(0); pointer-events: auto; }

@media (min-width: 560px) {
  .ag-modal {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -40%) scale(0.96);
    border-radius: 16px;
    width: 92%;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
  .ag-modal.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.ag-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--outline-gray-1);
  flex-shrink: 0;
  text-align: center;
  position: relative;
}
.ag-handle {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: var(--outline-gray-2);
  margin: 0 auto 12px;
}
@media (min-width: 560px) { .ag-handle { display: none; } }

.ag-close-btn {
  position: absolute;
  top: 12px; left: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-gray-5);
  cursor: pointer;
  transition: background 0.15s;
}
.ag-close-btn:hover { background: var(--surface-gray-2); }

.ag-title {
  font-size: 17px; font-weight: 700;
  color: var(--ink-gray-9);
  margin: 0;
}
.ag-subtitle {
  font-size: 12px;
  color: var(--ink-gray-5);
  margin: 3px 0 0;
}

.ag-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ag-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  padding: 12px 14px;
  margin-bottom: 20px;
}
.dark .ag-hero {
  background: linear-gradient(135deg, rgba(20,83,45,0.25) 0%, rgba(6,78,59,0.25) 100%);
}
.ag-hero-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(22,163,74,0.15);
  display: flex; align-items: center; justify-content: center;
}
.ag-hero-title {
  font-size: 13px; font-weight: 700; color: var(--ink-gray-8);
}
.ag-hero-sub {
  font-size: 12px; color: var(--ink-gray-5); margin-top: 1px;
}

.ag-steps-heading {
  font-size: 13px; font-weight: 700;
  color: var(--ink-gray-8);
  margin: 0 0 12px;
}

.ag-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.ag-step { display: flex; align-items: flex-start; gap: 12px; }
.ag-step-num {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.ag-step-title {
  font-size: 13px; font-weight: 500; color: var(--ink-gray-8);
}
.ag-step-sub {
  font-size: 12px; color: var(--ink-gray-5);
  margin-top: 2px; line-height: 1.5;
}

.ag-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  padding: 12px;
  font-size: 12px;
  color: var(--ink-gray-6);
  line-height: 1.6;
}
.dark .ag-note {
  border-color: rgba(146,64,14,0.4);
  background: rgba(120,53,15,0.15);
}

.ag-footer {
  padding: 14px 20px 20px;
  border-top: 1px solid var(--outline-gray-1);
  flex-shrink: 0;
}
.ag-browse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border-radius: 12px;
  background: #16a34a;
  color: #fff;
  font-size: 14px; font-weight: 700;
  padding: 13px 20px;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.ag-browse-btn:hover { background: #15803d; }
.ag-browse-btn:active { transform: scale(0.98); }

/* ============================================================
   AUTH MODAL
   ============================================================ */
.auth-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.48);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.auth-overlay.open { opacity: 1; pointer-events: auto; }

.auth-modal {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 201;
  background: var(--surface-modal, #fff);
  border-radius: 24px 24px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  max-width: 480px; margin: 0 auto;
  transform: translateY(100%); pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  direction: rtl;
  max-height: 95dvh; overflow-y: auto;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.15);
}
.auth-modal.open { transform: translateY(0); pointer-events: auto; }

@media (min-width: 560px) {
  .auth-modal {
    bottom: auto; top: 50%; left: 50%; right: auto;
    width: 94%; border-radius: 20px; max-height: 92vh;
    transform: translate(-50%, -40%) scale(0.96);
    opacity: 0; overflow: visible;
    transition: opacity 0.22s ease, transform 0.22s ease;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  }
  .auth-modal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.auth-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--surface-gray-3); margin: 12px auto 0;
}
@media (min-width: 560px) { .auth-handle { display: none; } }

.auth-close-btn {
  position: absolute; top: 14px; left: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--surface-gray-2);
  background: var(--surface-gray-1);
  color: var(--ink-gray-5); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.auth-close-btn:hover { background: var(--surface-gray-2); color: var(--ink-gray-8); }

/* Brand */
.auth-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px 0;
}
.auth-brand-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: #16a34a;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(22,163,74,0.35);
}
.auth-brand-name {
  font-size: 17px; font-weight: 800; color: var(--ink-gray-9); line-height: 1.2;
}
.auth-brand-tag {
  font-size: 11px; color: var(--ink-gray-4); margin-top: 2px;
}

/* Tabs */
.auth-tabs {
  display: flex; position: relative;
  margin: 20px 24px 0;
  border-bottom: 2px solid var(--surface-gray-2);
  gap: 0;
}
.auth-tab {
  flex: 1; padding: 0 0 12px;
  border: none; background: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--ink-gray-5);
  transition: color 0.18s;
  position: relative; z-index: 1;
}
.auth-tab.active { color: #16a34a; }
.auth-tab-ink {
  position: absolute; bottom: -2px; height: 2px;
  background: #16a34a; border-radius: 2px;
  transition: left 0.22s cubic-bezier(0.4,0,0.2,1), width 0.22s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}

/* Panels */
.auth-panel { padding: 20px 24px 8px; display: none; }
.auth-panel.active { display: block; }

/* Fields */
.auth-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 399px) { .auth-grid-2 { grid-template-columns: 1fr; } }

.auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.auth-label {
  font-size: 13px; font-weight: 600; color: var(--ink-gray-7);
  display: flex; align-items: center; gap: 6px;
}
.auth-label-hint {
  font-size: 11px; font-weight: 400; color: var(--ink-gray-4); margin-right: auto;
}
.auth-input-wrap { position: relative; }
.auth-field-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-gray-4); pointer-events: none; flex-shrink: 0;
}
.auth-input {
  width: 100%; box-sizing: border-box;
  border: 1.5px solid var(--surface-gray-2);
  border-radius: 10px;
  background: var(--surface-gray-1);
  padding: 11px 38px 11px 12px;
  font-size: 14px; color: var(--ink-gray-9);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
}
.auth-input-pass { padding-left: 38px; }
.auth-input::placeholder { color: var(--ink-gray-4); }
.auth-input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
  background: var(--surface-white);
}
.auth-input.error { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
.auth-input:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-eye {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  border: none; background: none; padding: 4px;
  color: var(--ink-gray-4); cursor: pointer;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.auth-eye:hover { color: var(--ink-gray-7); }

.auth-field-err {
  font-size: 12px; color: #ef4444; margin: 0;
}

/* Strength bar */
.auth-strength { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.auth-strength-bar {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--surface-gray-2); overflow: hidden;
}
.auth-strength-bar span {
  display: block; height: 100%; border-radius: 2px;
  transition: width 0.25s ease, background 0.25s ease;
}
.auth-strength-label { font-size: 11px; color: var(--ink-gray-4); white-space: nowrap; }

/* Form-level error */
.auth-form-err {
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px; background: rgba(239,68,68,0.06);
  color: #dc2626; font-size: 13px; padding: 10px 14px;
  margin-bottom: 14px; line-height: 1.5;
}

/* Submit */
.auth-submit {
  width: 100%; border: none; border-radius: 12px;
  background: #16a34a; color: #fff;
  font-size: 15px; font-weight: 700; font-family: inherit;
  padding: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.auth-submit:hover { background: #15803d; }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner inside button */
.auth-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: auth-spin 0.65s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Switch link */
.auth-switch {
  font-size: 13px; color: var(--ink-gray-5);
  text-align: center; margin: 14px 0 20px;
}
.auth-switch-btn {
  border: none; background: none; padding: 0;
  color: #16a34a; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: underline; font-family: inherit;
  transition: color 0.15s;
}
.auth-switch-btn:hover { color: #15803d; }

/* Terms */
.auth-terms {
  font-size: 11px; color: var(--ink-gray-4);
  text-align: center; margin: 10px 0 0; line-height: 1.6;
}
.auth-terms a { color: var(--ink-gray-5); text-decoration: underline; }
.auth-terms a:hover { color: #16a34a; }

/* Success state on submit button */
.auth-submit.done { background: #15803d; }
