/* =========================================================
   Curitibinho - Design System
   Georreferenciamento Histórico de Curitiba
   ========================================================= */

:root {
  --geo-green: #1c5e3f;
  --geo-green-dark: #123f2a;
  --geo-orange: #e8552e;
  --geo-orange-dark: #c9431f;
  --geo-bg: #f4f6f5;
  --geo-text: #222831;
  --geo-muted: #6b7280;
  --geo-border: #e5e7eb;
  --geo-radius: 10px;
  --geo-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  --geo-topbar-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--geo-text);
  background: var(--geo-bg);
  overscroll-behavior: none;
}

button { font-family: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- App shell ---------- */
.geo-app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

.geo-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 900;
}
.geo-backdrop.is-open { display: block; }

/* ---------- Sidebar ---------- */
.geo-sidebar {
  width: 320px;
  min-width: 320px;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--geo-border);
  z-index: 950;
}

.geo-sidebar__header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--geo-border);
}
.geo-sidebar__header img { height: 42px; }
.geo-sidebar__close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--geo-muted);
  cursor: pointer;
  padding: 6px;
}

.geo-sidebar__search { padding: 12px 16px 4px; }
.geo-search-input-wrap { position: relative; }
.geo-search-input-wrap i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--geo-muted); font-size: 14px;
}
.geo-search-input {
  width: 100%;
  padding: 10px 12px 10px 34px;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  outline: none;
}
.geo-search-input:focus { border-color: var(--geo-green); }

.geo-sidebar__count {
  padding: 10px 16px 6px;
  font-size: 13px;
  color: var(--geo-muted);
}

.geo-point-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 16px;
}
.geo-point-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f2f2f2;
}
.geo-point-item:hover { background: #f7f8f7; }
.geo-point-item__num {
  font-weight: 700;
  color: var(--geo-orange);
  font-size: 13px;
  min-width: 22px;
}
.geo-point-item__body { flex: 1; min-width: 0; }
.geo-point-item__title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.geo-point-item__title .geo-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.geo-point-item__meta {
  font-size: 12px;
  color: var(--geo-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.geo-empty-state {
  padding: 24px 16px;
  color: var(--geo-muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- Main / map area ---------- */
.geo-main {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.geo-topbar {
  background: linear-gradient(180deg, var(--geo-green) 0%, var(--geo-green-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  flex-wrap: wrap;
  z-index: 1000;
  position: relative;
  min-height: var(--geo-topbar-h);
}

.geo-topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.geo-topbar__brand i { font-size: 18px; }

.geo-sidebar__toggle,
.geo-topbar__icon-btn {
  display: none;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

.geo-topbar__spacer { flex: 1; }

.geo-pill-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.geo-pill-btn:hover { background: rgba(255, 255, 255, 0.26); }
.geo-pill-btn.is-active { background: rgba(255, 255, 255, 0.32); border-color: #fff; }
.geo-pill-btn__badge {
  background: rgba(0, 0, 0, 0.28);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
}
.geo-pill-btn--primary {
  background: var(--geo-orange);
  border-color: var(--geo-orange);
  font-weight: 600;
}
.geo-pill-btn--primary:hover { background: var(--geo-orange-dark); }
.geo-pill-btn--outline-plain { background: transparent; }

/* ---------- Dropdown panels (Filtrar / Bairros / Categorias) ---------- */
.geo-dropdown {
  position: absolute;
  top: calc(var(--geo-topbar-h) + 4px);
  right: 16px;
  background: #fff;
  border-radius: var(--geo-radius);
  box-shadow: var(--geo-shadow);
  width: 320px;
  max-height: min(70vh, 520px);
  overflow: auto;
  z-index: 1100;
  color: var(--geo-text);
  display: none;
}
.geo-dropdown.is-open { display: block; }
.geo-dropdown__header {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 1px solid var(--geo-border);
  position: sticky;
  top: 0;
  background: #fff;
}
.geo-dropdown__toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}
.geo-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
}
.geo-toggle-btn--active { background: #e8f5e9; border-color: var(--geo-green); color: var(--geo-green); }
.geo-dropdown__list { padding: 4px 0 10px; }
.geo-dropdown__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
}
.geo-dropdown__row .geo-swatch {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.geo-dropdown__row .geo-row-icon {
  width: 20px; text-align: center; flex-shrink: 0;
}
.geo-dropdown__row .geo-row-label { flex: 1; font-size: 13.5px; }
.geo-checkbox { width: 18px; height: 18px; accent-color: var(--geo-green); cursor: pointer; }
.geo-row-trash {
  background: none; border: none; color: #d33; cursor: pointer; font-size: 14px; padding: 4px;
}
.geo-dropdown__empty { padding: 16px; color: var(--geo-muted); font-size: 13px; text-align: center; }

/* ---------- Map ---------- */
.geo-map-container { flex: 1; position: relative; }
#map { position: absolute; inset: 0; background: #dfe7e2; }

.geo-tooltip { font-size: 12px; font-weight: 600; }

.geo-pin-wrapper { background: transparent; border: none; }
.geo-pin {
  width: 32px; height: 32px;
  transform: rotate(-45deg);
  border-radius: 50% 50% 50% 0;
  background: var(--pin-color, #3388ff);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.geo-pin__icon {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  transform: rotate(45deg);
  color: #fff; font-size: 13px;
}

/* ---------- Popup ---------- */
.leaflet-popup-content-wrapper { border-radius: 12px; }
.geo-popup { min-width: 220px; max-width: 260px; }
.geo-popup__title { margin: 0 0 6px; font-size: 15px; font-weight: 700; line-height: 1.3; }
.geo-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--badge-color, #666);
  color: #fff; padding: 4px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; margin-bottom: 8px;
}
.geo-popup__address { font-size: 12.5px; color: #555; margin: 4px 0; display: flex; gap: 6px; align-items: flex-start; }
.geo-popup__desc { font-size: 13px; color: #444; margin: 6px 0; line-height: 1.4; }
.geo-popup-media-row { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.geo-popup-media { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
.geo-popup-media--video {
  display: flex; align-items: center; justify-content: center;
  background: #222; color: #fff; font-size: 20px; width: 60px; height: 60px; border-radius: 6px;
}
.geo-popup__links {
  list-style: none; margin: 8px 0 0; padding: 8px 0 0;
  border-top: 1px solid var(--geo-border); font-size: 12.5px;
}
.geo-popup__links li { margin: 3px 0; }
.geo-popup__links a {
  color: var(--geo-green); text-decoration: none;
  display: flex; gap: 6px; align-items: center; min-width: 0;
}
.geo-popup__links a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-popup__links a:hover { text-decoration: underline; }
.geo-popup__share { display: flex; gap: 8px; margin-top: 10px; }
.geo-icon-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer; font-size: 14px;
}
.geo-icon-btn--whatsapp { background: #25d366; }
.geo-icon-btn--facebook { background: #1877f2; }
.geo-icon-btn--copy { background: #6b7280; }
.geo-icon-btn--native { background: #374151; }
.geo-popup__admin-actions { display: flex; gap: 8px; margin-top: 12px; }

.geo-btn {
  padding: 8px 14px; border-radius: 7px; border: 1px solid #d1d5db;
  background: #fff; cursor: pointer; font-size: 13px; font-weight: 600;
}
.geo-btn--ghost { background: #f3f4f6; }
.geo-btn--danger { background: #e53935; color: #fff; border-color: #e53935; }
.geo-btn--primary { background: var(--geo-orange); color: #fff; border-color: var(--geo-orange); }
.geo-btn--primary:hover { background: var(--geo-orange-dark); }
.geo-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Modal (admin forms) ---------- */
.geo-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; padding: 16px;
}
.geo-modal-backdrop.is-open { display: flex; }
.geo-modal {
  background: #fff; border-radius: 14px; max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 22px;
}
.geo-modal__title { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.geo-modal__subtitle { margin: 0 0 16px; font-size: 13px; color: var(--geo-muted); }
.geo-field { margin-bottom: 14px; }
.geo-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #333; }
.geo-field input[type='text'],
.geo-field input[type='search'],
.geo-field input[type='color'],
.geo-field textarea,
.geo-field select {
  width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 7px;
  font-size: 14px; font-family: inherit;
}
.geo-field textarea { min-height: 80px; resize: vertical; }
.geo-field small { color: var(--geo-muted); font-size: 12px; }
.geo-field-row { display: flex; gap: 10px; }
.geo-field-row .geo-field { flex: 1; }
.geo-field-inline-btn { display: flex; gap: 8px; }
.geo-field-inline-btn input { flex: 1; }
.geo-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.geo-modal__close {
  position: sticky; top: 0; float: right; background: none; border: none;
  font-size: 20px; color: var(--geo-muted); cursor: pointer;
}

.geo-media-upload {
  border: 2px dashed #cbd5c8; border-radius: 8px; padding: 16px; text-align: center;
  cursor: pointer; font-size: 13px; color: var(--geo-muted); background: #fafbfa;
}
.geo-media-upload:hover { border-color: var(--geo-green); color: var(--geo-green); }
.geo-media-upload i { font-size: 20px; display: block; margin-bottom: 6px; }
.geo-media-preview-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.geo-media-preview { position: relative; width: 68px; height: 68px; border-radius: 7px; overflow: hidden; background: #000; }
.geo-media-preview img, .geo-media-preview video { width: 100%; height: 100%; object-fit: cover; }
.geo-media-preview__remove {
  position: absolute; top: 2px; right: 2px; background: rgba(0, 0, 0, 0.65); color: #fff;
  border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; cursor: pointer; line-height: 1;
}
.geo-map-picker {
  height: 220px; border-radius: 8px; overflow: hidden; border: 1px solid var(--geo-border); margin-top: 8px;
}

/* Seletor visual de ícone (categorias) */
.geo-icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px;
  max-height: 184px; overflow-y: auto; padding: 6px;
  border: 1px solid #d1d5db; border-radius: 7px; background: #fff;
}
.geo-icon-pick {
  height: 40px; border: 1px solid #e5e7eb; border-radius: 7px; background: #fff;
  cursor: pointer; font-size: 16px; color: #374151;
  display: flex; align-items: center; justify-content: center;
}
.geo-icon-pick:hover { border-color: var(--geo-green); color: var(--geo-green); }
.geo-icon-pick.is-selected { background: var(--geo-green); border-color: var(--geo-green); color: #fff; }
.geo-icon-custom { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.geo-icon-custom input { flex: 1; }
.geo-icon-preview {
  width: 36px; height: 36px; border-radius: 50%; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Links de referência (form do ponto) */
.geo-link-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.geo-link-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border: 1px solid var(--geo-border); border-radius: 7px; background: #fafbfa; font-size: 13px;
}
.geo-link-row > i { color: var(--geo-green); flex-shrink: 0; }
.geo-link-row__body { flex: 1; min-width: 0; }
.geo-link-row__label { font-weight: 600; }
.geo-link-row__url {
  color: var(--geo-muted); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Login (admin) ---------- */
.geo-login {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--geo-green) 0%, var(--geo-green-dark) 100%);
  padding: 20px;
}
.geo-login__card {
  background: #fff; border-radius: 16px; padding: 32px 28px; max-width: 380px; width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); text-align: center;
}
.geo-login__card img { height: 68px; margin: 0 auto 18px; }
.geo-login__card h1 { font-size: 18px; margin: 0 0 6px; }
.geo-login__card p { font-size: 13px; color: var(--geo-muted); margin: 0 0 20px; }
.geo-login__error { color: #d33; font-size: 13px; margin-top: 8px; min-height: 18px; }

.geo-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 18px; border-radius: 24px;
  font-size: 13.5px; z-index: 3000; box-shadow: var(--geo-shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.geo-toast.is-visible { opacity: 1; }

/* =========================================================
   Mobile optimizations
   ========================================================= */
@media (max-width: 860px) {
  .geo-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 86vw;
    max-width: 340px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.3);
  }
  .geo-sidebar.is-open { transform: translateX(0); }
  .geo-sidebar__close { display: block; }
  .geo-sidebar__toggle { display: inline-flex; }

  .geo-topbar { padding: 8px 10px; gap: 6px; --geo-topbar-h: 54px; }
  .geo-pill-btn { padding: 7px 10px; font-size: 12px; }
  .geo-pill-label { display: none; }
  .geo-pill-btn--primary .geo-pill-label { display: inline; }
  .geo-pill-btn--primary { padding: 7px 12px; }

  .geo-dropdown { left: 8px; right: 8px; width: auto; }

  .geo-popup { max-width: 220px; }
}

@media (max-width: 420px) {
  .geo-pill-btn--primary .geo-pill-label { display: none; }
}

/* Leaflet control tweaks for touch */
.leaflet-touch .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; }

/* ---------- Login / usuários / visibilidade ---------- */
.geo-login__card input[type='email'],
.geo-login__card input[type='password'] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--geo-border); border-radius: 8px; font-size: 14px;
}
.geo-login__back { display: inline-block; margin-top: 14px; font-size: 12.5px; color: var(--geo-muted); text-decoration: none; }
.geo-login__back:hover { text-decoration: underline; }
.geo-field input[type='email'],
.geo-field input[type='password'] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--geo-border); border-radius: 8px; font-size: 14px;
}
.geo-check-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.geo-user-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--geo-border); }
.geo-user-row__avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--geo-green); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.geo-user-row__body { flex: 1; min-width: 0; }
.geo-user-row__name { font-size: 14px; font-weight: 600; }
.geo-user-row__meta { font-size: 12px; color: var(--geo-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-role-badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: #eef2f5; color: #333; margin-left: 6px;
}
.geo-role-badge--admin { background: #fde7d3; color: #b34700; }
.geo-role-badge--editor { background: #dcefe3; color: #1c5e3f; }
.geo-role-badge--inactive { background: #fbe1e1; color: #b3261e; }
.geo-popup__visibility { font-size: 11.5px; color: var(--geo-muted); margin: 4px 0 0; display: flex; align-items: center; gap: 5px; }
.geo-point-item__lock { color: var(--geo-muted); font-size: 11px; margin-left: 4px; }
