/* ============================================================
   PARTS SEARCH — pn-search.css  v3.2
   ============================================================ */

#pn-search-root * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Wrapper ────────────────────────────────────────────── */
.pns-wrap {
  background: #ffffff;
  border-radius: 10px;
  overflow: visible;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 16px rgba(0,0,0,.09);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Tabs ───────────────────────────────────────────────── */
.pns-tabs {
  display: flex;
  background: #f7f7f7;
  border-bottom: 1px solid #e8e8e8;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
}

.pns-tab {
  padding: 14px 26px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #999;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  margin-bottom: -1px;
}
.pns-tab:hover { color: #444; }
.pns-tab.active {
  color: #1a1a1a;
  border-bottom-color: #F5AF20;
  background: #ffffff;
}

/* ─── Panel ──────────────────────────────────────────────── */
.pns-panel {
  padding: 20px 24px 24px;
  background: #ffffff;
  border-radius: 0 0 10px 10px;
}

/* ─── Filas ──────────────────────────────────────────────── */
.pns-row { display: flex; gap: 8px; align-items: center; }
.pns-row-top    { margin-bottom: 10px; }
.pns-row-bottom { margin-bottom: 14px; }
.pns-row-actions { gap: 8px; }

/* Desktop: 4 columnas en fila bottom */
@media (min-width: 601px) {
  .pns-row-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 10px;
  }
  .pns-row-bottom .pns-select-wrap { min-width: 0; }
}

/* ─── Inputs ─────────────────────────────────────────────── */
.pns-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: #1a1a1a;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
}
.pns-input::placeholder { color: #bbb; }
.pns-input:focus {
  border-color: #F5AF20;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(245,175,32,.12);
}
.pns-input-full { width: 100%; flex: none; }

/* ─── Selects ────────────────────────────────────────────── */
.pns-select-wrap {
  flex: 1;
  min-width: 100px;
  position: relative;
}
.pns-select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-top-color: #aaa;
  pointer-events: none;
}
.pns-model-wrap::after { display: none; }

.pns-select {
  width: 100%;
  padding: 11px 30px 11px 14px;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: #1a1a1a;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.pns-select:focus {
  border-color: #F5AF20;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(245,175,32,.12);
}

/* ─── Dropdown modelo ────────────────────────────────────── */
.pns-model-wrap { position: relative; }

.pns-model-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  z-index: 9999;
  max-height: 240px;
  overflow-y: auto;
}
.pns-model-option {
  padding: 10px 14px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background .1s;
}
.pns-model-option:last-child { border-bottom: none; }
.pns-model-option:hover { background: #fffdf5; }
.pns-model-option strong { color: #F5AF20; font-weight: 700; }

/* ─── Botones ────────────────────────────────────────────── */
.pns-btn-search {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 24px;
  background: #F5AF20;
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .1s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(245,175,32,.3);
}
.pns-btn-search:hover { background: #354655; color: #fff; }
.pns-btn-search:active { transform: scale(.98); }
.pns-btn-search:disabled { opacity: .5; cursor: default; }

.pns-btn-reset {
  padding: 11px 18px;
  background: transparent;
  color: #999;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.pns-btn-reset:hover { border-color: #bbb; color: #444; background: #f5f5f5; }

/* ─── Loading ────────────────────────────────────────────── */
.pns-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2rem;
  color: #bbb;
  font-size: 14px;
}
.pns-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e8e8e8;
  border-top-color: #F5AF20;
  border-radius: 50%;
  animation: pns-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes pns-spin { to { transform: rotate(360deg); } }

/* ─── Resultados ─────────────────────────────────────────── */
.pns-results {
  margin-top: 16px;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
}
.pns-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.pns-results-count {
  font-size: 12px;
  color: #aaa;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* ─── Tabla ──────────────────────────────────────────────── */
.pns-results-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #ebebeb;
}

.pns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

.pns-table thead tr {
  background: #fafafa;
  border-bottom: 1px solid #ebebeb;
}

.pns-table th {
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #bbb;
  white-space: nowrap;
}

.pns-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #f5f5f5;
  color: #333;
  vertical-align: middle;
  font-size: 14px;
}

.pns-table tbody tr:last-child td { border-bottom: none; }
.pns-table tbody tr:hover td { background: #fffdf5; }

/* ─── Parte link ─────────────────────────────────────────── */
.pns-part-link {
  color: #1a1a1a;
  font-weight: 700;
  text-decoration: none;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  white-space: nowrap;
}
.pns-part-link:hover { color: #F5AF20; }

/* ─── Descripción ────────────────────────────────────────── */
.pns-desc {
  max-width: 320px;
  line-height: 1.5;
  color: #555;
  font-size: 14px;
}

/* ─── Badges ─────────────────────────────────────────────── */
.pns-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.pns-new   { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.pns-reman { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.pns-used  { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ─── Status dot ─────────────────────────────────────────── */
.pns-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.pns-dot-in  { background: #22C55E; }
.pns-dot-out { background: #ddd; }

/* ─── Botón ver ──────────────────────────────────────────── */
.pns-btn-view {
  display: inline-block;
  padding: 7px 16px;
  background: #F5AF20;
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s;
  box-shadow: 0 1px 4px rgba(245,175,32,.25);
}
.pns-btn-view:hover { background: #354655; color: #fff; }

/* ─── Paginación ─────────────────────────────────────────── */
.pns-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pns-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
}
.pns-page-btn:hover { border-color: #F5AF20; color: #1a1a1a; }
.pns-page-btn.active { background: #F5AF20; border-color: #F5AF20; color: #1a1a1a; }
.pns-page-dots { color: #bbb; font-size: 13px; padding: 0 3px; }

/* ─── Footer resultados ──────────────────────────────────── */
.pns-results-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  font-size: 13px;
  color: #bbb;
}

/* ─── Sin resultados ─────────────────────────────────────── */
.pns-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 3rem;
  color: #ccc;
  font-size: 14px;
  text-align: center;
}
.pns-no-results a { color: #F5AF20; text-decoration: none; font-weight: 600; }
.pns-no-results a:hover { color: #354655; }

/* ─── Request response ───────────────────────────────────── */
#pns-req-response {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  border-radius: 6px;
}

/* ─── Responsive móvil ───────────────────────────────────── */
@media (max-width: 600px) {
  .pns-panel { padding: 14px; }

  .pns-row-top .pns-input { width: 100%; flex: none; }

  .pns-row-bottom {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
  }
  .pns-row-bottom .pns-input,
  .pns-row-bottom .pns-select-wrap {
    width: 100%;
    min-width: 0;
    flex: none;
  }
  .pns-btn-search { flex: 1; justify-content: center; }

  .pns-table th,
  .pns-table td { padding: 12px 10px; font-size: 12px; }

  .pns-desc { max-width: 140px; font-size: 12px; }
}

/* ─── Pantallas medianas (1024px+) ───────────────────────── */
@media (min-width: 1024px) {
  .pns-panel { padding: 24px 32px 32px; }
  .pns-row-top    { margin-bottom: 12px; }
  .pns-row-bottom { margin-bottom: 16px; gap: 12px; }

  .pns-input,
  .pns-select { padding: 12px 16px; font-size: 15px; }
  .pns-select { padding: 12px 32px 12px 16px; }

  .pns-btn-search { padding: 12px 28px; font-size: 15px; }
  .pns-btn-reset  { padding: 12px 20px; font-size: 14px; }
  .pns-tab        { padding: 15px 28px; font-size: 13px; }

  .pns-table th   { padding: 16px 20px; font-size: 12px; }
  .pns-table td   { padding: 18px 20px; font-size: 15px; }
  .pns-part-link  { font-size: 15px; }
  .pns-desc       { max-width: 420px; font-size: 14px; }
  .pns-btn-view   { padding: 8px 20px; font-size: 13px; }
}

/* ─── Pantallas grandes (1440px+) ────────────────────────── */
@media (min-width: 1440px) {
  .pns-panel { padding: 28px 40px 40px; }

  .pns-input,
  .pns-select { padding: 14px 18px; font-size: 16px; }
  .pns-select { padding: 14px 34px 14px 18px; }

  .pns-btn-search { padding: 14px 32px; font-size: 16px; }
  .pns-btn-reset  { padding: 14px 22px; font-size: 15px; }

  .pns-table th   { padding: 18px 24px; font-size: 12px; }
  .pns-table td   { padding: 20px 24px; font-size: 15px; }
  .pns-desc       { max-width: 500px; }
  .pns-btn-view   { padding: 9px 22px; font-size: 14px; }
}

/* ─── Header: formulario reducido ────────────────────────── */
.elementor-location-header #pn-search-root .pns-wrap {
  transform: scale(0.72) !important;
  transform-origin: center center !important;
  margin: 0 !important;
}
.elementor-location-header #pn-search-root {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
}

@media (max-width: 768px) {
  #pn-search-root,
  #pn-search-root .pns-wrap,
  #pn-search-root .pns-panel,
  #pn-search-root .pns-row-top,
  #pn-search-root .pns-row-bottom,
  #pn-search-root .pns-row-actions {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .elementor-widget-shortcode {
    width: 100% !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
  }
}
/* ─── Espaciado exterior del buscador ───────────────────── */
#pn-search-root {
  padding: 0 40px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  #pn-search-root {
    padding: 0 16px;
  }
}