/* ===================================================
   Használtautó.hu HEX Plugin – Frontend
   =================================================== */

:root {
  --phex-red:       #e63946;
  --phex-red-d:     #c1121f;
  --phex-bg:        #f8f9fa;
  --phex-white:     #ffffff;
  --phex-border:    #e2e8f0;
  --phex-text:      #1e293b;
  --phex-muted:     #64748b;
  --phex-radius:    10px;
  --phex-shadow:    0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  --phex-shadow-h:  0 4px 12px rgba(0,0,0,.1),  0 16px 40px rgba(0,0,0,.08);
  --phex-ease:      cubic-bezier(.4,0,.2,1);
  --phex-dur:       .2s;
}

.phex-wrap { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--phex-text); }

/* ---- Szűrők ---- */
.phex-filters {
  background: var(--phex-white);
  border: 1px solid var(--phex-border);
  border-radius: var(--phex-radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--phex-shadow);
}

.phex-frow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.phex-frow + .phex-frow {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--phex-border);
}

.phex-fg { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 130px; }
.phex-fg--kw { flex: 2; min-width: 200px; }
.phex-fg--actions { flex-direction: row; align-items: flex-end; gap: 8px; flex: none; }

.phex-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--phex-muted);
}

.phex-inp, .phex-sel {
  height: 38px;
  padding: 0 11px;
  border: 1.5px solid var(--phex-border);
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--phex-text);
  background: var(--phex-white);
  width: 100%;
  outline: none;
  transition: border-color var(--phex-dur) var(--phex-ease), box-shadow var(--phex-dur) var(--phex-ease);
  font-family: inherit;
}
.phex-inp:focus, .phex-sel:focus {
  border-color: var(--phex-red);
  box-shadow: 0 0 0 3px rgba(230,57,70,.12);
}
.phex-inp--n { width: 90px; }

.phex-range { display: flex; align-items: center; gap: 5px; }
.phex-range > span { color: var(--phex-muted); flex-shrink: 0; font-size: 13px; }

/* ---- Gombok ---- */
.phex-btn {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--phex-dur), transform var(--phex-dur), box-shadow var(--phex-dur);
  font-family: inherit;
  white-space: nowrap;
}
.phex-btn--primary { background: var(--phex-red); color: #fff; }
.phex-btn--primary:hover { background: var(--phex-red-d); box-shadow: 0 4px 14px rgba(230,57,70,.35); transform: translateY(-1px); }
.phex-btn--ghost { background: var(--phex-bg); color: var(--phex-muted); border: 1.5px solid var(--phex-border); }
.phex-btn--ghost:hover { background: var(--phex-border); color: var(--phex-text); }

/* ---- Toolbar ---- */
.phex-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.phex-count { font-size: 13px; color: var(--phex-muted); }
.phex-count strong { color: var(--phex-text); }

.phex-view-btns { display: flex; gap: 4px; }
.phex-vbtn {
  width: 34px; height: 34px;
  border: 1.5px solid var(--phex-border);
  border-radius: 7px;
  background: var(--phex-white);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--phex-muted);
  transition: all var(--phex-dur);
}
.phex-vbtn svg { width: 16px; height: 16px; fill: currentColor; }
.phex-vbtn.is-active, .phex-vbtn:hover { background: var(--phex-red); border-color: var(--phex-red); color: #fff; }

/* ---- Results ---- */
#phex-results { min-height: 200px; position: relative; }

/* Grid */
.phex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

/* List */
.phex-list { display: flex; flex-direction: column; gap: 12px; }

/* ---- Card ---- */
.phex-card {
  background: var(--phex-white);
  border: 1px solid var(--phex-border);
  border-radius: var(--phex-radius);
  overflow: hidden;
  box-shadow: var(--phex-shadow);
  transition: transform var(--phex-dur) var(--phex-ease), box-shadow var(--phex-dur) var(--phex-ease);
}
.phex-card:hover { transform: translateY(-4px); box-shadow: var(--phex-shadow-h); }

.phex-card__inner { display: block; text-decoration: none; color: inherit; }

/* Image */
.phex-card__img {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--phex-bg);
}
.phex-card__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.phex-card:hover .phex-card__img img { transform: scale(1.04); }

.phex-no-img-icon {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #d1d5db;
}
.phex-no-img-icon svg { width: 56px; height: 56px; }

/* Badges */
.phex-card__badges {
  position: absolute;
  top: 8px; left: 8px;
  display: flex; gap: 5px; flex-wrap: wrap;
}
.phex-badge {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 4px;
  backdrop-filter: blur(6px);
}
.phex-badge--cond { background: rgba(255,255,255,.88); color: var(--phex-text); }
.phex-badge--body { background: rgba(230,57,70,.85); color: #fff; }

/* Body */
.phex-card__body { padding: 14px 16px; }

.phex-card__title {
  margin: 0 0 5px;
  font-size: 15px; font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.phex-card__price {
  font-size: 19px; font-weight: 800;
  color: var(--phex-red); margin-bottom: 10px;
}

.phex-card__specs {
  list-style: none; margin: 0 0 8px; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px;
}
.phex-card__specs li {
  display: flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--phex-muted);
}
.phex-si { font-size: 12px; flex-shrink: 0; }

.phex-card__engine {
  font-size: 12px; color: var(--phex-muted); margin-bottom: 6px;
}

.phex-card__extras {
  display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px;
}
.phex-tag {
  font-size: 11px; padding: 2px 7px;
  background: #f0fdf4; color: #166534;
  border: 1px solid #bbf7d0; border-radius: 4px;
}

.phex-card__footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; border-top: 1px solid var(--phex-border);
  font-size: 12px;
}
.phex-card__loc { color: var(--phex-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.phex-card__cta { color: var(--phex-red); font-weight: 600; white-space: nowrap; }

/* ---- List nézet ---- */
.phex-list .phex-card__inner { display: flex; flex-direction: row; }
.phex-list .phex-card__img { width: 200px; flex-shrink: 0; aspect-ratio: auto; min-height: 140px; }
.phex-list .phex-card__body { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.phex-list .phex-card__specs { grid-template-columns: repeat(4, auto); gap: 4px 16px; }
.phex-list .phex-card__title { white-space: normal; }

/* ---- Spinner ---- */
.phex-spinner {
  display: flex; justify-content: center; align-items: center;
  gap: 6px; padding: 60px 0;
}
.phex-spinner span {
  width: 10px; height: 10px;
  background: var(--phex-red); border-radius: 50%;
  animation: phex-bounce .9s ease-in-out infinite;
}
.phex-spinner span:nth-child(2) { animation-delay: .15s; }
.phex-spinner span:nth-child(3) { animation-delay: .30s; }
@keyframes phex-bounce { 0%,80%,100%{transform:scale(0)} 40%{transform:scale(1)} }

/* ---- No results ---- */
.phex-empty {
  text-align: center; padding: 60px 20px;
  color: var(--phex-muted); font-size: 15px;
}
.phex-empty svg { width: 60px; height: 60px; fill: var(--phex-border); display: block; margin: 0 auto 14px; }

/* ---- Pager ---- */
.phex-pager {
  margin-top: 28px;
  display: flex; justify-content: center; align-items: center;
  gap: 5px; flex-wrap: wrap;
}
.phex-pg {
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 1.5px solid var(--phex-border); border-radius: 7px;
  background: var(--phex-white); font-size: 13.5px; font-weight: 500;
  cursor: pointer; color: var(--phex-text);
  transition: all var(--phex-dur); font-family: inherit;
}
.phex-pg:hover { border-color: var(--phex-red); color: var(--phex-red); }
.phex-pg.is-active { background: var(--phex-red); border-color: var(--phex-red); color: #fff; font-weight: 700; }
.phex-pg:disabled { opacity: .35; cursor: default; pointer-events: none; }
.phex-pg--prev, .phex-pg--next { font-size: 13px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .phex-filters { padding: 14px; }
  .phex-fg, .phex-fg--kw { min-width: 100%; flex: none; }
  .phex-fg--actions { min-width: 100%; }
  .phex-btn { flex: 1; }
  .phex-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .phex-list .phex-card__inner { flex-direction: column; }
  .phex-list .phex-card__img { width: 100%; min-height: auto; aspect-ratio: 16/9; }
  .phex-list .phex-card__specs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .phex-grid { grid-template-columns: 1fr; }
}
