/* ----- Global backdrop (used by every page) ----- */
html, body { height: 100%; }

body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  color: #fff;

  /* Full-bleed hero background */
  background: #2c2c2c url('/frontend/background.jpg') no-repeat center center fixed;
  background-size: cover;
  min-height: 100vh;
}

/* ----- Page scaffold (matches login's .container) ----- */
.overlay {
  background-color: rgba(0, 0, 0, 0.6);
  min-height: 100svh;          /* better than 100vh on mobile UI chrome */
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Wider contractor pages */
.overlay.overlay-wide {
  max-width: 1400px;   /* bump width for jobs list */
}

/* Logo */
.logo { max-width: 150px; margin-bottom: 20px; }

/* Headings + subtitles */
h1 { font-size: 32px; margin: 10px 0; }
h2, .subtitle { font-size: 18px; font-weight: normal; margin-bottom: 20px; }

/* Descriptive copy (used on hero pages) */
.description { max-width: 600px; font-size: 17px; line-height: 1.6; margin-bottom: 30px; }

/* Auth button stack (used on login/worker pages) */
.auth-buttons {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.auth-buttons .button { width: 100%; }

/* ================================
   BUTTONS — Unified global style
   ================================ */
.button,
button,
input[type="submit"],
input[type="button"] {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease-in-out;
  text-decoration: none;
  display: inline-block;
  box-sizing: border-box;
}

/* Hover (invert) */
.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
a.button:hover {
  background: #fff;
  color: #000;
  border-color: #000;
}

/* Disabled */
.button:disabled,
button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled {
  background: #444;
  color: #aaa;
  border-color: #666;
  cursor: not-allowed;
}

/* Sizes */
.button-sm { padding: 4px 10px; font-size: 13px; }
.button    { padding: 8px 16px; font-size: 15px; } /* default */
.button-lg { padding: 12px 20px; font-size: 17px; }

/* Ensure anchor buttons look identical */
a.button,
a.button:link,
a.button:visited,
a.button:active {
  color: inherit;
  text-decoration: none;
}

/* Dark card/panel (forms, homepage cards) */
.content {
  background: rgba(0, 0, 0, 0.92);
  padding: 30px 40px;
  border-radius: 10px;
  max-width: 550px;
  width: 100%;
  margin: 20px auto 0;
  color: #fff;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Slim login card used on contractor/login when toggled */
.login-form {
  display: none;
  background: rgba(0, 0, 0, 0.85);
  padding: 18px;
  border-radius: 8px;
  margin: 12px auto 18px;
  width: 320px;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.18);
  box-sizing: border-box;
}

/* Optional wrapper inside content for alignment */
.form-wrapper { width: 100%; display: flex; flex-direction: column; align-items: stretch; }

/* Form elements */
input, textarea, select {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  box-sizing: border-box;
}
form { display: flex; flex-direction: column; width: 100%; }

/* Messages & notices for forms */
.error-message { color: #ff4d4d; font-size: 14px; margin-top: 8px; text-align: center; }

.notice {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 4px solid #ffd54f;
  background: rgba(255, 213, 79, 0.12);
  color: #ffd54f;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.3;
}

/* Hidden by default; shown by JS only after typing */
.warn { color: #ffd54f; display: none; margin-top: 6px; font-size: 0.95rem; }
.ok   { color: #32cd32; display: none; margin-top: 6px; }

/* Section blocks (used on info pages) */
.section { max-width: 800px; margin: 40px auto; }
.section h3 { font-size: 22px; margin-bottom: 15px; }
.steps { text-align: left; margin: 0 auto; max-width: 600px; font-size: 16px; line-height: 1.8; }
.steps li { margin-bottom: 10px; }

/* Homepage sections grid */
.sections {
  width: 100%;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 10px;
}
@media (min-width: 900px) {
  .sections { grid-template-columns: 1fr 1fr; }
}

/* Card tweaks for homepage */
.sections .content { text-align: left; min-height: 190px; }
.actions { margin-top: 14px; display: flex; justify-content: center; }
.actions .button { max-width: 320px; }

/* Footer */
.footer { margin-top: 40px; font-size: 14px; opacity: .8; }

/* Helpers */
.or-text { margin: 10px 0; font-weight: bold; color: #fff; }
.navbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 10px 0 30px; }
.navbar .button { width: auto; padding: 10px 20px; }
.recaptcha-row { margin-top: 10px; display: flex; justify-content: center; }

/* Wide document card (policies / terms) */
.content.policy {
  max-width: 900px;
  text-align: left;
}

/* Use dashboard.jpeg background on pages that add class="bg-dashboard" to <body> */
.bg-dashboard {
  background-image: url('/frontend/dashboard.jpeg');
}

/* Flashing effect (used for reference banner) */
@keyframes flash-text {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.2; }
}
.flash {
  animation: flash-text 1.2s infinite;
  color: #ffd54f;     /* keep the yellow emphasis */
  font-weight: 700;
}

/* Dashboard: compact content & two-column key/value layout to reduce scrolling */
.content.dashboard { max-width: 900px; text-align: left; }
.content.compact  { max-width: 900px; padding: 18px 22px; }

.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;   /* label, value */
  gap: 8px 16px;
}
@media (min-width: 900px) {
  .kv-grid { grid-template-columns: auto 1fr auto 1fr; } /* 2 pairs per row */
}
.k { opacity: 0.85; }
.v { font-weight: 600; }
.kv-warning { margin-top: 8px; }

/* Action bar: keep buttons same size and try to fit one row on larger screens */
.actions.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.actions.bar .button {
  flex: 1 1 200px;
  max-width: 240px;
}

/* Make the HTML [hidden] attribute actually hide things,
   even on elements that also have .content (display:flex) etc. */
[hidden] {
  display: none !important;
}

/* ===== Documents page ===== */
.content-box { max-width: 1000px; margin: 0 auto; }

.docs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-bottom: 30px;
}

.document-card {
  width: 180px;
  min-height: 290px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

.document-card img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 5px;
}

.pdf-icon { width: 60px; }

.upload-form { margin-top: 30px; }
.upload-form input,
.upload-form select { width: 100%; margin-bottom: 10px; }

.button-group { text-align: center; }

/* Upload/result messages */
.message {
  text-align: center;
  margin-top: 10px;
  font-weight: bold;
  padding: 8px;
  border-radius: 4px;
}
.message.error {
  color: #ff4d4d;
  background-color: rgba(255, 0, 0, 0.1);
}
.message.success {
  color: #32cd32;
  background-color: rgba(0, 255, 0, 0.1);
}

/* Informational card at top of the page */
.info-card {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  color: #fff;
  text-align: left;
}
.info-card h3 { margin-top: 0; }
.info-list { line-height: 1.6; padding-left: 20px; }
.info-note { font-style: italic; margin-top: 10px; }

/* ===== Jobs & tables ===== */
.actions.bar { display: flex; gap: 8px; flex-wrap: wrap; }

.content.compact { padding-top: 14px; padding-bottom: 14px; }

/* Give key columns more breathing room */
.table-tight td.col-title { min-width: 200px; }
.table-tight td.col-postedby { min-width: 160px; }

/* Optional utilities if not already present */
.muted { opacity: 0.85; }
.small-note { font-size: 0.9rem; }

/* Black panel that wraps the table and clips contents */
.table-card { 
  border-radius: 18px;
  max-width: 100%;   /* instead of 95% */
  margin: 0 auto;
  overflow-x: auto;  /* allows horizontal scroll if still too tight */
}

/* Tight, readable table */
.table-tight { 
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  table-layout: fixed;    /* predictable column widths */
}

.table-tight th,
.table-tight td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  text-align: left;
  vertical-align: middle;
  font-size: 0.95rem;
  white-space: normal;   /* ✅ let long names wrap instead of cut */
}

/* White header row with black text */
.table-tight thead th { 
  background: #fff;
  color: #000;
  font-weight: 600;
  white-space: normal;   /* allow header text to wrap */
}

/* Utilities */
.nowrap { white-space: nowrap; }
.button-sm { padding: 2px 6px; font-size: 0.8rem; margin: 0 2px; }

/* === Dashboard: Job Alerts cards === */
#jobAlertsGrid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:12px;
  margin-top:8px;
}
.job-card{
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:12px;
  padding:12px 14px;
}
.job-card h4{
  margin:0 0 6px 0;
  font-size:1.05rem;
}
.job-meta{
  font-size:0.95rem;
  line-height:1.4;
}
.tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:6px;
}

/* (Optional) if you don't already have .muted or .pill styles, uncomment and tweak:
.muted{opacity:.8}
.pill{display:inline-block;padding:2px 8px;border-radius:999px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.18);font-size:.85em}
*/

/* === Dashboard: Job Details Modal === */
#jobModal[hidden]{ display:none; }

#jobModal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#jobModalBackdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}

#jobModalCard{
  position: relative;
  max-width: 680px;
  width: min(92vw, 680px);
  background: rgba(255,255,255,0.06);           /* matches your card vibe */
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
}

#jobModalCard h3{
  margin: 0 0 8px 0;
}

#jobModalBody{
  font-size: 0.95rem;
  line-height: 1.5;
}

#jobModalBody .job-meta{
  margin: 4px 0;
}

#jobModalCard hr{
  border: none;
  border-top: 1px solid rgba(255,255,255,0.15);
  margin: 10px 0;
}

#jobModalClose{
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
#jobModalClose:hover{ opacity: 1; }

/* === Dashboard: Job Alerts card hover/focus === */
.job-card--clickable{
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .06s ease;
}

.job-card--clickable:hover,
.job-card--clickable:focus-visible{
  background: #fff;
  color: #000;
  border-color: rgba(0,0,0,0.2);
  outline: none; /* we’ll provide our own focus ring below */
}

/* Keep pills readable when the card inverts */
.job-card--clickable:hover .pill,
.job-card--clickable:focus-visible .pill{
  background: rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.25);
  color: #000;
}

/* Keyboard focus ring for accessibility */
.job-card--clickable:focus-visible{
  box-shadow: 0 0 0 3px rgba(21,115,255,.35);
}

/* Optional: tiny press feedback */
.job-card--clickable:active{
  transform: translateY(1px);
}

/* === Modal: make content scroll inside the card === */
#jobModalCard{
  max-height: 85vh;         /* cap overall height */
  display: flex;            /* stack title + body */
  flex-direction: column;
}

#jobModalBody{
  overflow: auto;           /* scroll here, not page */
  flex: 1 1 auto;           /* take remaining space */
  max-height: 100%;
  overscroll-behavior: contain; /* prevents scroll chaining on some browsers */
}

/* Lock background scroll when a modal is open */
html.modal-open,
body.modal-open{
  overflow: hidden;
}


/* Ensure modal content itself scrolls */
#jobModal{
  overscroll-behavior: contain; /* stop scroll chaining on some browsers */
}

#jobModalCard{
  max-height: 88vh;            /* keep card within viewport */
  display: flex;
  flex-direction: column;
}

#jobModalBody{
  flex: 1 1 auto;
  overflow-y: auto;            /* scroll here */
  max-height: 70vh;            /* explicit scrollable area */
  -webkit-overflow-scrolling: touch; /* smooth inertial scroll on iOS */
}

/* === Contractor: Applicants Modal === */
#applicantsModal[hidden]{ display:none; }

#applicantsModal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#applicantsModalBackdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}

#applicantsModalCard{
  position: relative;
  max-width: 820px;
  width: min(94vw, 820px);
  max-height: 88vh;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
}

#applicantsModalCard h3{ margin: 0 0 8px 0; }
#applicantsModalBody{ overflow: auto; flex: 1 1 auto; }
#applicantsModalCard hr{
  border: none; border-top: 1px solid rgba(255,255,255,0.15); margin: 10px 0;
}

#applicantsModalClose{
  position: absolute; top: 8px; right: 8px;
  border: none; background: transparent; color: inherit;
  font-size: 22px; line-height: 1; cursor: pointer; opacity: .85;
}
#applicantsModalClose:hover{ opacity: 1; }

