
/* ============================================================
   MAP LEADS — Split Screen Lead Finder
   Mobile-first, professional dark map + clean panel
   ============================================================ */

:root {
  --indigo:   #4F46E5;
  --indigo2:  #4338CA;
  --indigo-l: #EEF2FF;
  --emerald:  #059669;
  --slate:    #1E293B;
  --body:     #475569;
  --muted:    #94A3B8;
  --border:   #E2E8F0;
  --white:    #FFFFFF;
  --bg:       #F8FAFC;
  --danger:   #DC2626;
  --amber:    #D97706;
  --shadow:   0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:0 12px 40px rgba(0,0,0,.12);
}

/* ── Layout ── */
.map-layout {
  display: flex;
  height: calc(100vh - 60px); /* full height minus topbar */
  overflow: hidden;
  position: relative;
}

/* ── Left: Map pane ── */
.map-pane {
  flex: 0 0 60%;
  position: relative;
  background: #1a1a2e;
}

#leaflet-map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ── Map overlay controls ── */
.map-search-overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 480px;
}

.map-search-bar {
  display: flex;
  gap: 8px;
  background: rgba(255,255,255,.96);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.map-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
  color: var(--slate);
  background: transparent;
  min-width: 0;
}

.map-search-bar input::placeholder { color: var(--muted); }

.map-search-btn {
  background: var(--indigo);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-search-btn:hover:not(:disabled) { background: var(--indigo2); }
.map-search-btn:disabled { opacity: .65; cursor: not-allowed; }

/* Location pill — shows clicked location */
.map-location-pill {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(30,41,59,.9);
  color: #fff;
  border-radius: 999px;
  padding: .4rem 1.1rem;
  font-size: .8rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: opacity .3s;
}

/* Click hint */
.map-hint {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(79,70,229,.85);
  color: #fff;
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .78rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  pointer-events: none;
  animation: fadeInUp .5s ease forwards;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Leaflet custom pin ── */
.custom-pin {
  position: relative;
  width: 32px;
  height: 32px;
}
.custom-pin::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  background: rgba(79,70,229,.3);
  border-radius: 50%;
  animation: pinRipple 1.5s ease-out infinite;
}
@keyframes pinRipple {
  0%   { transform: translate(-50%,-50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(2.5); opacity: 0; }
}

/* ── Right: Results pane ── */
.results-pane {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

/* Panel header */
.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}
.panel-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--slate);
  margin: 0 0 .25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.panel-subtitle {
  font-size: .78rem;
  color: var(--muted);
  margin: 0;
}

/* Search controls inside panel */
.panel-controls {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.panel-input {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .85rem;
  font-family: 'Inter', sans-serif;
  color: var(--slate);
  outline: none;
  transition: border-color .2s;
}
.panel-input:focus { border-color: var(--indigo); }
.panel-input::placeholder { color: var(--muted); }

.panel-actions { display: flex; gap: .5rem; }
.panel-btn {
  flex: 1;
  padding: .6rem;
  border: none;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}
.panel-btn-primary {
  background: var(--indigo);
  color: #fff;
}
.panel-btn-primary:hover:not(:disabled) { background: var(--indigo2); }
.panel-btn-primary:disabled { opacity: .65; cursor: not-allowed; }
.panel-btn-outline {
  background: transparent;
  color: var(--body);
  border: 1.5px solid var(--border);
}
.panel-btn-outline:hover { border-color: var(--indigo); color: var(--indigo); }

/* Results list */
.results-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.results-list::-webkit-scrollbar { width: 4px; }
.results-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Lead card */
.lead-card {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  cursor: default;
}
.lead-card:hover { background: var(--bg); }
.lead-card:last-child { border-bottom: none; }

.lead-name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--slate);
  margin: 0 0 .2rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.lead-rating {
  font-size: .72rem;
  color: var(--amber);
  font-weight: 600;
}
.lead-address {
  font-size: .75rem;
  color: var(--muted);
  margin: 0 0 .5rem;
  line-height: 1.4;
}
.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .5rem;
}
.lead-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-weight: 500;
}
.lead-pill-phone { background: #ECFDF5; color: var(--emerald); }
.lead-pill-web   { background: var(--indigo-l); color: var(--indigo); }
.lead-pill-email { background: #FFFBEB; color: var(--amber); }
.lead-pill-none  { background: var(--bg); color: var(--muted); }

.lead-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.lead-action-btn {
  font-size: .72rem;
  padding: .25rem .65rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.btn-scrape {
  background: var(--indigo-l);
  color: var(--indigo);
}
.btn-scrape:hover { background: var(--indigo); color: #fff; }
.btn-scrape:disabled { opacity: .5; cursor: not-allowed; }
.btn-ai {
  background: #F5F3FF;
  color: #7C3AED;
}
.btn-ai:hover { background: #7C3AED; color: #fff; }
.btn-ai:disabled { opacity: .5; cursor: not-allowed; }

/* Empty / loading states */
.panel-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.panel-empty-icon {
  font-size: 3rem;
  opacity: .2;
  margin-bottom: 1rem;
}
.panel-empty h4 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--body);
  margin-bottom: .5rem;
}
.panel-empty p { font-size: .82rem; line-height: 1.6; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-short { width: 60%; }
.skeleton-medium { width: 80%; }
.skeleton-long { width: 95%; }

/* Panel footer — export bar */
.panel-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.export-btn {
  flex: 1;
  min-width: 80px;
  padding: .5rem .5rem;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--body);
  font-family: 'Inter', sans-serif;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}
.export-btn:hover { border-color: var(--indigo); color: var(--indigo); }

/* AI email modal */
.ai-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ai-modal {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.ai-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ai-modal-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate);
  margin: 0;
}
.ai-modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.ai-modal-body { padding: 1.5rem; }
.ai-subject {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ai-subject strong { color: var(--slate); }
.ai-body-text {
  font-size: .88rem;
  color: var(--body);
  line-height: 1.8;
  white-space: pre-wrap;
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border);
}
.ai-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .75rem;
}
.ai-copy-btn {
  flex: 1;
  padding: .65rem;
  background: var(--indigo);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.ai-compose-btn {
  flex: 1;
  padding: .65rem;
  background: var(--emerald);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

/* Spinner */
.spin {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spin-dark {
  border-color: rgba(79,70,229,.2);
  border-top-color: var(--indigo);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .map-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 60px);
  }
  .map-pane {
    flex: none;
    height: 42vh;
    min-height: 280px;
  }
  .results-pane {
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--border);
    min-height: 50vh;
  }
  .map-search-overlay { top: 12px; }
}

/* Leaflet attribution — required legally, style it smaller */
.leaflet-control-attribution {
  font-size: 10px !important;
  opacity: 0.7;
  background: rgba(255,255,255,0.8) !important;
}


