/* ============================================================
   🧱 LAYOUT: SECCIÓ D’OFERTES
   ------------------------------------------------------------
   Defineix l’estructura general de la pàgina d’ofertes,
   incloent filtres, distribució de targetes i controls de vista.
   ============================================================ */


/* === 1️⃣ VISTA LLISTA (una oferta per fila) === */
.job-listings.list-view {
  display: flex !important;
  flex-direction: column;
}

.job-listings.list-view .job-item {
  width: 100%;
}


/* === 2️⃣ VISTA GRAELLA (targetes múltiples per fila) === */
#ofertes-publicades.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(20px, 2vw, 30px);
  align-items: start;
}


/* === 3️⃣ SELECTOR: “Ofertes per pàgina” === */
.per-page-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0 0 18px auto;
}

/* === 4️⃣ DISTRIBUCIÓ GENERAL === */
.ofertes-layout {
  display: flex;
  align-items: flex-start;
  gap: clamp(22px, 3vw, 38px);
  max-width: var(--max-width-container);
  margin: 0 auto;
  padding: 0 clamp(4px, 1vw, 8px);
  overflow: visible;
}

/* === 5️⃣ WRAPPER → LÍMIT REAL DEL STICKY === */
.filters-wrapper {
  position: relative;
  flex: 0 0 316px; /* ample fix de la columna esquerra */
  align-self: stretch;
}

/* === 6️⃣ FILTRES (element sticky) === */
.filters {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;

  background: var(--gradient-surface);
  padding: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);

  position: sticky;
  top: 24px;
  overflow-anchor: none;
}

.filters .custom-select,
.filters input[type="text"],
.filters select,
.filters .filtre-km,
.filters .filtre-localitat,
.filters .filtre-localitat-cerca,
.filters #btn-apply-filters,
.filters #checklist-municipis {
  width: 100%;
}

.filters #checklist-municipis,
.filters #llista-check-municipis {
  overflow-anchor: none;
}

.ofertes-layout .filters input,
.ofertes-layout .filters select,
.ofertes-layout .filters .selected,
.ofertes-layout .filters #llista-check-municipis label {
  padding-top: 10px;
  padding-bottom: 10px;
}

.ofertes-layout .filters .km-labels {
  font-size: 0.9rem;
}

.ofertes-layout .filters .filtre-localitat,
.ofertes-layout .filters .filtre-localitat-activa,
.ofertes-layout .filters .filtre-localitat-cerca {
  font-size: 12.5px;
}

/* === 7️⃣ LLISTAT D’OFERTES (columna dreta) === */
.job-listings {
  flex: 1; /* ocupa tot l'espai restant */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;

  width: 100%;
  padding-bottom: 40px;
  box-sizing: border-box;
}



/* === 7️⃣ TARGETA BASE (estructura i estètica lleugera) === */
.job-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;

  padding: 1.8rem;
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-l);
  border: 1px solid rgba(19, 44, 99, 0.08);
  box-shadow: 0 14px 34px rgba(11, 21, 38, 0.06);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
}


/* 🔹 Interacció hover */
.job-item:hover {
  transform: translateY(-3px);
  border-color: rgba(217, 180, 74, 0.28);
  box-shadow: 0 18px 40px rgba(11, 21, 38, 0.08);
  background-color: #ffffff;
}

/* =====================================================
   🌙 DARK MODE — MODAL FILTRES MÒBIL
   ===================================================== */

[data-theme="dark"] #modal-filtres {
  background: #111827;
  color: #e5e7eb;
}

[data-theme="dark"] .filters {
  background: linear-gradient(180deg, rgba(10, 18, 32, 0.98), rgba(14, 23, 42, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] .job-item {
  background: linear-gradient(180deg, rgba(12, 19, 35, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}

[data-theme="dark"] .job-item:hover {
  border-color: rgba(245, 211, 106, 0.22);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 27, 48, 0.98));
}

/* Camps dins del modal */
[data-theme="dark"] #modal-filtres input,
[data-theme="dark"] #modal-filtres select {
  background: #0f172a;
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,.15);
}

/* Placeholder */
[data-theme="dark"] #modal-filtres input::placeholder {
  color: #9ca3af;
}

/* Labels i textos secundaris */
[data-theme="dark"] #modal-filtres label,
[data-theme="dark"] #modal-filtres small {
  color: #9ca3af;
}

/* Range slider text */
[data-theme="dark"] #modal-filtres span {
  color: #9ca3af;
}

/* =====================================================
   🌙 DARK MODE — CONTENIDOR INTERIOR REAL
   ===================================================== */

[data-theme="dark"] #modal-filtres .filters,
[data-theme="dark"] #modal-filtres .modal-content,
[data-theme="dark"] #modal-filtres > div {
  background: #111827 !important;
  color: #e5e7eb;
}

[data-theme="dark"] .tancar-filtres {
  color: #e5e7eb;
  opacity: .85;
}

[data-theme="dark"] .tancar-filtres:hover {
  opacity: 1;
}
