/* ── discover.css — shared styles for discover page and council landing pages ── */

body { background: #f5f6fa; }

.discover-wrapper {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 60px);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ── Sidebar ── */
.discover-sidebar {
  width: 260px;
  flex-shrink: 0;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.discover-sidebar h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #888;
  margin: 0 0 16px;
}

.filter-group { margin-bottom: 18px; }

.filter-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 5px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d5e0;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  color: #333;
  outline: none;
  transition: border-color .15s;
}

.filter-group input:focus,
.filter-group select:focus { border-color: #5c6bc0; }

.btn-apply {
  width: 100%;
  padding: 10px;
  background: #5c6bc0;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background .15s;
}
.btn-apply:hover { background: #3f51b5; }

.btn-clear {
  width: 100%;
  padding: 8px;
  background: none;
  color: #888;
  border: 1px solid #d0d5e0;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  margin-top: 6px;
  transition: color .15s, border-color .15s;
}
.btn-clear:hover { color: #333; border-color: #999; }

/* ── Main ── */
.discover-main {
  flex: 1;
  padding: 20px 0 20px 24px;
  min-width: 0;
}

.discover-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.discover-count {
  font-size: 0.9rem;
  color: #666;
}
.discover-count strong { color: #222; }

.view-toggle {
  display: flex;
  gap: 6px;
}

.view-btn {
  padding: 7px 16px;
  border: 1px solid #d0d5e0;
  border-radius: 6px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: #555;
  transition: all .15s;
}
.view-btn.active {
  background: #5c6bc0;
  color: #fff;
  border-color: #5c6bc0;
}

/* ── Cards ── */
#cards-container { display: flex; flex-direction: column; gap: 12px; }

.discover-card {
  background: #fff;
  border: 1px solid #e0e3ef;
  border-radius: 10px;
  padding: 0;
  display: flex;
  transition: box-shadow .15s;
}
.discover-card:hover { box-shadow: 0 4px 16px rgba(92,107,192,.12); }

.card-image-wrap {
  width: 120px;
  min-height: 110px;
  flex-shrink: 0;
  overflow: hidden;
  background: #e8eaf0;
  border-radius: 10px 0 0 10px;
}
.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-image-placeholder {
  width: 120px;
  min-height: 110px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #ccc;
  background: #f0f2f8;
  border-radius: 10px 0 0 10px;
}

.card-body {
  flex: 1;
  padding: 12px 16px;
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-type {
  font-size: 0.75rem;
  font-weight: 600;
  color: #5c6bc0;
  background: #eef0fb;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.card-badges { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.freshness-new {
  font-size: 0.72rem; font-weight: 700;
  background: #e8f5e9; color: #2e7d32;
  padding: 2px 8px; border-radius: 20px;
}
.freshness-recent {
  font-size: 0.72rem; font-weight: 700;
  background: #e3f2fd; color: #1565c0;
  padding: 2px 8px; border-radius: 20px;
}

.card-address {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 3px;
  line-height: 1.3;
}

.card-council {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 8px;
}
.card-council span { color: #5c6bc0; font-weight: 600; }
.card-applicant {
  font-size: 0.78rem; color: #5c6bc0; font-weight: 600;
  margin: 2px 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-view-count { font-size: 0.75rem; color: #bbb; margin-left: 4px; }
.action-count {
  font-size: 0.72rem; font-weight: 700; color: #888;
  background: #f0f2f8; border-radius: 10px; padding: 1px 5px; margin-left: 2px;
}
.contact-quota {
  font-size: 0.68rem; font-weight: 600; background: #e8f0fe;
  color: #3949ab; border-radius: 8px; padding: 1px 5px; margin-left: 3px;
}
.contact-quota-out { background: #fff3e0; color: #e65100; }

.card-summary {
  font-size: 0.75rem;
  color: #7e57c2;
  font-weight: 600;
  margin-bottom: 5px;
  text-transform: capitalize;
}

.card-description {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
  cursor: pointer;
  transition: -webkit-line-clamp 0s;
}
.card-description.expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #f0f2f8;
  padding-top: 8px;
  margin-top: 4px;
}

.card-date { font-size: 0.78rem; color: #aaa; flex-shrink: 0; }

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #5c6bc0;
  text-decoration: none;
  transition: color .15s;
}
.card-link:hover { color: #3f51b5; text-decoration: underline; }

/* ── Map ── */
#discover-map {
  display: none;
  height: calc(100vh - 120px);
  min-height: 500px;
  border-radius: 10px;
  border: 1px solid #e0e3ef;
}

/* ── Pagination ── */
#discover-pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid #d0d5e0;
  border-radius: 6px;
  background: #fff;
  font-size: 0.82rem;
  cursor: pointer;
  color: #444;
  transition: all .15s;
}
.page-btn:hover:not(:disabled) { background: #eef0fb; border-color: #5c6bc0; }
.page-btn.active { background: #5c6bc0; color: #fff; border-color: #5c6bc0; font-weight: 700; }
.page-btn:disabled { opacity: .4; cursor: default; }

.page-info { font-size: 0.78rem; color: #aaa; margin-left: 8px; }

/* status badges reuse existing styles */
.status-badge {
  font-size: 0.72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
}
.status-permitted, .status-approved {
  background: #e8f5e9; color: #2e7d32;
}
.status-refused, .status-rejected {
  background: #ffebee; color: #c62828;
}
.status-pending {
  background: #e3f2fd; color: #1565c0;
}
.status-other {
  background: #f5f5f5; color: #555;
}

/* Lead score badges */
.lead-score {
  font-size: 0.72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  white-space: nowrap;
}
.lead-score-hot    { background: #fff3e0; color: #e65100; }
.lead-score-strong { background: #e8eaf6; color: #283593; }
.lead-score-warm   { background: #f3e5f5; color: #6a1b9a; }

.contact-dot { color: #888; font-size: 0.75rem; font-weight: 600; }
.pro-contact  { color: #2e7d32; background: #f1f8e9; border-radius: 10px; padding: 1px 7px; }

/* Contact available badge (in card badges row) */
.contact-avail-badge {
  display: inline-block;
  background: #e8f5e9; color: #2e7d32;
  border-radius: 10px; padding: 2px 8px;
  font-size: 0.7rem; font-weight: 700;
  white-space: nowrap; cursor: default;
}

/* Contact lookup button */
.contact-lookup-btn {
  padding: 4px 10px; border: 1px solid #c8d0f0; border-radius: 6px;
  background: #f5f7ff; color: #3949ab; font-size: 0.76rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.contact-lookup-btn:hover { background: #e8ecff; }
.contact-lookup-btn.locked { color: #aaa; border-color: #e0e0e0; background: #fafafa; cursor: pointer; }
.contact-lookup-btn:disabled { opacity: .6; cursor: wait; }

/* Companies House contact panel */
.contact-panel { border-top: 1px solid #eef0f8; }
.contact-panel-inner {
  padding: 12px 16px 14px;
  background: #f9faff;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Community saved-by badge */
.community-badge {
  font-size: 0.7rem; font-weight: 600;
  background: #e3f2fd; color: #1565c0;
  padding: 2px 8px; border-radius: 12px;
  white-space: nowrap;
}

/* View count chip */
.view-count {
  font-size: 0.72rem; color: #aaa;
  display: flex; align-items: center; gap: 3px;
}

/* Commercial / residential classification chip */
.classify-chip {
  display: inline-block;
  font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  white-space: nowrap; width: fit-content;
}
.classify-commercial { background: #e3f2fd; color: #1565c0; }
.classify-residential { background: #fce4ec; color: #ad1457; }
.classify-mixed       { background: #f3e5f5; color: #6a1b9a; }

/* Lead score badge, clickable */
.lead-score { cursor: pointer; }
.lead-score:hover { opacity: .85; }

/* Why score breakdown tooltip */
.score-breakdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 200;
  background: #fff;
  border: 1px solid #d8dcf5;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(92,107,192,.18);
  padding: 12px 14px;
  min-width: 220px;
  font-size: 0.78rem;
  color: #333;
}
.score-breakdown.open { display: block; }
.score-breakdown-title {
  font-weight: 700; color: #3949ab; margin-bottom: 8px; font-size: 0.8rem;
}
.score-breakdown-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; border-bottom: 1px solid #f0f2f8;
  gap: 12px;
}
.score-breakdown-row:last-child { border-bottom: none; }
.score-pts { font-weight: 700; color: #5c6bc0; white-space: nowrap; }
.score-pts.zero { color: #bbb; }
.score-breakdown-total {
  margin-top: 8px; padding-top: 6px; border-top: 2px solid #e8eaf6;
  font-weight: 700; font-size: 0.8rem; color: #1a1a2e;
  display: flex; justify-content: space-between;
}
.score-breakdown-divider {
  margin-top: 10px; padding-top: 8px; border-top: 1px dashed #d8dcf5;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #aaa;
}
.score-breakdown-fit {
  font-size: 0.75rem; margin-top: 3px; padding: 3px 6px;
  border-radius: 4px; background: #f5f7ff; color: #3949ab; font-weight: 600;
}

/* Feedback buttons, inline in card footer */
.feedback-btn {
  background: none; border: 1px solid #e0e3ef; border-radius: 6px;
  padding: 2px 7px; font-size: 0.78rem;
  cursor: pointer; transition: all .15s; color: #bbb; line-height: 1.4;
}
.feedback-btn:hover { border-color: #5c6bc0; color: #3949ab; }
.feedback-btn.liked      { background: #e8f5e9; border-color: #43a047; color: #2e7d32; }
.feedback-btn.disliked   { background: #ffebee; border-color: #ef5350; color: #c62828; }
.feedback-btn.bookmarked { background: #fff8e1; border-color: #f9a825; color: #e65100; }

/* Collapsed / hidden card strip */
.card-hidden-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  gap: 12px;
  font-size: 0.82rem;
  color: #aaa;
  font-style: italic;
}
.card-undo-btn {
  background: none;
  border: 1px solid #d0d4e8;
  border-radius: 5px;
  padding: 3px 11px;
  cursor: pointer;
  font-size: 0.8rem;
  font-style: normal;
  color: #666;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
}
.card-undo-btn:hover { border-color: #5c6bc0; color: #3949ab; }

/* Undo toast */
#ll-undo-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.83rem;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  white-space: nowrap;
  animation: toast-in .18s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#ll-undo-toast .toast-undo {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff; border-radius: 4px;
  padding: 3px 12px; font-size: 0.8rem;
  cursor: pointer; transition: background .15s;
}
#ll-undo-toast .toast-undo:hover { background: rgba(255,255,255,0.28); }
#ll-undo-toast .toast-close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 1rem; cursor: pointer; padding: 0 2px; line-height: 1;
}
#ll-undo-toast .toast-close:hover { color: #fff; }

/* ── Mobile filter toggle button ── */
.filter-toggle-btn {
  display: none;
}

@media (max-width: 768px) {
  .discover-wrapper { flex-direction: column; padding: 0 10px 30px; }

  .filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #d0d5e0;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #5c6bc0;
    cursor: pointer;
    margin: 12px 0 4px;
  }

  .discover-sidebar {
    width: 100%;
    height: 0;
    overflow: hidden;
    position: relative;
    padding: 0;
    transition: height 0.2s ease;
  }
  .discover-sidebar.open {
    height: auto;
    padding: 12px 0 4px;
  }

  .discover-main { padding: 0; }
  #discover-map { height: 300px; }

  /* Stack toolbar on mobile */
  .discover-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .discover-toolbar > div:last-child {
    width: 100%;
    flex-wrap: wrap;
  }
  #sort-select, #filter-keyword {
    font-size: 16px; /* prevent iOS zoom on focus */
  }
}

/* ── Skeleton loading cards ── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton-card {
  pointer-events: none;
}
.sk-line {
  border-radius: 6px;
  background: linear-gradient(90deg, #e8eaf0 25%, #f4f5fa 50%, #e8eaf0 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  margin-bottom: 10px;
}
.sk-title  { height: 16px; width: 65%; }
.sk-meta   { height: 12px; width: 40%; }
.sk-body   { height: 12px; width: 100%; }
.sk-short  { width: 75%; }
.sk-chips  { display: flex; gap: 8px; margin-top: 4px; }
.sk-chip   { height: 22px; width: 72px; border-radius: 20px;
             background: linear-gradient(90deg, #e8eaf0 25%, #f4f5fa 50%, #e8eaf0 75%);
             background-size: 600px 100%;
             animation: shimmer 1.4s infinite linear; }
body.dark-mode .sk-line,
body.dark-mode .sk-chip {
  background: linear-gradient(90deg, #2a2d45 25%, #33374f 50%, #2a2d45 75%);
  background-size: 600px 100%;
}

/* ── Council landing page header (static, above the discover wrapper) ── */
.council-page-header {
  background: #fff;
  border-bottom: 1px solid #e0e3ef;
  padding: 14px 0 12px;
}
.council-page-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}
.council-breadcrumb {
  font-size: 0.78rem;
  color: #aaa;
  margin-bottom: 6px;
}
.council-breadcrumb a {
  color: #5c6bc0;
  text-decoration: none;
}
.council-breadcrumb a:hover { text-decoration: underline; }
.council-breadcrumb span { margin: 0 4px; }
.council-page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 4px;
}
.council-page-header p {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 10px;
}
.council-expand-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.council-expand-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #5c6bc0;
  background: #f0f2fb;
  color: #3949ab;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.council-expand-pill:hover {
  background: #e8ecfb;
  box-shadow: 0 1px 4px rgba(92,107,192,.18);
}
.council-expand-pill.pill-neutral {
  border-color: #d0d5e0;
  background: #fff;
  color: #555;
}
.council-expand-pill.pill-neutral:hover {
  border-color: #5c6bc0;
  color: #3949ab;
  background: #f5f7ff;
}

@media (max-width: 768px) {
  .council-page-header h1 { font-size: 1.15rem; }
}

/* ── Cost guesstimate chip (feed cards) ───────────────────────────────────── */
.cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 6px 0 2px;
  padding: 4px 10px 4px 8px;
  background: #f0faf4;
  border: 1px solid #a5d6b7;
  border-radius: 14px;
  font-size: 0.78rem;
  color: #1b5e20;
  cursor: default;
  user-select: none;
}
.cost-chip strong { color: #1b5e20; }
.cost-chip-label {
  color: #2e7d32;
  font-weight: 500;
  font-size: 0.76rem;
}
.cost-chip-conf {
  font-size: 0.67rem;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cost-chip-conf--high   { background: #c8e6c9; color: #2e7d32; }
.cost-chip-conf--medium { background: #fff9c4; color: #f57f17; }
.cost-chip-conf--low    { background: #fce4ec; color: #c62828; }

/* dark mode */
body.dark-mode .cost-chip {
  background: #0d2b18 !important;
  border-color: #2e7d32 !important;
  color: #a5d6b7 !important;
}
body.dark-mode .cost-chip strong { color: #81c784 !important; }
