:root {
  --brand-pink: #fe0383;
  --brand-pink-dark: #d40270;
  --brand-pink-soft: rgba(254, 3, 131, 0.1);
  --brand-dark: #2c0519;
  --brand-gray: #3e3e3e;
  --brand-gray-light: #707070;
  --brand-border: #ececec;
  --volunteer-color: #0f6fb0;
  --elderly-color: var(--brand-pink);
}

.hidden { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: 'Rubik', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--brand-dark);
}

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid var(--brand-border);
  color: var(--brand-dark);
  flex-wrap: wrap;
  gap: 12px;
}

#brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
}

#brand .logo-main {
  font-weight: 800;
  font-size: 19px;
  color: var(--brand-pink);
}

#brand .logo-sub {
  font-size: 11px;
  color: var(--brand-gray-light);
  font-weight: 500;
}

#stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--brand-gray);
}

.stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.volunteer { background: var(--volunteer-color); }
.dot.elderly { background: var(--elderly-color); }

#searchBox {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

#searchInput {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  background: #f9f9f9;
  color: var(--brand-dark);
}

#searchInput:focus {
  outline: none;
  border-color: var(--brand-pink);
  background: #fff;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1100;
}

.search-results.hidden { display: none; }

.search-result-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f3f3f3;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--brand-pink-soft); }

.search-result-item .sr-name { font-weight: 600; color: var(--brand-dark); }
.search-result-item .sr-meta { color: var(--brand-gray-light); font-size: 12px; }
.search-result-item .sr-nocoords { color: #b45309; font-size: 11px; }

#actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#actions button {
  padding: 9px 16px;
  border: none;
  border-radius: 999px;
  background: var(--brand-pink);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
}

#actions button:hover { background: var(--brand-pink-dark); }
#actions button:disabled { background: #d1d5db; cursor: not-allowed; }
#actions button.active { background: var(--brand-dark); }

#status {
  padding: 6px 20px;
  font-size: 13px;
  background: #faf7f8;
  color: var(--brand-gray);
  min-height: 18px;
}

#map {
  position: absolute;
  top: 106px;
  bottom: 0;
  left: 0;
  right: 0;
}

@media (min-width: 900px) {
  #map { top: 52px; }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(44, 5, 25, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden { display: none; }

.modal-box {
  background: #fff;
  padding: 24px;
  border-radius: 14px;
  width: 90%;
  max-width: 420px;
}

.modal-box h2 { margin-top: 0; color: var(--brand-dark); }

.modal-box label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--brand-gray);
}

.modal-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.modal-box button {
  margin-top: 18px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 999px;
  background: var(--brand-pink);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.modal-box button:hover { background: var(--brand-pink-dark); }

.error {
  color: #b91c1c;
  font-size: 13px;
  min-height: 16px;
}

.login-box {
  text-align: center;
}

.login-box .logo-main {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-pink);
  margin-bottom: 6px;
}

.login-box p {
  color: var(--brand-gray);
  font-size: 14px;
}

#googleSignInBtn {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.panel {
  position: absolute;
  top: 106px;
  bottom: 0;
  width: 340px;
  max-width: 100%;
  background: #fff;
  z-index: 900;
  display: flex;
  flex-direction: column;
}

/* RTL layout: "start" = visual right, "end" = visual left */
.panel-start {
  right: 0;
  box-shadow: -2px 0 8px rgba(0,0,0,0.12);
}

.panel-end {
  left: 0;
  box-shadow: 2px 0 8px rgba(0,0,0,0.12);
}

@media (min-width: 900px) {
  .panel { top: 52px; }
}

.panel.hidden { display: none; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--brand-border);
}

.panel-header h2 {
  margin: 0;
  font-size: 15px;
  color: var(--brand-dark);
}

.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--brand-gray-light);
}

#missingList {
  overflow-y: auto;
  padding: 8px 12px;
  flex: 1;
}

.entry-card {
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.entry-card .entry-name {
  font-weight: 600;
  font-size: 14px;
}

.entry-card .entry-label {
  display: inline-block;
  font-size: 11px;
  color: var(--brand-gray-light);
  margin-left: 6px;
}

.entry-card .entry-address-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: 13px;
  font-family: inherit;
  color: var(--brand-gray);
  margin: 6px 0 8px;
  padding: 5px 8px;
  border: 1px solid var(--brand-border);
  border-radius: 6px;
}

.entry-card .entry-address-input:focus {
  outline: none;
  border-color: var(--brand-pink);
  color: var(--brand-dark);
}

.entry-latlng-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.entry-card .entry-lat-input,
.entry-card .entry-lng-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  font-size: 12px;
  font-family: inherit;
  color: var(--brand-gray);
  padding: 5px 8px;
  border: 1px solid var(--brand-border);
  border-radius: 6px;
  direction: ltr;
  text-align: right;
}

.entry-card .entry-lat-input:focus,
.entry-card .entry-lng-input:focus {
  outline: none;
  border-color: var(--brand-pink);
  color: var(--brand-dark);
}

.entry-card .show-on-map-btn {
  display: block;
  width: 100%;
  padding: 5px 0;
  margin-bottom: 8px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #faf7f8;
  color: var(--brand-gray);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}

.entry-card .show-on-map-btn:hover { background: var(--brand-pink-soft); }

.entry-card .entry-result {
  font-size: 12px;
  color: #065f46;
  background: #ecfdf5;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.entry-card .entry-warning {
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.entry-card .entry-actions {
  display: flex;
  gap: 8px;
}

.entry-card button {
  flex: 1;
  padding: 7px 0;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.entry-card .discover-btn { background: var(--brand-pink); color: #fff; }
.entry-card .save-btn { background: #16a34a; color: #fff; }
.entry-card .discard-btn { background: #f0f0f0; color: var(--brand-gray); }
.entry-card button:disabled { background: #d1d5db; color: #6b7280; cursor: not-allowed; }
.entry-card.saved { opacity: 0.55; }

#filtersBody {
  overflow-y: auto;
  padding: 8px 16px 16px;
  flex: 1;
}

.filter-showing {
  font-size: 13px;
  color: var(--brand-gray);
  margin: 4px 0 10px;
}

.clear-filters-btn {
  width: 100%;
  padding: 7px 0;
  margin-bottom: 12px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #faf7f8;
  color: var(--brand-gray);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.clear-filters-btn:hover { background: var(--brand-pink-soft); }

#filtersPanel {
  width: 620px;
}

.filter-type-columns {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.filter-type-group {
  flex: 1;
  min-width: 0;
}

.filter-type-group:not(:first-child) {
  border-inline-start: 1px solid var(--brand-border);
  padding-inline-start: 16px;
}

@media (max-width: 700px) {
  .filter-type-columns { flex-direction: column; }
  .filter-type-group:not(:first-child) {
    border-inline-start: none;
    padding-inline-start: 0;
    border-top: 1px solid var(--brand-border);
    padding-top: 16px;
  }
}

.filter-type-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--brand-dark);
}

.filter-section {
  margin-bottom: 16px;
}

.filter-section h3 {
  font-size: 13px;
  margin: 0 0 6px;
  color: var(--brand-dark);
}

.filter-section h3 .hint {
  font-weight: normal;
  font-size: 11px;
  color: var(--brand-gray-light);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--brand-gray);
  cursor: pointer;
}

.filter-option .count {
  color: #9ca3af;
  font-size: 12px;
}

.popup-table {
  font-size: 13px;
  line-height: 1.5;
  font-family: 'Rubik', inherit;
}

.popup-table b { color: var(--brand-dark); }

.popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.popup-actions button, .popup-actions a {
  flex: 1;
  text-align: center;
  padding: 6px 0;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #faf7f8;
  color: var(--brand-dark);
  font-size: 11px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.popup-actions button:hover, .popup-actions a:hover { background: var(--brand-pink-soft); }

.popup-actions .proximity-link { background: var(--brand-pink); color: #fff; border-color: var(--brand-pink); }
.popup-actions .proximity-link:hover { background: var(--brand-pink-dark); }

/* --- Proximity panel --- */

.proximity-hint {
  font-size: 13px;
  color: var(--brand-gray);
  padding: 12px 16px;
  margin: 0;
}

.proximity-controls {
  padding: 0 16px 8px;
  font-size: 13px;
  color: var(--brand-gray);
}

.proximity-controls.hidden { display: none; }

.proximity-controls select {
  font-family: inherit;
  border: 1px solid var(--brand-border);
  border-radius: 6px;
  padding: 3px 6px;
}

#proximityList {
  overflow-y: auto;
  padding: 8px 12px;
  flex: 1;
}

.proximity-origin-card {
  border: 1px solid var(--brand-pink);
  background: var(--brand-pink-soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.proximity-result {
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.proximity-result:hover { border-color: var(--brand-pink); }

.proximity-result .pr-distance {
  float: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-pink);
}
