:root {
  --indigo: #6366f1;
  --indigo-dark: #4f46e5;
  --violet: #8b5cf6;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f1f8;
  --text: #1e2033;
  --text-soft: #5b5e74;
  --text-faint: #8b8fa6;
  --border: #e6e7f0;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --shadow: 0 6px 20px rgba(30, 32, 51, 0.08);
  --shadow-lg: 0 12px 40px rgba(30, 32, 51, 0.18);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151f;
    --surface: #1e2030;
    --surface-2: #272a3d;
    --text: #eceef7;
    --text-soft: #a8abc4;
    --text-faint: #777b96;
    --border: #2e3145;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.hidden { display: none !important; }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff;
  padding: calc(var(--safe-top) + 14px) 16px 12px;
  border-radius: 0 0 24px 24px;
  box-shadow: var(--shadow);
}

.app-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header__brand { display: flex; align-items: center; gap: 12px; }

.app-header__logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.app-header__title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.app-header__subtitle { margin: 2px 0 0; font-size: 13px; opacity: 0.85; }

.icon-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border: none; border-radius: 12px;
  background: rgba(255,255,255,0.18);
  color: #fff; cursor: pointer;
  transition: background .15s, transform .1s;
}
.icon-btn:active { transform: scale(0.93); }
.icon-btn.is-active { background: #fff; color: var(--indigo); }

.search {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  padding: 0 12px;
}
.search__icon { color: var(--text-faint); flex: none; }
.search input {
  flex: 1; border: none; outline: none;
  background: transparent; color: var(--text);
  font-size: 16px; padding: 11px 0;
}

.filters {
  display: flex; gap: 8px; margin-top: 12px;
  overflow-x: auto; scrollbar-width: none;
  padding-bottom: 2px;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12);
  color: #fff;
  padding: 7px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s;
}
.chip.is-active { background: #fff; color: var(--indigo); border-color: #fff; font-weight: 600; }

/* ---------- Content ---------- */
.content {
  padding: 16px 16px calc(96px + var(--safe-bottom));
  max-width: 720px; margin: 0 auto;
}

.banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px; color: var(--text-soft);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ---------- Procurar perto de mim ---------- */
.discover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.discover__head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 11px; }
.discover__title { font-weight: 700; font-size: 15px; }
.discover__sub { font-size: 12.5px; color: var(--text-soft); }
.discover__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.discover-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .1s, background .15s;
}
.discover-btn:active { transform: scale(0.96); }
.discover-btn:hover { background: var(--border); }

.list { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Card ---------- */
.card {
  display: flex; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s, box-shadow .15s;
}
.card:active { transform: scale(0.99); }

.card__photo {
  width: 76px; height: 76px; flex: none;
  border-radius: 12px; object-fit: cover;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 30px; color: var(--text-faint);
}

.card__main { flex: 1; min-width: 0; }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card__name { margin: 0; font-size: 16.5px; font-weight: 650; line-height: 1.25; }
.card__dist {
  flex: none; font-size: 12px; font-weight: 600;
  color: var(--indigo); background: var(--surface-2);
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
}
.badge--type-publica { background: #dbeafe; color: #1d4ed8; }
.badge--type-privada { background: #f3e8ff; color: #7e22ce; }
.badge--type-mista   { background: #d1fae5; color: #047857; }
.badge--done { background: rgba(22,163,74,0.14); color: var(--green); }
@media (prefers-color-scheme: dark) {
  .badge--type-publica { background: rgba(37,99,235,0.22); color: #93b4ff; }
  .badge--type-privada { background: rgba(147,51,234,0.24); color: #d8b4fe; }
  .badge--type-mista   { background: rgba(4,120,87,0.28); color: #6ee7b7; }
}

.card__stars { margin-top: 8px; font-size: 14px; letter-spacing: 1px; color: var(--amber); }
.card__stars .off { color: var(--border); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 60px 24px; color: var(--text-soft); }
.empty__art { font-size: 56px; }
.empty h2 { margin: 12px 0 6px; color: var(--text); }
.empty p { margin: 0; font-size: 15px; line-height: 1.5; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: 20px; bottom: calc(20px + var(--safe-bottom));
  width: 58px; height: 58px; border: none; border-radius: 20px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff; box-shadow: var(--shadow-lg);
  display: grid; place-items: center; cursor: pointer;
  z-index: 30; transition: transform .12s;
}
.fab:active { transform: scale(0.92); }

/* ---------- Modal / Sheet ---------- */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 16, 28, 0.5);
  backdrop-filter: blur(2px);
  animation: fade .2s ease;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 94vh; display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 640px) {
  .sheet { left: 50%; transform: translateX(-50%); width: 560px; bottom: 0; }
}
.sheet__handle {
  width: 40px; height: 5px; border-radius: 999px;
  background: var(--border); margin: 8px auto 0; flex: none;
}
.sheet__body { overflow-y: auto; padding: 8px 18px calc(28px + var(--safe-bottom)); }

.sheet__topbar {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--bg);
  padding: 8px 0 12px; margin: 0 0 6px;
}
.sheet__title { margin: 0; font-size: 17px; font-weight: 650; text-align: center; }

.text-btn {
  background: none; border: none; cursor: pointer;
  font-size: 15px; color: var(--text-soft); padding: 6px;
}
.text-btn--primary { color: var(--indigo); font-weight: 700; text-align: right; }

/* ---------- Fields ---------- */
.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 7px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

input[type=text], input[type=tel], input[type=email], input[type=search], textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font-size: 16px; padding: 12px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
textarea { resize: vertical; line-height: 1.4; }

/* Photo */
.photo-field { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 18px; }
.photo-preview {
  width: 100%; height: 180px; border-radius: 16px;
  background: var(--surface-2); border: 1px dashed var(--border);
  display: grid; place-items: center; overflow: hidden;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview__placeholder { color: var(--text-faint); font-size: 14px; }
.photo-field__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.btn {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
  padding: 11px 16px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn--ghost { background: var(--surface-2); border-color: transparent; }
.btn--danger { color: var(--red); }
.btn--danger-solid {
  width: 100%; background: rgba(220,38,38,0.1);
  color: var(--red); border-color: transparent; margin-top: 6px;
}

/* Segmented */
.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented__opt {
  flex: 1; border: none; background: transparent; cursor: pointer;
  padding: 9px 0; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--text-soft); transition: background .15s, color .15s;
}
.segmented__opt.is-active { background: var(--surface); color: var(--indigo); box-shadow: var(--shadow); }

/* Location */
.loc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.loc-status { font-size: 13px; color: var(--text-soft); }
.loc-status.ok { color: var(--green); font-weight: 600; }

/* Toggles */
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text-soft);
  padding: 11px 12px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-align: left; transition: all .15s;
}
.toggle__ico { font-size: 16px; }
.toggle.is-on {
  background: rgba(22,163,74,0.12); border-color: rgba(22,163,74,0.4);
  color: var(--green);
}

/* Stars */
.stars { display: flex; align-items: center; gap: 4px; }
.star {
  background: none; border: none; cursor: pointer;
  font-size: 30px; line-height: 1; color: var(--border);
  padding: 0 2px; transition: color .12s, transform .1s;
}
.star:active { transform: scale(1.2); }
.star.is-on { color: var(--amber); }
.stars__clear {
  margin-left: 8px; background: var(--surface-2); border: none;
  color: var(--text-faint); border-radius: 8px; width: 30px; height: 30px;
  cursor: pointer; font-size: 14px;
}

/* Comments */
.comments { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.comments-empty { color: var(--text-faint); font-size: 13px; margin: 0 0 4px; }
.comment {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
}
.comment__body { min-width: 0; }
.comment__text { font-size: 14.5px; line-height: 1.4; word-break: break-word; }
.comment__date { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.comment__del {
  flex: none; background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 16px; padding: 2px 4px;
}
.comment-add { display: flex; gap: 8px; }
.comment-add input { flex: 1; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; z-index: 80;
  box-shadow: var(--shadow-lg); animation: fade .2s ease;
  max-width: 90vw; text-align: center;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (min-width: 640px) {
  @keyframes slideUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
}
