/* FreelaHub — Mobile-first */
:root {
  --bg: #f3f6f4;
  --bg-elevated: #ffffff;
  --ink: #14201a;
  --ink-soft: #4a5c52;
  --muted: #7a8b82;
  --line: #e2ebe6;
  --brand: #0d7a5f;
  --brand-dark: #0a5c48;
  --brand-soft: #e6f5f0;
  --accent: #e8a317;
  --danger: #d64545;
  --success: #1f9d65;
  --warning: #d97706;
  --shadow: 0 8px 28px rgba(20, 32, 26, 0.08);
  --shadow-sm: 0 2px 10px rgba(20, 32, 26, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 68px;
  --header-h: 60px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --font-display: "Syne", "Outfit", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9f0e8 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #fff3d6 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.45;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100%, 480px);
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  position: relative;
}

.app-shell.no-nav {
  padding-bottom: 24px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(243, 246, 244, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 235, 230, 0.8);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 760;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--brand-dark);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--brand), #149878);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  box-shadow: 0 6px 16px rgba(13, 122, 95, 0.28);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-align: center;
  min-height: 48px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(165deg, #119574, var(--brand-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 122, 95, 0.28);
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-accent {
  background: linear-gradient(165deg, #f0b429, #d4920a);
  color: #1a1405;
  box-shadow: 0 8px 20px rgba(232, 163, 23, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--brand-dark);
  padding: 8px 12px;
  min-height: auto;
}

.btn-danger {
  background: #fff1f1;
  color: var(--danger);
  border: 1px solid #ffd4d4;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 56px;
  font-size: 1.05rem;
  border-radius: 16px;
}

.btn-sm {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.88rem;
  border-radius: 10px;
}

/* Content */
.page {
  padding: 16px;
  animation: fadeUp 0.35s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  padding: 8px 4px 20px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 7vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
}

.hero p {
  color: var(--ink-soft);
  margin: 0 0 20px;
  font-size: 1.02rem;
}

.hero-actions {
  display: grid;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.15rem;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.section-title a {
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.search-bar input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  color: var(--ink);
}

.search-bar i,
.search-bar .icon {
  color: var(--muted);
}

/* Categories */
.cat-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.cat-scroll::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex: 0 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: 0.15s ease;
}

.cat-chip.active,
.cat-chip:hover {
  background: var(--brand-soft);
  border-color: #b7e0d1;
  color: var(--brand-dark);
}

/* Job cards */
.job-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.job-card:active {
  transform: scale(0.99);
}

.job-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.job-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 720;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-ok {
  background: #e8f8f0;
  color: var(--success);
}

.badge-off {
  background: #fdecec;
  color: var(--danger);
}

.badge-warn {
  background: #fff7e8;
  color: var(--warning);
}

.badge-premium {
  background: linear-gradient(135deg, #fff3cc, #ffe08a);
  color: #7a5600;
}

.badge-cat {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.job-meta {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.job-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.job-meta-row i {
  width: 18px;
  color: var(--brand);
  text-align: center;
}

.job-amount {
  font-weight: 750;
  color: var(--brand-dark);
  font-size: 1.05rem;
}

.job-footer {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.job-footer .btn {
  flex: 1;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(100%, 480px);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
  box-shadow: 0 -8px 24px rgba(20, 32, 26, 0.06);
}

.bottom-nav.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 12px;
  transition: 0.15s ease;
}

.nav-item i {
  font-size: 1.15rem;
}

.nav-item.active,
.nav-item:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

/* Forms / Quiz */
.quiz-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.progress-track {
  height: 6px;
  background: #dfeae4;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #1fb892);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.quiz-step h1 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.quiz-step p {
  color: var(--ink-soft);
  margin: 0 0 22px;
}

.choice-grid {
  display: grid;
  gap: 12px;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--bg-elevated);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: 0.15s ease;
  width: 100%;
  color: var(--ink);
}

.choice-card:hover,
.choice-card:focus {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: var(--shadow-sm);
}

.choice-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-weight: 650;
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  color: var(--ink);
  -webkit-user-select: text;
  user-select: text;
  pointer-events: auto;
  touch-action: manipulation;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 122, 95, 0.12);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.check-pill:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.check-pill input {
  accent-color: var(--brand);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.45rem;
  font-weight: 750;
  margin-top: 4px;
  font-family: var(--font-display);
}

/* Modal / Premium gate */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 24, 20, 0.55);
  z-index: 80;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  width: min(100%, 460px);
  background: #fff;
  border-radius: 22px 22px 18px 18px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow);
  animation: sheetUp 0.28s ease;
}

@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-sheet h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.benefits {
  list-style: none;
  padding: 0;
  margin: 16px 0 20px;
}

.benefits li {
  padding: 8px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--ink-soft);
}

.benefits li i {
  color: var(--success);
  margin-top: 3px;
}

/* Alerts */
.messages {
  padding: 0 16px;
}

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 0.92rem;
  font-weight: 550;
}

.alert-success { background: #e8f8f0; color: #146c45; }
.alert-error,
.alert-danger { background: #fdecec; color: #9f2d2d; }
.alert-warning { background: #fff7e8; color: #8a5200; }
.alert-info { background: #e8f3ff; color: #1d4f91; }

/* Profile / misc */
.profile-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(145deg, var(--brand), #149878);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 750;
  margin: 0 auto 12px;
}

.list-menu {
  margin-top: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-menu a,
.list-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-weight: 600;
}

.list-menu a:last-child,
.list-menu button:last-child {
  border-bottom: none;
}

.list-menu i {
  color: var(--brand);
  width: 20px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

.empty-state i {
  font-size: 2.4rem;
  color: var(--brand);
  margin-bottom: 12px;
}

.table-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.table-card .row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.filter-btn {
  margin-left: auto;
}

/* Ads */
.ads-section {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.ad-card {
  background: linear-gradient(145deg, #fff9e8, #ffffff);
  border: 1px solid #f0e0b0;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.ad-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 750;
  color: #8a6500;
  background: #ffe9a8;
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 10px;
}

.ad-title {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.ad-body {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  white-space: pre-line;
}

.ad-image {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 12px;
}

.cta-premium {
  background: linear-gradient(145deg, #14201a, #1d3a2e);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  position: relative;
  overflow: hidden;
}

.cta-premium::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(232, 163, 23, 0.35), transparent 70%);
}

.cta-premium h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  position: relative;
  z-index: 1;
}

.cta-premium p {
  margin: 0 0 14px;
  color: #c9d8d0;
  position: relative;
  z-index: 1;
}

.cta-premium .btn {
  position: relative;
  z-index: 1;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
}

.pagination a,
.pagination span {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  font-weight: 650;
}

.pagination .current {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.desktop-note {
  display: none;
}

@media (min-width: 900px) {
  body {
    background:
      radial-gradient(1400px 600px at 20% -10%, #d9f0e8 0%, transparent 50%),
      radial-gradient(1000px 500px at 90% 10%, #fff3d6 0%, transparent 40%),
      #eef3f0;
  }

  .app-shell {
    width: min(100%, 1100px);
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    padding: 24px 24px calc(var(--nav-h) + 24px);
  }

  .app-shell > .app-header,
  .app-shell > .messages,
  .app-shell > .page,
  .app-shell > .bottom-nav {
    grid-column: 2;
  }

  .side-rail {
    display: block;
    position: sticky;
    top: 24px;
    height: fit-content;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    grid-column: 1;
    grid-row: 1 / span 10;
  }

  .bottom-nav {
    left: auto;
    right: max(24px, calc(50% - 550px + 240px + 24px));
    transform: none;
    width: min(calc(100% - 288px), 836px);
    border-radius: 18px 18px 0 0;
  }

  .hero h1 {
    font-size: 2.8rem;
  }

  .stats-grid.admin {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 899px) {
  .side-rail {
    display: none;
  }
}

/* Utility */
.text-muted { color: var(--muted); }
.text-soft { color: var(--ink-soft); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { gap: 10px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
