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

/* Light theme (default) */
:root {
  color-scheme: light;
  --grad: linear-gradient(45deg, #b8704a, #b04f6e, #7f4f9c, #4f5fae);
  --soft: linear-gradient(160deg, #fbf1e8, #f6e6ee 55%, #e9e8f6);
  --accent: #b04f6e;
  --text: #2b2630;
  --muted: #756f7a;
  --bg: #fbf9f8;
  --line: #e6e1e4;
  --surface: #ffffff;
  --surface-2: #f3eff1;
  --surface-3: #faf7f8;
  --danger: #b3423a;
  --danger-bg: #fbeceb;
  --success: #3d7a4f;
  --success-bg: #e9f4ec;
  --disabled-text: #9a949c;
  --shadow-color: rgba(60, 40, 70, 0.1);
  --photo-filter: none;
}

/* Dark theme: follows the device unless the user chose Light in the footer */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --soft: linear-gradient(160deg, #2a1f25, #2a2030 55%, #1d2036);
    --accent: #e59ab0;
    --text: #efeaf1;
    --muted: #a8a0b1;
    --bg: #141218;
    --line: #39343f;
    --surface: #1e1b23;
    --surface-2: #2b2731;
    --surface-3: #25222b;
    --danger: #f19189;
    --danger-bg: #3b2224;
    --success: #82cf98;
    --success-bg: #1f3427;
    --disabled-text: #7d7686;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --photo-filter: brightness(0.82) saturate(0.9);
  }
}

/* Dark theme chosen by the user in the footer */
:root[data-theme="dark"] {
  color-scheme: dark;
  --soft: linear-gradient(160deg, #2a1f25, #2a2030 55%, #1d2036);
  --accent: #e59ab0;
  --text: #efeaf1;
  --muted: #a8a0b1;
  --bg: #141218;
  --line: #39343f;
  --surface: #1e1b23;
  --surface-2: #2b2731;
  --surface-3: #25222b;
  --danger: #f19189;
  --danger-bg: #3b2224;
  --success: #82cf98;
  --success-bg: #1f3427;
  --disabled-text: #7d7686;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --photo-filter: brightness(0.82) saturate(0.9);
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
}

.logo {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Big centered screen before searching */
.hero {
  background: var(--soft);
  color: var(--text);
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
  text-align: center;
}

.center { width: 100%; max-width: 760px; }

.hero h1 { font-size: 2.6rem; margin-bottom: 8px; }
.sub { font-size: 1.1rem; color: var(--muted); margin-bottom: 28px; }

.search {
  background: var(--surface);
  color: var(--text);
  padding: 22px;
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px var(--shadow-color);
  text-align: left;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 14px;
}

.filters label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.filters select {
  padding: 15px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}

.days,
.time { grid-column: 1 / -1; }

.field-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.field-title b { color: var(--text); font-size: 0.95rem; }

/* Day buttons */
.day-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chip {
  flex: 1;
  min-width: 46px;
  padding: 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.chip.on {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
}

/* Time range slider with two handles */
.range-wrap {
  position: relative;
  height: 30px;
  margin-top: 8px;
}

.range-track {
  position: absolute;
  top: 13px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
}

.range-fill {
  position: absolute;
  top: 13px;
  height: 4px;
  background: var(--grad);
  border-radius: 4px;
}

.range-wrap input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 30px;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.range-wrap input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
  height: 30px;
}

.range-wrap input[type="range"]::-moz-range-track {
  background: transparent;
}

.range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 24px;
  height: 24px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  cursor: pointer;
}

.range-wrap input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  cursor: pointer;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

#go {
  width: 100%;
  margin-top: 18px;
  padding: 18px;
  border: 0;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}

#go:disabled {
  background: var(--line);
  color: var(--disabled-text);
  cursor: not-allowed;
}

.hint {
  margin-top: 10px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* After searching: the hero shrinks to the top */
body.searched .hero {
  min-height: 0;
  padding: 24px 16px 28px;
}
body.searched .hero h1 { font-size: 1.5rem; margin-bottom: 16px; }
body.searched .sub { display: none; }
body.searched .search { padding: 16px; }
body.searched .filters { gap: 12px; }
body.searched .filters select { padding: 11px 10px; }
body.searched .chip { padding: 9px 0; }
body.searched #go { padding: 13px; font-size: 1rem; }

main {
  max-width: 900px;
  margin: 28px auto 40px;
  padding: 0 16px;
}

#count { color: var(--muted); margin-bottom: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.empty {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.photo {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  filter: var(--photo-filter);
}

.info { padding: 14px; }
.info h3 { font-size: 1.05rem; }
.info .employer { color: var(--muted); font-size: 0.9rem; margin: 2px 0 8px; }
.info .meta { font-size: 0.85rem; color: var(--muted); }

.tags { margin: 10px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 0.75rem;
  background: var(--surface-2);
  padding: 4px 9px;
  border-radius: 20px;
}

.bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.pay { font-weight: 700; }

.apply {
  text-decoration: none;
  background: var(--grad);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .hero h1 { font-size: 2rem; }
  .filters { grid-template-columns: 1fr; }
}