*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --bg:        #f8fafc;
  --card:      #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
  --tag:       #eff6ff;
  --tag-text:  #2563eb;
  --radius:    12px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }

/* NAVBAR */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.5rem; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 1.4rem; font-weight: 700; text-decoration: none; color: var(--text); flex-shrink: 0; }
.logo span { color: var(--primary); }
.nav-links {
  display: flex; align-items: center; gap: 1rem;
  overflow: hidden; /* prevent overflow on mobile */
}
.nav-links a { text-decoration: none; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav-links a.active { color: var(--primary); }
#navUser {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lang-btn {
  background: var(--tag); color: var(--tag-text); border: none;
  padding: .4rem .9rem; border-radius: 20px; cursor: pointer; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
  font-family: 'Tajawal', 'Inter', Arial, sans-serif;
  min-width: 56px; text-align: center;
  font-size: .95rem; letter-spacing: 0;
}

/* Save alert button — white on blue hero */
#saveAlertBtn {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.8);
  color: #fff;
  backdrop-filter: blur(4px);
}
#saveAlertBtn:hover {
  background: rgba(255,255,255,0.25);
}
#saveAlertMsg { color: #fff; }

/* Mobile navbar */
@media (max-width: 600px) {
  .navbar { padding: .75rem 1rem; }
  .nav-links { gap: .6rem; }
  .nav-links a[href*="jobs"]:not(#navDash) { display: none; } /* hide Jobs link on mobile — logo already links home */
  #navUser { max-width: 80px; font-size: .8rem; }
  .lang-btn { padding: .3rem .6rem; font-size: .82rem; }
  .apply-btn { font-size: .82rem; padding: .35rem .7rem; }
}

/* SEARCH HERO */
.search-hero {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  padding: 2.5rem 2rem; text-align: center; color: #fff;
}
.hero-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 1.2rem; }

.search-bar {
  display: flex; gap: .5rem; max-width: 780px; margin: 0 auto 1rem;
  background: #fff; border-radius: var(--radius); padding: .4rem;
}
.search-bar input {
  flex: 1; border: none; outline: none; padding: .6rem .8rem;
  font-size: .95rem; color: var(--text); background: transparent;
}
.search-bar button {
  background: var(--primary); color: #fff; border: none;
  padding: .6rem 1.4rem; border-radius: 8px; cursor: pointer;
  font-weight: 600; white-space: nowrap;
}
.search-bar button:hover { background: var(--primary-h); }

/* FILTERS */
.filters {
  display: flex; gap: 1rem; justify-content: center;
  flex-wrap: wrap; align-items: center;
}
.filters select {
  padding: .45rem .9rem; border-radius: 8px; border: 1px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.15); color: #fff; font-size: .9rem; cursor: pointer;
}
.filters select option { color: var(--text); background: #fff; }
.remote-toggle { color: #fff; font-size: .9rem; display: flex; align-items: center; gap: .4rem; cursor: pointer; }

/* RESULTS */
.results-section { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }
.results-meta { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }

.jobs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.2rem; }

/* JOB CARD */
.job-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; transition: box-shadow .2s, transform .2s; cursor: pointer;
}
.job-card:hover { box-shadow: 0 4px 20px rgba(37,99,235,.1); transform: translateY(-2px); }

.card-header { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.employer-logo {
  width: 44px; height: 44px; border-radius: 8px; object-fit: contain;
  border: 1px solid var(--border); padding: 2px; background: #fff;
}
.employer-logo-placeholder {
  width: 44px; height: 44px; border-radius: 8px; background: var(--tag);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--primary); font-size: 1rem; flex-shrink: 0;
}
.card-titles { flex: 1; min-width: 0; }
.job-title {
  font-weight: 600; font-size: .95rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.employer-name { font-size: .85rem; color: var(--muted); margin-top: .15rem; }

.card-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.tag {
  background: var(--tag); color: var(--tag-text); font-size: .78rem;
  padding: .2rem .6rem; border-radius: 20px; font-weight: 500;
}
.tag.green  { background: #f0fdf4; color: #16a34a; }
.tag.orange { background: #fff7ed; color: #ea580c; }
.tag.gray   { background: #f1f5f9; color: var(--muted); }

.job-location { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.job-location span { margin-right: .3rem; }

.card-footer { display: flex; align-items: center; justify-content: space-between; }
.salary { font-weight: 600; color: #16a34a; font-size: .9rem; }
.apply-btn {
  background: var(--primary); color: #fff; text-decoration: none;
  padding: .4rem 1rem; border-radius: 8px; font-size: .85rem; font-weight: 600;
}
.apply-btn:hover { background: var(--primary-h); }

/* Free Trial / Free Access button in navbar */
.nav-links .apply-btn {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  font-weight: 700;
}
.nav-links .apply-btn:hover {
  background: var(--primary);
  color: #fff;
}



/* PAGINATION */
.pagination { display: flex; gap: .5rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.page-btn {
  padding: .5rem 1rem; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: .9rem;
}
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover:not(.active) { background: var(--tag); }

/* STATES */
.loading, .error-msg, .no-results {
  grid-column: 1/-1; text-align: center; padding: 3rem; color: var(--muted); font-size: 1.1rem;
}
.error-msg { color: #dc2626; }

/* FOOTER */
.footer { text-align: center; padding: 2rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); margin-top: 3rem; }
.footer a { color: var(--primary); text-decoration: none; }

/* RESPONSIVE */
@media (max-width: 600px) {
  .search-bar { flex-direction: column; }
  .search-bar button { width: 100%; }
  .hero-title { font-size: 1.3rem; }
  .navbar { padding: 1rem; }
}
/* ── HOMEPAGE HERO ─────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  color: #fff;
}
.hero-content { max-width: 780px; margin: 0 auto; }

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: .35rem 1rem;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 1.2rem;
}
.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: .8rem;
}
.hero-sub {
  font-size: 1.05rem;
  opacity: .88;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* HERO SEARCH BOX */
.hero-search { margin-bottom: 1.2rem; }
.search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 50px;
  padding: .35rem .35rem .35rem 0;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  max-width: 740px;
  margin: 0 auto;
}
.search-field {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 0 1rem;
  gap: .5rem;
  min-width: 0;
}
.search-icon { font-size: 1.1rem; flex-shrink: 0; }
.search-field input {
  border: none;
  outline: none;
  font-size: .95rem;
  color: var(--text);
  width: 100%;
  background: transparent;
  padding: .5rem 0;
}
.search-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}
.hero-search-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 40px;
  padding: .7rem 1.8rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.hero-search-btn:hover { background: var(--primary-h); }

/* POPULAR TAGS */
.popular-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
}
.popular-label { font-size: .85rem; opacity: .8; }
.pop-tag {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  text-decoration: none;
  padding: .3rem .8rem;
  border-radius: 20px;
  font-size: .82rem;
  transition: background .2s;
}
.pop-tag:hover { background: rgba(255,255,255,.3); }

/* ── STATS BAR ─────────────────────────────────── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .5rem 2.5rem;
}
.stat strong { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.stat span   { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* ── CATEGORIES ────────────────────────────────── */
.categories-section {
  max-width: 1100px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.cat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: block;
}
.cat-card:hover {
  box-shadow: 0 4px 20px rgba(37,99,235,.1);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.cat-icon  { font-size: 1.8rem; margin-bottom: .6rem; }
.cat-name  { font-weight: 600; font-size: .95rem; margin-bottom: .25rem; }
.cat-count { font-size: .78rem; color: var(--muted); }

/* ── WHY SECTION ───────────────────────────────── */
.why-section {
  background: #f1f5f9;
  padding: 3rem 1.5rem;
}
.why-section .section-title { text-align: center; }
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
  max-width: 1000px;
  margin: 0 auto;
}
.why-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.why-icon  { font-size: 2rem; margin-bottom: .8rem; }
.why-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.why-card p  { font-size: .88rem; color: var(--muted); line-height: 1.6; }

/* ── CTA SECTION ───────────────────────────────── */
.cta-section {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  text-align: center;
  padding: 3.5rem 1.5rem;
}
.cta-section h2 { font-size: 1.7rem; font-weight: 700; margin-bottom: .6rem; }
.cta-section p  { opacity: .88; margin-bottom: 1.5rem; font-size: 1rem; }
.cta-btn {
  display: inline-block;
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  padding: .8rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-size: 1rem;
  transition: transform .2s;
}
.cta-btn:hover { transform: translateY(-2px); }

/* ── RESPONSIVE ────────────────────────────────── */
@media (max-width: 640px) {
  .hero h1     { font-size: 1.5rem; }
  .search-box  { flex-direction: column; border-radius: var(--radius); padding: .5rem; }
  .search-field { width: 100%; }
  .search-divider { width: 100%; height: 1px; }
  .hero-search-btn { width: 100%; border-radius: 8px; padding: .75rem; }
  .stat        { padding: .5rem 1rem; }
  .stat-divider { display: none; }
}

/* SKELETON LOADING */
.skeleton-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  animation: shimmer 1.5s infinite;
}
.skel-line {
  height: 14px;
  background: #e2e8f0;
  border-radius: 6px;
  margin-bottom: 10px;
}
.skel-line.short { width: 40%; }
.skel-line.med   { width: 65%; }
.skel-line.full  { width: 100%; }

@keyframes shimmer {
  0%   { opacity: 1; }
  50%  { opacity: .5; }
  100% { opacity: 1; }
}