/* ── PIN Code Finder – Styles ────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

.pcf-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  width: 100%;
  max-width: 820px;
  margin: 1.5rem auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: clamp(1rem, 4vw, 2rem);
  box-shadow: 0 4px 28px rgba(0,0,0,0.08);
  color: #1e293b;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.pcf__header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.pcf__icon {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1;
  flex-shrink: 0;
}

.pcf__title {
  font-size: clamp(1.1rem, 3.5vw, 1.55rem);
  font-weight: 800;
  margin: 0 0 0.25rem;
  color: #0f172a;
  line-height: 1.25;
}

.pcf__desc {
  font-size: clamp(0.78rem, 2.2vw, 0.88rem);
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* ── Fieldset ────────────────────────────────────────────────────────────── */

.pcf__fieldset {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: clamp(0.85rem, 3vw, 1.4rem) clamp(0.75rem, 3vw, 1.5rem);
  margin: 0 0 1.25rem;
  background: #f8fafc;
  width: 100%;
}

.pcf__legend {
  font-size: 0.78rem;
  font-weight: 800;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0 0.4rem;
  background: #fff;
  border-radius: 4px;
}

.pcf__search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  width: 100%;
}

.pcf__input-wrap {
  position: relative;
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  min-width: 0;
}

.pcf__input-icon {
  position: absolute;
  left: 0.8rem;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.pcf__input {
  width: 100%;
  padding: 0.75rem 4.5rem 0.75rem 2.4rem;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}

.pcf__input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

.pcf__char-count {
  position: absolute;
  right: 0.8rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  pointer-events: none;
  white-space: nowrap;
}

.pcf__btn {
  flex-shrink: 0;
  padding: 0.75rem 1.4rem;
  border: none;
  border-radius: 10px;
  background: #7c3aed;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
  align-self: stretch;
}

.pcf__btn:hover  { background: #6d28d9; }
.pcf__btn:active { transform: scale(0.97); }
.pcf__btn:disabled { background: #a78bfa; cursor: not-allowed; }

.pcf__hint {
  font-size: 0.76rem;
  color: #94a3b8;
  margin: 0;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */

.pcf__loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  color: #64748b;
  font-size: 0.9rem;
}

.pcf__spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: pcf-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes pcf-spin { to { transform: rotate(360deg); } }

/* ── Error ───────────────────────────────────────────────────────────────── */

.pcf__error {
  padding: 0.85rem 1rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ── Summary bar ─────────────────────────────────────────────────────────── */

.pcf__summary {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 2px solid #c4b5fd;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: #4c1d95;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Location card ───────────────────────────────────────────────────────── */

.pcf__location-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.1rem;
  margin-bottom: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr));
  gap: 0.85rem;
  width: 100%;
}

.pcf__loc-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.pcf__loc-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.pcf__loc-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  overflow-wrap: break-word;
}

.pcf__loc-value--pin {
  font-size: 1.4rem;
  color: #7c3aed;
  letter-spacing: 0.1em;
}

/* ── PO grid header ──────────────────────────────────────────────────────── */

.pcf__po-header {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #475569;
  margin-bottom: 0.6rem;
}

.pcf__po-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

/* ── PO card ─────────────────────────────────────────────────────────────── */

.pcf__po-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s;
  min-width: 0;
}

.pcf__po-card:hover { border-color: #c4b5fd; }

.pcf__po-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.pcf__po-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pcf__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.pcf__badge--head    { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.pcf__badge--sub     { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.pcf__badge--branch  { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.pcf__badge--delivery{ background: #f5f3ff; color: #5b21b6; border: 1px solid #ddd6fe; }
.pcf__badge--nod     { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.pcf__po-meta {
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.5;
}

.pcf__po-meta span { display: block; }

/* ── Popular PINs ────────────────────────────────────────────────────────── */

.pcf__popular {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: clamp(0.85rem, 3vw, 1.1rem) clamp(0.75rem, 3vw, 1.4rem);
  margin-bottom: 1.5rem;
  width: 100%;
  overflow: hidden;
}

.pcf__popular-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #374151;
  margin: 0 0 0.75rem;
}

/* Auto-fill: fits as many columns as possible with a min of 120px each */
.pcf__popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr));
  gap: 0.5rem;
  width: 100%;
}

.pcf__popular-tag {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.pcf__popular-tag:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.pcf__popular-pin {
  font-size: 0.82rem;
  font-weight: 800;
  color: #7c3aed;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcf__popular-city {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcf__popular-state {
  font-size: 0.62rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Info grid ───────────────────────────────────────────────────────────── */

.pcf__info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.pcf__info-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  min-width: 0;
}

.pcf__info-icon {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.pcf__info-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.3rem;
}

.pcf__info-body {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.55;
  overflow-wrap: break-word;
}

/* ── Disclaimer ──────────────────────────────────────────────────────────── */

.pcf__disclaimer {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.76rem;
  color: #0c4a6e;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.pcf__disclaimer a { color: #0369a1; font-weight: 600; }
