/* ── MaltaPost Postcode Finder — Styles ── */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:ital,wght@0,400;0,500;0,600;1,400&family=Space+Mono&display=swap');

:root {
  --mpp-red:        #c8102e;
  --mpp-red-dark:   #a50d25;
  --mpp-red-pale:   #fff1f3;
  --mpp-red-mid:    #fecdd3;
  --mpp-ink:        #0f172a;
  --mpp-ink2:       #374151;
  --mpp-muted:      #9ca3af;
  --mpp-border:     #e5e7eb;
  --mpp-surface:    #f8fafc;
  --mpp-white:      #ffffff;
  --mpp-gozo:       #1d4ed8;
  --mpp-gozo-pale:  #eff6ff;
  --mpp-radius-sm:  8px;
  --mpp-radius:     14px;
  --mpp-radius-lg:  20px;
  --mpp-shadow:     0 2px 16px rgba(15,23,42,.07);
  --mpp-shadow-lg:  0 8px 40px rgba(15,23,42,.12);
}

/* ─── Container ─── */
.mpp-wrap {
  font-family: 'DM Sans', sans-serif;
  max-width: 760px;
  margin: 0 auto 3rem;
  color: var(--mpp-ink);
}

/* ─── Header ─── */
.mpp-header {
  background: var(--mpp-ink);
  border-radius: var(--mpp-radius-lg) var(--mpp-radius-lg) 0 0;
  padding: 2px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #c8102e 200%);
  position: relative;
  overflow: hidden;
}

.mpp-header::before {
  content: 'MT';
  position: absolute;
  right: -10px;
  top: -20px;
  font-family: 'Syne', sans-serif;
  font-size: 9rem;
  font-weight: 800;
  color: rgba(255,255,255,.04);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.mpp-header-inner {
  padding: 28px 32px 26px;
}

.mpp-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.mpp-flag {
  width: 36px;
  height: 24px;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.12);
  flex-shrink: 0;
}

.mpp-brand-name {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.mpp-tagline {
  margin: 0;
  color: rgba(255,255,255,.55);
  font-size: 0.875rem;
}

/* ─── Search Box ─── */
.mpp-search-box {
  background: var(--mpp-white);
  border: 1px solid var(--mpp-border);
  border-top: none;
  padding: 18px 20px;
}

.mpp-search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--mpp-surface);
  border: 2px solid var(--mpp-border);
  border-radius: var(--mpp-radius);
  padding: 0 14px;
  transition: border-color .2s, box-shadow .2s;
}

.mpp-search-inner:focus-within {
  border-color: var(--mpp-red);
  background: var(--mpp-white);
  box-shadow: 0 0 0 4px rgba(200,16,46,.1);
}

.mpp-search-icon {
  color: var(--mpp-muted);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  transition: color .2s;
}

.mpp-search-inner:focus-within .mpp-search-icon { color: var(--mpp-red); }

.mpp-input {
  flex: 1;
  height: 52px;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: var(--mpp-ink);
  outline: none;
  min-width: 0;
}

.mpp-input::placeholder { color: var(--mpp-muted); }

.mpp-clear {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--mpp-muted);
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.mpp-clear:hover { color: var(--mpp-red); background: var(--mpp-red-pale); }

.mpp-search-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--mpp-muted);
}

.mpp-count-badge {
  background: var(--mpp-red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ─── States ─── */
.mpp-state {
  padding: 52px 24px;
  text-align: center;
  background: var(--mpp-white);
  border: 1px solid var(--mpp-border);
  border-top: none;
  border-radius: 0 0 var(--mpp-radius-lg) var(--mpp-radius-lg);
}

.mpp-state p {
  margin: 14px 0 0;
  color: var(--mpp-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.mpp-idle-state svg { opacity: .6; }

.mpp-error-state {
  background: #fff5f5;
  border-color: #fecaca;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 24px 32px;
}

.mpp-spinner { display: flex; justify-content: center; }

/* ─── Results Grid ─── */
.mpp-results {
  background: var(--mpp-surface);
  border: 1px solid var(--mpp-border);
  border-top: none;
  border-radius: 0 0 var(--mpp-radius-lg) var(--mpp-radius-lg);
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

/* ─── Address Card ─── */
.mpp-card {
  background: var(--mpp-white);
  border: 1.5px solid var(--mpp-border);
  border-radius: var(--mpp-radius);
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--mpp-shadow);
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
  overflow: hidden;
}

.mpp-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--mpp-red);
  border-radius: 4px 0 0 4px;
  opacity: 0;
  transition: opacity .2s;
}

.mpp-card:hover {
  border-color: var(--mpp-red-mid);
  box-shadow: var(--mpp-shadow-lg);
  transform: translateY(-2px);
}

.mpp-card:hover::before { opacity: 1; }

.mpp-card.is-gozo::before { background: var(--mpp-gozo); }
.mpp-card.is-gozo:hover { border-color: #bfdbfe; }

/* Card top row */
.mpp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mpp-house-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mpp-ink);
  line-height: 1.3;
  flex: 1;
}

.mpp-island-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.mpp-tag-malta { background: var(--mpp-red-pale); color: var(--mpp-red); }
.mpp-tag-gozo  { background: var(--mpp-gozo-pale); color: var(--mpp-gozo); }

/* Address lines */
.mpp-address-lines {
  font-size: 0.85rem;
  color: var(--mpp-ink2);
  line-height: 1.55;
}

.mpp-street {
  font-weight: 500;
  color: var(--mpp-ink);
}

.mpp-locality {
  color: var(--mpp-muted);
  font-size: 0.8rem;
}

/* Postcode row */
.mpp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px dashed var(--mpp-border);
  margin-top: auto;
}

.mpp-postcode-badge {
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mpp-red);
  letter-spacing: .04em;
  background: var(--mpp-red-pale);
  padding: 4px 12px;
  border-radius: 6px;
}

.mpp-card.is-gozo .mpp-postcode-badge {
  color: var(--mpp-gozo);
  background: var(--mpp-gozo-pale);
}

.mpp-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border: 1.5px solid var(--mpp-border);
  border-radius: 6px;
  background: var(--mpp-white);
  color: var(--mpp-ink2);
  cursor: pointer;
  transition: all .18s;
  user-select: none;
}

.mpp-copy-btn:hover {
  border-color: var(--mpp-red);
  color: var(--mpp-red);
  background: var(--mpp-red-pale);
}

.mpp-copy-btn.copied {
  border-color: #16a34a;
  color: #16a34a;
  background: #f0fdf4;
}

.mpp-copy-btn svg { flex-shrink: 0; }

/* Flat number pill */
.mpp-flat-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ─── Animation ─── */
@keyframes mpp-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mpp-card {
  animation: mpp-fade-up .28s ease both;
}

/* stagger */
.mpp-card:nth-child(1)  { animation-delay: .03s; }
.mpp-card:nth-child(2)  { animation-delay: .06s; }
.mpp-card:nth-child(3)  { animation-delay: .09s; }
.mpp-card:nth-child(4)  { animation-delay: .12s; }
.mpp-card:nth-child(5)  { animation-delay: .15s; }
.mpp-card:nth-child(6)  { animation-delay: .18s; }
.mpp-card:nth-child(7)  { animation-delay: .21s; }
.mpp-card:nth-child(8)  { animation-delay: .24s; }
.mpp-card:nth-child(n+9) { animation-delay: .27s; }

/* ─── Responsive ─── */
@media (max-width: 520px) {
  .mpp-header-inner { padding: 22px 18px 20px; }
  .mpp-results { grid-template-columns: 1fr; padding: 14px; gap: 10px; }
  .mpp-search-box { padding: 14px; }
}
