/* ============================================================
   Job Employer – core.css
   Shared tokens, resets, and utility classes.
   All selectors are scoped with .je- prefix.
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
.je-wrap, .je-modal {
  --je-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --je-font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Brand */
  --je-color-primary:      #2563eb;
  --je-color-primary-dark: #1d4ed8;
  --je-color-primary-light:#eff6ff;
  --je-color-secondary:    #64748b;

  /* Neutrals */
  --je-color-bg:           #f8fafc;
  --je-color-surface:      #ffffff;
  --je-color-border:       #e2e8f0;
  --je-color-border-focus: #93c5fd;

  /* Text */
  --je-color-text:         #0f172a;
  --je-color-text-muted:   #64748b;
  --je-color-text-light:   #94a3b8;

  /* Status colours */
  --je-color-success:      #16a34a;
  --je-color-success-bg:   #f0fdf4;
  --je-color-warning:      #d97706;
  --je-color-warning-bg:   #fffbeb;
  --je-color-error:        #dc2626;
  --je-color-error-bg:     #fef2f2;
  --je-color-info:         #0284c7;
  --je-color-info-bg:      #f0f9ff;

  /* Layout */
  --je-radius:             8px;
  --je-radius-sm:          4px;
  --je-radius-lg:          12px;
  --je-shadow-sm:          0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --je-shadow:             0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --je-shadow-lg:          0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  /* Transitions */
  --je-transition:         150ms ease;
}

/* ── Base resets inside .je-wrap ───────────────────────────── */
.je-wrap *, .je-modal * {
  box-sizing: border-box;
}

.je-wrap {
  font-family: var(--je-font-sans);
  font-size: 14px;
  color: var(--je-color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────── */
.je-wrap h1, .je-wrap h2, .je-wrap h3, .je-wrap h4 {
  margin: 0 0 .5rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--je-color-text);
}

/* ── Buttons ───────────────────────────────────────────────── */
.je-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--je-radius);
  font-family: var(--je-font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--je-transition), border-color var(--je-transition),
              color var(--je-transition), opacity var(--je-transition);
  white-space: nowrap;
  user-select: none;
}

.je-btn--primary {
  background: var(--je-color-primary);
  color: #fff;
  border-color: var(--je-color-primary);
}
.je-btn--primary:hover {
  background: var(--je-color-primary-dark);
  border-color: var(--je-color-primary-dark);
  color: #fff;
  text-decoration: none;
}

.je-btn--ghost {
  background: transparent;
  color: var(--je-color-secondary);
  border-color: var(--je-color-border);
}
.je-btn--ghost:hover {
  background: var(--je-color-bg);
  color: var(--je-color-text);
  text-decoration: none;
}

.je-btn--danger-outline {
  background: transparent;
  color: var(--je-color-error);
  border-color: var(--je-color-error);
}
.je-btn--danger-outline:hover {
  background: var(--je-color-error-bg);
  text-decoration: none;
}

.je-btn--sm  { padding: 5px 12px; font-size: 12px; }
.je-btn--full { width: 100%; }

.je-btn:disabled,
.je-btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Form elements ─────────────────────────────────────────── */
.je-label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--je-color-text);
}

.je-required { color: var(--je-color-error); margin-left: 2px; }

.je-input,
.je-select,
.je-textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--je-color-surface);
  border: 1px solid var(--je-color-border);
  border-radius: var(--je-radius);
  font-family: var(--je-font-sans);
  font-size: 14px;
  color: var(--je-color-text);
  outline: none;
  transition: border-color var(--je-transition), box-shadow var(--je-transition);
  appearance: none;
}

.je-input:focus,
.je-select:focus,
.je-textarea:focus {
  border-color: var(--je-color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.je-input--readonly {
  background: var(--je-color-bg);
  color: var(--je-color-text-muted);
  padding: 9px 12px;
  border: 1px solid var(--je-color-border);
  border-radius: var(--je-radius);
}

.je-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

.je-select--sm { padding: 5px 28px 5px 10px; font-size: 12px; }
.je-input--sm  { padding: 5px 10px; font-size: 12px; }

.je-textarea { resize: vertical; min-height: 100px; }

.je-input-group {
  position: relative;
  display: flex;
}
.je-input-group .je-input { padding-right: 40px; }
.je-input-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  opacity: .6;
  transition: opacity var(--je-transition);
}
.je-input-toggle:hover { opacity: 1; }

.je-field {
  margin-bottom: 16px;
}
.je-field--sm  { flex: 0 0 160px; }
.je-field--xs  { flex: 0 0 100px; }

.je-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .je-field-row { grid-template-columns: 1fr; }
}

.je-field__error {
  display: block;
  font-size: 12px;
  color: var(--je-color-error);
  margin-top: 4px;
  min-height: 16px;
}

.je-field__hint {
  display: block;
  font-size: 12px;
  color: var(--je-color-text-muted);
  margin-top: 4px;
}

.je-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.je-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--je-color-primary);
}

/* ── Multi-select dropdown ─────────────────────────────────── */
.je-multiselect { position: relative; }
.je-multiselect-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: #fff;
}
.je-multiselect-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--je-color-text);
  font-size: 14px;
}
.je-multiselect-btn:not(:focus) .je-multiselect-text:first-child:last-child { color: var(--je-color-text-muted); }
.je-multiselect-chevron { flex-shrink: 0; opacity: .5; transition: transform .2s; }
.je-multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--je-color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px 0;
}
.je-multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s;
}
.je-multiselect-option:hover { background: var(--je-color-bg-alt, #f1f5f9); }

.je-fieldset {
  border: 1px solid var(--je-color-border);
  border-radius: var(--je-radius);
  padding: 16px 20px 20px;
  margin: 0 0 24px;
}

.je-fieldset__legend {
  font-weight: 600;
  font-size: 13px;
  color: var(--je-color-primary);
  padding: 0 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Alerts ────────────────────────────────────────────────── */
.je-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--je-radius);
  font-size: 14px;
  margin-bottom: 20px;
}
.je-alert--error   { background: var(--je-color-error-bg);   color: var(--je-color-error);   border-left: 3px solid var(--je-color-error); }
.je-alert--info    { background: var(--je-color-info-bg);    color: var(--je-color-info);    border-left: 3px solid var(--je-color-info); }
.je-alert--success { background: var(--je-color-success-bg); color: var(--je-color-success); border-left: 3px solid var(--je-color-success); }
.je-alert--warning { background: var(--je-color-warning-bg); color: var(--je-color-warning); border-left: 3px solid var(--je-color-warning); }
.je-alert__icon { font-size: 16px; flex-shrink: 0; }
.je-alert[hidden] { display: none; }  /* prevent display:flex from overriding the hidden attribute */

/* ── Badges ────────────────────────────────────────────────── */
.je-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: capitalize;
  white-space: nowrap;
}

/* Application statuses — all values from JC_Applications::VALID_STATUSES */
.je-badge--applied     { background: #e0f2fe; color: #0369a1; }
.je-badge--pending     { background: #fef9c3; color: #854d0e; }
.je-badge--reviewed    { background: #ede9fe; color: #5b21b6; }
.je-badge--shortlisted { background: #f0fdf4; color: #15803d; }
.je-badge--interview   { background: #fff7ed; color: #c2410c; }
.je-badge--rejected    { background: #fee2e2; color: #b91c1c; }
.je-badge--hired       { background: #d1fae5; color: #065f46; }

/* Employer / job statuses */
.je-badge--active     { background: #d1fae5; color: #065f46; }
.je-badge--paused     { background: #fef9c3; color: #854d0e; }
.je-badge--closed     { background: #f1f5f9; color: #475569; }
.je-badge--draft      { background: #e2e8f0; color: #475569; }
.je-badge--suspended  { background: #fee2e2; color: #b91c1c; }

/* Job types */
.je-badge--job-type { background: var(--je-color-primary-light); color: var(--je-color-primary); }

.je-badge--lg { font-size: 13px; padding: 4px 12px; }

/* ── Tables ────────────────────────────────────────────────── */
.je-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--je-color-border);
  border-radius: var(--je-radius);
}

.je-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.je-table th {
  background: var(--je-color-bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--je-color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--je-color-border);
  white-space: nowrap;
}
.je-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--je-color-border);
  vertical-align: middle;
}
.je-table tbody tr:last-child td { border-bottom: none; }
.je-table tbody tr:hover { background: var(--je-color-bg); }

/* ── Action buttons in tables ──────────────────────────────── */
.je-actions { display: flex; gap: 6px; }
.je-action-btn {
  background: none;
  border: 1px solid var(--je-color-border);
  border-radius: var(--je-radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--je-transition), border-color var(--je-transition);
}
.je-action-btn:hover { background: var(--je-color-bg); }
.je-action-btn--danger:hover { background: var(--je-color-error-bg); border-color: var(--je-color-error); }

/* ── Loading / spinner ─────────────────────────────────────── */
.je-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--je-color-text-muted);
}

.je-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--je-color-border);
  border-top-color: var(--je-color-primary);
  border-radius: 50%;
  animation: je-spin .7s linear infinite;
}

@keyframes je-spin { to { transform: rotate(360deg); } }

/* ── Empty state ───────────────────────────────────────────── */
.je-empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--je-color-text-muted);
}
.je-empty-state__icon { font-size: 48px; margin-bottom: 16px; }
.je-empty-state h3    { color: var(--je-color-text); margin-bottom: 8px; }

/* ── Toast ─────────────────────────────────────────────────── */
.je-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--je-radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--je-shadow-lg);
  max-width: 360px;
  animation: je-toast-in .2s ease;
}
.je-toast--success { background: var(--je-color-success); color: #fff; }
.je-toast--error   { background: var(--je-color-error);   color: #fff; }
.je-toast--info    { background: var(--je-color-info);    color: #fff; }

@keyframes je-toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Modal ─────────────────────────────────────────────────── */
.je-modal {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
}
.je-modal[hidden] { display: none; }
.je-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.je-modal__box {
  position: relative;
  z-index: 1;
  background: var(--je-color-surface);
  border-radius: var(--je-radius-lg);
  box-shadow: var(--je-shadow-lg);
  width: 100%;
  max-width: 460px;
  margin: 16px;
  animation: je-modal-in .2s ease;
}
@keyframes je-modal-in {
  from { transform: translateY(-16px) scale(.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.je-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--je-color-border);
}
.je-modal__title { font-size: 16px; font-weight: 600; margin: 0; }
.je-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--je-color-text-muted);
  padding: 4px;
  line-height: 1;
  transition: color var(--je-transition);
}
.je-modal__close:hover { color: var(--je-color-text); }
.je-modal__body   { padding: 20px 24px; }
.je-modal__footer { padding: 16px 24px; border-top: 1px solid var(--je-color-border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Pagination ────────────────────────────────────────────── */
.je-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 20px 0;
}
.je-page-btn {
  padding: 6px 12px;
  border: 1px solid var(--je-color-border);
  border-radius: var(--je-radius-sm);
  background: var(--je-color-surface);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--je-transition);
}
.je-page-btn:hover       { background: var(--je-color-bg); }
.je-page-btn--active     { background: var(--je-color-primary); color: #fff; border-color: var(--je-color-primary); }
.je-page-btn:disabled    { opacity: .4; cursor: not-allowed; }

/* ── Utility ───────────────────────────────────────────────── */
.je-visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.je-text-muted { color: var(--je-color-text-muted); font-size: 13px; }
.je-link       { color: var(--je-color-primary); text-decoration: none; font-weight: 500; }
.je-link:hover { text-decoration: underline; }

/* ── Hide WP Admin Bar for employer-role users ─────────────── */
/* PHP show_admin_bar(false) is the primary mechanism; this CSS
   acts as a visual safety net in case any theme forces it back. */
body.je-hide-adminbar #wpadminbar,
body.je-hide-adminbar .admin-bar { display: none !important; }
body.je-hide-adminbar { margin-top: 0 !important; padding-top: 0 !important; }
