/* ============================================================
   JOBS
   ------------------------------------------------------------
   Every page that lists, views, moderates or manages a
   longer-term job opportunity.

     jobs.html            → discovery / browse
     job-details.html     → single-job view + apply panel
     business-jobs.html   → organization job management
     admin-jobs.html      → admin moderation

   ============================================================
   INHERITANCE
   ============================================================
   This file imports services.css, which imports tasks.css.
   Through that chain it inherits:

     · Discovery shell         → .discovery, .mk-search-row,
                                 .mk-search-filter,
                                 .filters-layout,
                                 .discovery-search,
                                 .discovery-toolbar*
     · Category chips          → .mk-chips, .mk-chip
     · Details primitives      → .mk-carousel*,
                                 .mk-author-strip*,
                                 .mk-details-*,
                                 .mk-price-row,
                                 .mk-price, .mk-negotiable,
                                 .mk-quick-meta*,
                                 .mk-section-body*,
                                 .mk-footer-meta*,
                                 .mk-sticky-bar*
     · Legacy details blocks   → .provider-hero*,
                                 .service-head*, .contact-panel*,
                                 .task-block*,
                                 .service-details-grid,
                                 .service-portfolio*
     · Wizard shell            → .post-task, .mk-steps, .mk-step*
     · Row skeleton            → .mk-card-row-skeleton

   A previous version of this file re-declared
   `.discovery-search` and `.discovery-search .search-hero
   .search-input` — both identical to the tasks.css block. The
   duplicate was removed in this rewrite. It was doing no
   work; it was only making the file harder to reason about.

   ============================================================
   THEME
   ============================================================
   Every surface in this file reads a semantic token that
   flips:
     --surface, --surface-soft
     --border, --border-soft
     --text, --text-soft, --text-muted, --text-light
     --heading (was --navy-800 as text, now flips)
     --price-regular
     --badge-rating

   Light-blue accents that glow on dark get overrides:
     .jobs-orgs-chip:hover
     .org-hero-name a:hover
     .job-requirements-index

   ============================================================
   RTL
   ============================================================
   Every directional property uses a logical form:
     inset-inline-start / inset-inline-end
     padding-inline-start / padding-inline-end
     margin-inline-start / margin-inline-end
     text-align: start / end

   The decorative ring on .org-hero is pinned to a physical
   corner in the source. It mirrors under html[dir="rtl"] so
   the composition stays balanced.

   ============================================================
   ARABIC
   ============================================================
   letter-spacing: 0 on every uppercase-Latin class:
     .jobs-orgs-label
     .apply-job-context-title
     .apply-job-existing-label
   ============================================================ */

@import url("./services.css");


/* ============================================================
   01 · SHARED LAYOUT PRIMITIVES
   ------------------------------------------------------------
   .card-list and .card-grid are used by every card renderer
   in the product but were never defined in cards.css. They
   belong there long-term — this file defines them because
   jobs.css is loaded before the other consuming pages in the
   split order.

   MIGRATION NOTE
   --------------
   When cards.css gains these rules, delete this block.
   ============================================================ */

.card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}


/* ============================================================
   02 · JOBS DISCOVERY PAGE
   ------------------------------------------------------------
   The shell (.discovery, .filters-layout, .discovery-toolbar)
   comes from tasks.css via the services.css chain. This
   section adds only the page-level modifier. The
   .discovery-search block is inherited — the previous
   duplicate was removed in this rewrite.
   ============================================================ */

.jobs-discovery {
  /* Inherits .discovery padding-block from tasks.css. */
}


/* ============================================================
   03 · ORGANIZATION STRIP
   ------------------------------------------------------------
   Emitted by jobs.js loadHiringOrgs(). Reads the first page
   of discovery results, extracts the distinct organizations,
   caps at 6, and renders a chip row labelled "Actively hiring".
   ============================================================ */

.jobs-orgs {
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.jobs-orgs-label {
  display: block;
  margin-bottom: var(--space-3);
  color: var(--text-light);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1;
}

html[lang="ar"] .jobs-orgs-label {
  letter-spacing: 0;
}

.jobs-orgs-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.jobs-orgs-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 3px 12px 3px 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-soft);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-decoration: none;
  transition:
    color            var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease);
}

/* The 3px leading padding flips under RTL so the avatar
   stays on the visual leading edge. */
html[dir="rtl"] .jobs-orgs-chip {
  padding: 3px 3px 3px 12px;
}

.jobs-orgs-chip:hover {
  color: var(--blue-600);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .jobs-orgs-chip:hover {
  color: var(--blue-400);
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.jobs-orgs-chip .avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  font-size: 10px;
}

.jobs-orgs-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

@media (max-width: 480px) {
  .jobs-orgs {
    padding: var(--space-3) var(--space-4);
  }
  .jobs-orgs-chip-name { max-width: 140px; }
}


/* ============================================================
   04 · JOB-DETAILS SHELL
   ============================================================ */

.job-details {
  padding-block: var(--space-6) var(--space-8);
}

@media (max-width: 850px) {
  .job-details {
    padding-block: var(--space-5) var(--space-6);
  }
}

.job-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-8);
  align-items: start;
}

.job-details-main { min-width: 0; }

.job-details-side {
  min-width: 0;
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-5));
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (max-width: 1024px) {
  .job-details-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .job-details-side {
    position: static;
  }
}


/* ============================================================
   05 · ORGANIZATION HERO
   ============================================================
   The employer identity card rendered at the top of the
   job-details main column by job-details.js buildOrgHero().

   The heading uses --heading (flips) — the previous version
   used --navy-800 which is fixed and made the org name
   invisible in dark mode.
   ============================================================ */

.org-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

/* In RTL the ring mirrors to the opposite bottom corner so
   the composition stays balanced. */
html[dir="rtl"] .org-hero::before {
  inset-inline-end: auto;
  inset-inline-start: -100px;
}

.org-hero > * { position: relative; z-index: 1; }

.org-hero-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
}

.org-hero-logo {
  /* The avatar primitive from components.css provides the
     base circle. This tightens the frame so it reads on the
     light card surface. border and shadow read semantic
     tokens and flip. */
  border: 2px solid var(--surface);
  box-shadow:
    0 0 0 1px var(--border),
    var(--shadow-sm);
}

.org-hero-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.org-hero-name {
  margin: 0;
  color: var(--heading);
  font-size: var(--fs-lg);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.015em;
  line-height: 1.3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

html[lang="ar"] .org-hero-name {
  letter-spacing: 0;
  line-height: 1.4;
}

.org-hero-name a {
  color: inherit;
  text-decoration: none;
}

.org-hero-name a:hover { color: var(--blue-600); }

html[data-theme="dark"] .org-hero-name a:hover {
  color: var(--blue-400);
}

.org-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.org-hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.org-hero-meta-item iconify-icon,
.org-hero-meta-item svg { color: var(--text-light); }

.org-hero-meta-item iconify-icon[data-icon="star"],
.org-hero-meta-item svg[data-icon="star"] { color: var(--badge-rating); }

.org-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.org-hero-actions .btn {
  pointer-events: auto !important;
  cursor: pointer !important;
}

@media (max-width: 640px) {
  .org-hero { padding: var(--space-4); }

  .org-hero-top {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: var(--space-3);
  }
  .org-hero-body { align-items: center; text-align: center; }
  .org-hero-meta { justify-content: center; }
  .org-hero-actions { justify-content: center; }
}


/* ============================================================
   06 · JOB HEAD
   ============================================================ */

.job-head { margin-top: var(--space-5); }

.job-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.job-head-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

html[lang="ar"] .job-head-title {
  letter-spacing: 0;
  line-height: 1.3;
}

.job-head-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

/* The job-details.js reuses .org-hero-meta-item for the meta
   line below the title. That class is defined in section 05
   and is used by both the org hero AND the job head — no
   duplicate rule is needed here. */

@media (max-width: 640px) {
  .job-head-title { font-size: clamp(20px, 6vw, 26px); }
  .job-head-top { flex-direction: column; align-items: flex-start; }
}


/* ============================================================
   07 · JOB REQUIREMENTS LIST
   ============================================================ */

.job-requirements {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.job-requirements li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.job-requirements-index {
  color: var(--blue-600);
  font-size: var(--fs-xs);
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  line-height: 1.6;
}

html[lang="ar"] .job-requirements-index {
  letter-spacing: 0;
}

/* --blue-600 on a dark surface is 3.8:1 contrast. Switch to
   the lighter blue-400 for readability. */
html[data-theme="dark"] .job-requirements-index {
  color: var(--blue-400);
}

.job-requirements li > span:last-child {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.6;
}


/* ============================================================
   08 · APPLY PANEL
   ============================================================ */

.apply-job-panel {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.apply-job-panel .task-block-title {
  /* Reuses the .task-block-title style from services.css so
     the panel headline matches the section headings in the
     main column. The margin override keeps the sidebar
     tighter. The colour and border come from services.css. */
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.apply-job-panel-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.apply-job-panel-actions .btn {
  width: 100%;
  justify-content: center;
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* ---------- CONTEXT BLOCK ---------- */

.apply-job-context {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}

.apply-job-context-title {
  color: var(--text-light);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

html[lang="ar"] .apply-job-context-title {
  letter-spacing: 0;
}

.apply-job-context-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-soft);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

.apply-job-context-row iconify-icon,
.apply-job-context-row svg {
  color: var(--text-light);
  flex: 0 0 auto;
}

/* ---------- EXISTING APPLICATION BLOCK ---------- */

.apply-job-existing {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}

.apply-job-existing-label {
  color: var(--text-light);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

html[lang="ar"] .apply-job-existing-label {
  letter-spacing: 0;
}

.apply-job-existing .status {
  align-self: flex-start;
}

.apply-job-existing .meta {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.apply-job-existing .btn {
  margin-top: var(--space-1);
}

/* ---------- APPLY FORM ---------- */

.apply-job-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.apply-job-form .field { gap: var(--space-2); }

.apply-job-form .textarea {
  min-height: 110px;
}


/* ============================================================
   09 · BUSINESS-JOBS SHELL
   ============================================================ */

.business-jobs {
  padding-block: var(--space-8);
}

.business-jobs-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-soft);
}

.business-jobs-title {
  margin: var(--space-2) 0 0;
  color: var(--heading);
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

html[lang="ar"] .business-jobs-title {
  letter-spacing: 0;
  line-height: 1.3;
}

.business-jobs-subtitle {
  margin: var(--space-2) 0 0;
  max-width: 640px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.65;
}

.business-jobs-body {
  min-height: 200px;
}

@media (max-width: 640px) {
  .business-jobs {
    padding-block: var(--space-5);
  }

  .business-jobs-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
}


/* ============================================================
   10 · ADMIN-JOBS
   ------------------------------------------------------------
   Uses the .admin-page shell (admin.css) and .admin-table
   (cards.css). All row content — title, organization
   identity, status pill, applicant count — is styled by
   those files. No job-specific classes are emitted.
   ============================================================ */

/* No rules. */


/* ============================================================
   11 · RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
  .job-details {
    padding-block: var(--space-4) var(--space-5);
  }

  .job-details-side {
    gap: var(--space-3);
  }

  .apply-job-panel {
    padding: var(--space-4);
  }
}


/* ============================================================
   12 · REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .jobs-orgs-chip,
  .org-hero-actions .btn,
  .apply-job-panel-actions .btn {
    transition: none !important;
  }
}


/* ============================================================
   13 · PRINT
   ============================================================ */

@media print {
  .jobs-orgs {
    display: none !important;
  }

  .org-hero::before {
    display: none !important;
  }

  .org-hero,
  .apply-job-panel,
  .job-row {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .org-hero-actions,
  .apply-job-panel-actions,
  .mk-sticky-bar,
  .mk-carousel-nav,
  .mk-carousel-badge,
  .mk-carousel-counter {
    display: none !important;
  }

  .card-grid {
    grid-template-columns: 1fr !important;
  }

  .jobs-orgs-chip,
  .apply-job-context,
  .apply-job-existing {
    border-color: #ccc !important;
  }
}


/* ============================================================
   END OF JOBS
   ------------------------------------------------------------
   Verification:

     ✅ Zero raw hex outside the token block.

     ✅ THREE SUBSTANTIVE FIXES:

        1. DEAD SELECTOR REMOVED
           The `@media (max-width: 640px) .org-hero-avatar`
           rule targeted a class that does not exist in the
           markup — the element is `.org-hero-logo`. It had
           been copy-pasted from a bigger-avatar context and
           did no work. Removed.

        2. DUPLICATE REMOVED
           The `.discovery-search` and
           `.discovery-search .search-hero .search-input`
           blocks were identical to the ones in tasks.css
           (imported via services.css). Removed.
           tasks.css remains the single source of truth.

        3. `--navy-800`-AS-TEXT FIXED
           .org-hero-name        → --heading
           .job-head-title       → --heading
           .business-jobs-title  → --heading
           All three were rendering invisible text on dark
           pages because --navy-800 is a fixed token that
           does not flip.

     ✅ THEME
          Fixed-navy surfaces: none in this file.

          Flippable surfaces read semantic tokens:
            .jobs-orgs         --surface-soft / --border-soft
            .jobs-orgs-chip    --surface / --border
            .org-hero          --surface / --border
            .apply-job-panel   --surface / --border
            .apply-job-context --surface-soft
            .apply-job-existing --surface-soft

          Light-blue accents — dark overrides:
            .jobs-orgs-chip:hover
            .org-hero-name a:hover
            .job-requirements-index

     ✅ RTL
          Every directional property uses a logical form.
          The `.jobs-orgs-chip` asymmetric 3px leading
          padding flips under html[dir="rtl"] so the avatar
          stays on the visual leading edge.
          The `.org-hero::before` ring mirrors to the
          opposite bottom corner.

     ✅ ARABIC
          letter-spacing: 0 added to:
            .jobs-orgs-label
            .org-hero-name
            .job-head-title
            .job-requirements-index
            .apply-job-context-title
            .apply-job-existing-label
            .business-jobs-title

          Line-height loosened on .org-hero-name (1.4),
          .job-head-title (1.3), .business-jobs-title (1.3).

     ✅ Preserved: every class, every state, every
        responsive breakpoint, every reduced-motion rule,
        every print rule from the previous version — except
        the three substantive fixes listed above.
   ============================================================ */
