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

:root {
  --primary:       #10b981;
  --primary-dark:  #059669;
  --primary-light: #d1fae5;
  --primary-xlight:#ecfdf5;
  --accent:        #06b6d4;
  --dark:          #0f172a;
  --dark2:         #1e293b;
  --gray:          #64748b;
  --gray-light:    #94a3b8;
  --light:         #f8fafc;
  --border:        #e2e8f0;
  --white:         #ffffff;
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
  --shadow:        0 4px 20px rgba(0,0,0,0.09);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.14);
  --shadow-green:  0 4px 20px rgba(16,185,129,0.3);
  --radius:        16px;
  --radius-sm:     10px;
}

html, body { height: 100%; overflow: hidden; font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; }

/* ── MARKER ANIMATIONS ─────────────────────────── */
@keyframes markerPulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes pulse {
  0%,100% { transform: scale(1);   opacity: 1; }
  50%     { transform: scale(1.6); opacity: 0.4; }
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── HEADER ────────────────────────────────────── */
.header {
  height: 68px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}
.logo-link { text-decoration: none; flex-shrink: 0; display: flex; align-items: center; }
.header-center { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--light); border: 1.5px solid var(--border);
  border-radius: 50px; padding: 7px 16px; transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--primary); background: white; }
.search-bar input { border: none; background: transparent; outline: none; font-size: 0.9rem; font-family: 'Inter', sans-serif; width: 100%; color: var(--dark); }
.search-icon { font-size: 0.9rem; flex-shrink: 0; opacity: 0.5; }
.search-clear { background: none; border: none; cursor: pointer; color: var(--gray); font-size: 0.85rem; padding: 2px 4px; border-radius: 50%; transition: background 0.2s; }
.search-clear:hover { background: var(--border); }

.header-controls { display: flex; align-items: center; gap: 8px; }
.filter-pills { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.filter-pills::-webkit-scrollbar { display: none; }
.pill {
  white-space: nowrap; padding: 4px 13px; border-radius: 50px;
  border: 1.5px solid var(--border); background: white; font-size: 0.76rem;
  font-family: 'Inter', sans-serif; cursor: pointer; font-weight: 600; transition: all 0.2s;
  color: var(--gray);
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-color: transparent; box-shadow: var(--shadow-green); }

.header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-avail {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 50px; border: 1.5px solid var(--border);
  background: white; font-size: 0.76rem; font-weight: 600; cursor: pointer;
  font-family: 'Inter', sans-serif; color: var(--gray); transition: all 0.2s; white-space: nowrap;
}
.btn-avail:hover, .btn-avail.active { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }
.btn-avail.active .avail-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,0.25); }
.avail-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-light); transition: all 0.2s; }

.sort-select {
  padding: 5px 12px; border-radius: 50px; border: 1.5px solid var(--border);
  background: white; font-size: 0.76rem; font-weight: 600; cursor: pointer;
  font-family: 'Inter', sans-serif; color: var(--gray); outline: none; transition: border-color 0.2s;
}
.sort-select:focus { border-color: var(--primary); }

.btn-locate {
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border: none; border-radius: 50px; padding: 9px 18px;
  font-size: 0.82rem; font-weight: 700; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-green); flex-shrink: 0;
}
.btn-locate:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(16,185,129,0.4); }

/* ── LAYOUT ────────────────────────────────────── */
.layout { display: flex; height: calc(100vh - 68px); margin-top: 68px; position: relative; }

/* ── SIDEBAR ───────────────────────────────────── */
.sidebar {
  width: 380px; min-width: 340px; background: white;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 18px 18px 12px;
  display: flex; align-items: flex-start; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h2 { font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.count-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border-radius: 50px;
  padding: 3px 12px; font-size: 0.78rem; font-weight: 700; flex-shrink: 0;
}
.location-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78rem; color: var(--gray);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; animation: pulse 1.6s ease-in-out infinite; }

.sidebar-stats {
  display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.sidebar-stats::-webkit-scrollbar { display: none; }
.stat-chip {
  white-space: nowrap; padding: 4px 12px; border-radius: 50px;
  font-size: 0.74rem; font-weight: 600; background: var(--light);
  color: var(--gray); border: 1px solid var(--border);
}
.stat-chip.green { background: var(--primary-xlight); color: var(--primary-dark); border-color: var(--primary-light); }
.stat-chip.blue  { background: #ecfeff; color: #0891b2; border-color: #a5f3fc; }

/* ── LISTA ─────────────────────────────────────── */
.prof-list { flex: 1; overflow-y: auto; padding: 10px; }
.prof-list::-webkit-scrollbar { width: 3px; }
.prof-list::-webkit-scrollbar-track { background: transparent; }
.prof-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.prof-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid transparent; transition: all 0.2s; margin-bottom: 7px;
  background: var(--light); animation: fadeIn 0.3s ease forwards;
}
.prof-item:hover { border-color: var(--primary-light); background: white; box-shadow: var(--shadow); }
.prof-item.active { border-color: var(--primary); background: white; box-shadow: 0 4px 20px rgba(16,185,129,0.15); }

.prof-item-avatar {
  width: 50px; height: 50px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; flex-shrink: 0; box-shadow: var(--shadow-sm);
}
.prof-item-body { flex: 1; min-width: 0; }
.prof-item-name { font-size: 0.9rem; font-weight: 700; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-item-specialty { font-size: 0.75rem; color: var(--primary); font-weight: 600; margin: 2px 0; }
.prof-item-meta { display: flex; gap: 8px; font-size: 0.72rem; color: var(--gray); align-items: center; flex-wrap: wrap; }
.prof-item-bairro { font-size: 0.7rem; color: var(--gray-light); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-item-right { text-align: right; flex-shrink: 0; }
.dist-badge {
  background: linear-gradient(135deg, var(--primary-xlight), var(--primary-light));
  color: var(--primary-dark); border-radius: 50px;
  padding: 4px 10px; font-size: 0.74rem; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--primary-light);
}
.eta-text { font-size: 0.7rem; color: var(--gray-light); margin-top: 3px; }
.available-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; display: inline-block; margin-right: 3px; }
.busy-dot     { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; display: inline-block; margin-right: 3px; }

/* Badges especiais nos cards */
.badge-top {
  display: inline-block; font-size: 0.66rem; font-weight: 800;
  padding: 2px 8px; border-radius: 50px; margin-bottom: 3px;
}
.badge-nearest { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.badge-best    { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #5b21b6; }

/* ── MAP ───────────────────────────────────────── */
#map { flex: 1; z-index: 0; }

/* ── FAB MOBILE ────────────────────────────────── */
.fab-list {
  display: none; position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--dark); color: white; border: none; border-radius: 50px;
  padding: 12px 24px; font-size: 0.9rem; font-weight: 700; font-family: 'Inter', sans-serif;
  cursor: pointer; z-index: 600; box-shadow: var(--shadow-lg); gap: 8px; align-items: center;
}

/* ── MODAL ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 2000; display: none; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: white; border-radius: 24px 24px 0 0;
  padding: 0; width: 100%; max-width: 580px;
  animation: slideUp 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
  position: relative; max-height: 92vh; overflow-y: auto;
}
.modal-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 14px auto 0;
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: var(--light); border: 1px solid var(--border); border-radius: 50%;
  width: 34px; height: 34px; font-size: 0.9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--gray);
  transition: all 0.2s; z-index: 1;
}
.modal-close:hover { background: var(--border); color: var(--dark); }

/* Modal hero (cabeçalho colorido) */
.modal-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px 18px;
  background: linear-gradient(135deg, var(--primary-xlight), white);
  border-bottom: 1px solid var(--primary-light);
  margin-top: 4px;
}
.modal-avatar {
  width: 70px; height: 70px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem; flex-shrink: 0;
  box-shadow: var(--shadow);
}
.modal-hero-info { flex: 1; }
.modal-hero-info h2 { font-size: 1.15rem; font-weight: 800; color: var(--dark); }
.modal-specialty {
  display: inline-block; font-size: 0.78rem; font-weight: 700;
  color: var(--primary-dark); background: var(--primary-light);
  padding: 3px 12px; border-radius: 50px; margin: 4px 0 6px;
}
.modal-rating { font-size: 0.82rem; color: var(--gray); }
.modal-badge {
  font-size: 0.76rem; font-weight: 700;
  padding: 6px 14px; border-radius: 50px;
}
.modal-badge.available { background: #dcfce7; color: #15803d; }
.modal-badge.busy      { background: #fee2e2; color: #dc2626; }

/* Modal grid */
.modal-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  padding: 16px 24px;
}
.modal-cell {
  background: var(--light); border-radius: 14px; padding: 14px;
  display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--border);
}
.cell-icon { font-size: 1.2rem; margin-bottom: 2px; }
.modal-cell strong { font-size: 0.72rem; color: var(--gray-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.modal-cell span   { font-size: 0.95rem; font-weight: 700; color: var(--dark); }

.modal-bio {
  font-size: 0.88rem; color: var(--gray); line-height: 1.75;
  padding: 0 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-services { padding: 14px 24px; }
.modal-services-title { font-size: 0.72rem; font-weight: 800; color: var(--gray-light); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.svc-tag {
  display: inline-block; padding: 5px 14px;
  background: var(--primary-xlight); color: var(--primary-dark);
  border-radius: 50px; font-size: 0.78rem; font-weight: 600;
  margin: 3px; border: 1px solid var(--primary-light);
}

.modal-actions { display: flex; gap: 10px; padding: 0 24px 10px; }
.btn-primary-full {
  flex: 1; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border: none; border-radius: 50px; padding: 14px;
  font-size: 0.92rem; font-weight: 700; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-green);
}
.btn-primary-full:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(16,185,129,0.4); }
.btn-secondary-full {
  flex: 1; background: var(--dark); color: white;
  border: none; border-radius: 50px; padding: 14px;
  font-size: 0.92rem; font-weight: 700; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s;
}
.btn-secondary-full:hover { background: var(--dark2); }
.btn-rota {
  width: calc(100% - 48px); margin: 0 24px 24px; display: block;
  background: transparent; border: 1.5px solid var(--border); border-radius: 50px;
  padding: 12px; font-size: 0.88rem; font-weight: 600; color: var(--gray);
  font-family: 'Inter', sans-serif; cursor: pointer; transition: all 0.2s; text-align: center;
}
.btn-rota:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }

/* ── TOAST ─────────────────────────────────────── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--dark); color: white; padding: 13px 28px;
  border-radius: 50px; font-size: 0.88rem; font-weight: 600; z-index: 3000;
  transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
  white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── EMPTY STATE ───────────────────────────────── */
.empty-state { text-align: center; padding: 52px 24px; color: var(--gray); }
.empty-state .icon { font-size: 3rem; margin-bottom: 14px; }
.empty-state p { font-size: 0.92rem; }

/* ── LEAFLET OVERRIDES ─────────────────────────── */
.leaflet-tooltip {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.8rem !important; border-radius: 10px !important;
  padding: 8px 12px !important; border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-control-zoom { border: 1px solid var(--border) !important; border-radius: 10px !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a { font-family: 'Inter', sans-serif !important; }

/* ── RESPONSIVE ────────────────────────────────── */
@media (max-width: 768px) {
  .header { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .logo-link { order: 1; }
  .btn-locate { order: 2; padding: 8px 14px; font-size: 0.78rem; }
  .header-center { order: 3; width: 100%; }
  .header-controls { flex-wrap: wrap; }
  .header-actions { margin-left: auto; }

  .layout { margin-top: 116px; }
  #map { height: calc(100vh - 116px); width: 100%; }

  .sidebar {
    width: 100%; position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
    max-height: 50vh; border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    transform: translateY(calc(100% - 64px));
    box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
  }
  .sidebar.open { transform: translateY(0); }
  .sidebar-header { cursor: pointer; }
  .sidebar-header::before {
    content: ''; display: block; width: 36px; height: 4px; border-radius: 2px;
    background: var(--border); margin: 0 auto 12px; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  }

  .fab-list { display: flex; }
  .layout { flex-direction: column; }
}

@media (max-width: 480px) {
  .filter-pills { gap: 4px; }
  .pill { padding: 3px 10px; font-size: 0.72rem; }
  .btn-avail, .sort-select { display: none; }
}
