/* /includes/jobsite.css
   ------------------------------------------------------------
   JobSite Design System
   - Clean, welcoming, readable UI
   - Works across public + dashboard pages
   - Stable header styles via .site-* namespace
   ------------------------------------------------------------ */

/* ===== Base ===== */
:root{
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #111111;
  --muted: #5b5f6a;
  --border: #eeeeee;

  --primary: #111111;
  --primary-2: #2b2b2b;

  --radius: 16px;
  --radius-sm: 12px;

  --shadow: 0 8px 30px rgba(18,19,22,0.06);
  --shadow-sm: 0 4px 16px rgba(18,19,22,0.06);

  --focus: 0 0 0 4px rgba(17,17,17,0.12);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }

body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

/* Links */
a{ color: inherit; }
a:hover{ opacity: 0.92; }

/* Text helpers */
.muted{ color: var(--muted); }
.small{ font-size: .92rem; }
.t-center{ text-align:center; }

.mt-0{ margin-top:0; }
.mb-0{ margin-bottom:0; }
.mt-8{ margin-top:8px; }
.mt-12{ margin-top:12px; }
.mt-16{ margin-top:16px; }
.mt-20{ margin-top:20px; }
.mt-24{ margin-top:24px; }

/* Headings */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; }
h1{ font-size: 2rem; margin:0 0 10px; }
h2{ font-size: 1.3rem; margin:0 0 10px; }
h3{ font-size: 1.08rem; margin:0 0 8px; }


/* ------------------------------------------------------------
   SURFACES / CARDS
   ------------------------------------------------------------ */
.card, .panel, .surface{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card{ padding: 16px; }     /* match dashboard feel */
.panel{ padding: 18px; }
.surface{ padding: 16px; }

.section{ margin-top: 18px; }

/* Layout helpers */
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ✅ Single source of truth for cards grid spacing */
.cards{
  display:grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 12px;
}
/* ------------------------------------------------------------
   SITE MAIN (generic container)
   - Use this if a page needs a centered content wrapper.
   - Does NOT affect your header.php unless you add class="site-main".
   ------------------------------------------------------------ */
.site-main{
  width: 80%;
  max-width: 1100px;   /* match header/footer container width */
  margin: 0 auto;
  padding: 18px;
}

@media (max-width: 900px){
  .site-main{
    max-width: 100%;
    padding: 16px;
  }
}

/* ------------------------------------------------------------
   DEFAULT PAGE WRAPS + CARD LAYOUTS
   ------------------------------------------------------------ */
.wrap{
  max-width: 1100px;
  margin: 0 auto;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap: 12px;
  margin-bottom: 18px;
}

/* Dashboard 2-column cards layout (2fr/1fr) */
.cards-2col{
  grid-template-columns: 2fr 1fr;
}

@media (max-width: 900px){
  .cards-2col{
    grid-template-columns: 1fr;
  }
}

/* Right column stack of cards */
.stack-16{
  display:flex;
  flex-direction:column;
  gap: 16px;
}

/* Remove need for inline style="margin-top:0;" on headings */
.h0{ margin-top: 0; }

/* List reset utility for clean lists */
.list-reset{
  list-style:none;
  padding:0;
  margin:0;
}

/* Divider list items (good for message previews) */
.list-divider > li{
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.list-divider > li:last-child{
  border-bottom: 0;
}

/* A simple two-side row inside list items */
.split{
  display:flex;
  justify-content:space-between;
  gap: 12px;
  align-items:flex-start;
}
.nowrap{ white-space: nowrap; }

/* ------------------------------------------------------------
   HERO (homepage)
   ------------------------------------------------------------ */
.hero{
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 22px;
}

.hero .muted{ margin-top: 4px; }

/* ------------------------------------------------------------
   FORMS
   ------------------------------------------------------------ */
form{ margin:0; }
label{ font-size: .92rem; color: var(--muted); }

input, select, textarea{
  width:100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  font: inherit;
}

textarea{ min-height: 110px; resize: vertical; }

input:focus, select:focus, textarea:focus{
  box-shadow: var(--focus);
  border-color: #cfcfcf;
}

.help{
  font-size: .9rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Search form layout */
.search{
  display:grid;
  grid-template-columns: 1.6fr 1fr 1fr auto;
  gap: 10px;
  margin-top: 14px;
}
@media (max-width: 900px){
  .search{ grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   PAGE BUTTONS (NOT header buttons)
   ------------------------------------------------------------ */
.btn, button.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration:none;
  cursor:pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  transition: transform .04s ease, box-shadow .15s ease, background .15s ease;
  font-weight: 600;
}

.btn:hover{
  background: #f7f7f7;
  box-shadow: var(--shadow-sm);
}
.btn:active{ transform: translateY(1px); }

.btn-primary, button.btn-primary{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover{ background: var(--primary-2); }

.btn-ghost, button.btn-ghost{
  background: transparent;
  box-shadow:none;
}

/* Pills / chips */
.pill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fbfbfb;
  color: #2d2f36;
  font-size: .86rem;
}

/* Meta row beneath job title */
.meta{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items:center;
  color: var(--muted);
  font-size: .94rem;
}
/* ------------------------------------------------------------
   BADGES (used on jobs list/cards)
   ------------------------------------------------------------ */
.badges{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge{
  display:inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .85rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

/* Featured: slightly stronger border */
.badge-featured{
  border-color: #111;
}

/* External apply: dashed border to visually distinguish */
.badge-external{
  border-style: dashed;
}

/* Title link helper */
.link-title{
  text-decoration:none;
  color: inherit;
}
.link-title:hover{ text-decoration: underline; }
/* Make search buttons match input height + look consistent */
.search button{
  height: 44px;                 /* aligns with input height */
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.search button:hover{
  background: var(--primary-2);
  border-color: var(--primary-2);
}

.search button:active{
  transform: translateY(1px);
}

/* Mobile: make button full width, same as inputs */
@media (max-width: 900px){
  .search button{
    width: 100%;
  }
}

/* ------------------------------------------------------------
   ALERTS
   ------------------------------------------------------------ */
.alert-warn{
  background: #fff7e8;
  border: 1px solid #ffd69a;
  color: #5c3b00;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

/* Generic warn block (matches your external apply vibe) */
.warn{
  background:#fff9e6;
  border:1px solid #ffe3a3;
  padding:12px;
  border-radius:12px;
}

/* ------------------------------------------------------------
   PAGINATION
   ------------------------------------------------------------ */
.pagination{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pagination a,
.pagination .current{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  text-decoration:none;
}

.pagination .current{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ------------------------------------------------------------
   JOB DETAIL LAYOUT (centered main + 20% sticky rail)
   ------------------------------------------------------------ */
.job-layout{
  display:grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 20%);
  gap: 16px;
  align-items:start;
}

/* Make the description feel centered + readable */
.job-main{
  max-width: 820px;        /* centers content column feel */
}

/* Sticky rail that fits viewport and scrolls internally */
.job-rail{
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  display:flex;
  flex-direction:column;
  gap: 16px;
  padding-right: 2px; /* prevents scrollbar overlay feel */
}

/* Rail cards: slightly tighter */
.job-rail .card{
  padding: 14px;
}

/* Mobile: stack */
@media (max-width: 900px){
  .job-layout{
    grid-template-columns: 1fr;
  }
  .job-main{
    max-width: 100%;
  }
  .job-rail{
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* Job description typography */
.job-desc{
  margin-top: 14px;
  line-height: 1.55;
}
.job-desc p{ margin: 0 0 12px; }

/* ------------------------------------------------------------
   ADS (rendered via ads_render)
   ------------------------------------------------------------ */
.ad-card{
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.ad-label{
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* Give embedded ad code room */
.ad-slot{
  display:block;
  min-height: 90px; /* helps prevent layout jump */
}

/* ------------------------------------------------------------
   MESSAGING HELPERS
   ------------------------------------------------------------ */
.chat-layout{
  display:grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 14px;
  align-items:start;
}
@media (max-width: 900px){
  .chat-layout{ grid-template-columns: 1fr; }
}

.thread{
  display:flex;
  flex-direction:column;
  gap: 10px;
  max-height: 62vh;
  overflow:auto;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fbfbfb;
}

.msg{
  background:#fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}

.msg.mine{
  border-color: rgba(17,17,17,0.35);
}

.msg .meta{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  flex-wrap:wrap;
  font-size:.86rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.msg .body{ white-space: pre-wrap; }

.errors{
  background:#fff0f0;
  border:1px solid #ffb3b3;
  padding:12px 14px;
  border-radius: 12px;
}

/* Sticky side panel */
.chat-side{ position: sticky; top: 14px; }
@media (max-width: 900px){
  .chat-side{ position: static; }
}

.kv{ list-style:none; padding:0; margin:0; }
.kv li{
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.kv li:first-child{ border-top: 0; }

/* ------------------------------------------------------------
   TABLES (applicant dashboard)
   ------------------------------------------------------------ */
table{ width:100%; border-collapse: collapse; }
th, td{
  text-align:left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th{ font-size: .9rem; color:#333; }
