@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700;800&family=Instrument+Serif:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500&display=swap');

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

:root {
  --black:        #0f0f0f;
  --white:        #ffffff;
  --gray-50:      #fafafa;
  --gray-100:     #f5f5f5;
  --gray-200:     #e8e8e8;
  --gray-300:     #d4d4d4;
  --gray-400:     #9e9e9e;
  --gray-600:     #555555;
  --accent:       #1a6b3c;
  --accent-light: #e8f5ee;
  --accent-mid:   #2d8a55;
  --red:          #d93025;
  --red-light:    #fdecea;
}

html { font-size: 16px; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: #f8f8f6;
  color: var(--black);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 64px;
}

/* ── FRAME ──────────────────────────────────────────────────────── */
.frame {
  width: 100%;
  max-width: 390px;
  height: 100vh;
  height: 100dvh;
  background: var(--white);
  border-radius: 24px;
  overflow: hidden;
  position: relative; /* ← nueva línea */
  box-shadow: 0 2px 1px rgba(0,0,0,0.04),
              0 8px 32px rgba(0,0,0,0.08),
              0 32px 64px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.scroll-area::-webkit-scrollbar { width: 3px; }
.scroll-area::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────────── */
.wordmark {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn-main {
  display: block; width: 100%;
  padding: 15px 20px;
  background: var(--black); color: var(--white);
  border: none; border-radius: 12px;
  font-family: 'Syne', sans-serif; font-size: 14px;
  font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.btn-main:hover { background: #222; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.btn-main:active { transform: translateY(0); box-shadow: none; }

.btn-alt {
  display: block; width: 100%;
  padding: 13px 20px;
  background: transparent; color: var(--gray-600);
  border: 1.5px solid var(--gray-200); border-radius: 12px;
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  font-weight: 400; cursor: pointer; transition: all 0.2s; text-align: center;
}
.btn-alt:hover { border-color: var(--black); color: var(--black); background: var(--gray-100); }

/* ── TOP NAV ────────────────────────────────────────────────────── */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  position: sticky; top: 0; z-index: 50;
}
.top-nav .nav-logo {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 16px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--black);
}
.top-nav .nav-logo span { color: var(--accent); }

/* ── PAGE HEADER ────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}
.back-btn {
  width: 34px; height: 34px;
  border-radius: 10px; border: 1.5px solid var(--gray-200);
  background: white; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all 0.2s; text-decoration: none;
}
.back-btn:hover { border-color: var(--black); }
.back-btn svg { width: 16px; height: 16px; stroke: var(--black); fill: none; stroke-width: 2; }
.page-header-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; }

/* ── AVATAR ─────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--black); color: white;
  font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; letter-spacing: 0.04em; transition: opacity 0.2s;
  text-decoration: none;
}
.avatar:hover { opacity: 0.8; }

/* ── BOTTOM NAV ─────────────────────────────────────────────────── */
.bottom-nav {
  background: white; border-top: 1px solid var(--gray-200);
  display: flex; padding: 10px 0 16px;
  position: sticky; bottom: 0;
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; cursor: pointer;
  color: var(--gray-400); font-size: 10px; font-weight: 400;
  font-family: 'DM Sans', sans-serif; border: none; background: none;
  padding: 4px 0; transition: color 0.2s; text-decoration: none;
}
.bnav-item.active { color: var(--black); }
.bnav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.bnav-center { flex: 1; display: flex; align-items: center; justify-content: center; padding-bottom: 6px; }
.bnav-add {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--black); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity 0.2s; border: none; text-decoration: none;
}
.bnav-add:hover { opacity: 0.8; }
.bnav-add svg { width: 22px; height: 22px; stroke: white; fill: none; stroke-width: 2; }

/* ── FORM FIELDS ────────────────────────────────────────────────── */
.field-group { margin-bottom: 18px; }
.field-row { display: flex; gap: 12px; }
.field-row .field-group { flex: 1; }

label {
  display: block;
  font-family: 'Syne', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gray-400); margin-bottom: 7px;
}
label .req { color: var(--accent); }
label .opt { color: var(--gray-400); font-weight: 400; font-size: 9px; }

input[type="text"], input[type="email"],
input[type="password"], input[type="tel"], textarea, select {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--gray-200); border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  color: var(--black); background: var(--white); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 90px; font-family: 'DM Sans', sans-serif; }
input::placeholder, textarea::placeholder { color: #ccc; font-weight: 300; }
input:focus, textarea:focus, select:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(15,15,15,0.06);
}
input.error, textarea.error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(217,48,37,0.08); }
.field-hint { font-size: 11px; color: var(--gray-400); margin-top: 5px; font-weight: 300; line-height: 1.5; }

.section-divider {
  display: flex; align-items: center; gap: 12px; margin: 6px 0 18px;
}
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }
.section-divider span {
  font-family: 'Syne', sans-serif; font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray-400);
}

/* ── TOAST ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--black); color: white;
  padding: 11px 20px; border-radius: 100px;
  font-size: 12px; font-weight: 500; font-family: 'DM Sans', sans-serif;
  white-space: nowrap; opacity: 0; transition: all 0.25s;
  pointer-events: none; z-index: 999;
}
.toast.success { background: var(--accent); }
.toast.error   { background: var(--red); }
.toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── ANIMATIONS ─────────────────────────────────────────────────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-1 { animation: rise 0.4s 0.05s ease both; }
.anim-2 { animation: rise 0.4s 0.10s ease both; }
.anim-3 { animation: rise 0.4s 0.15s ease both; }
.anim-4 { animation: rise 0.4s 0.20s ease both; }
.anim-5 { animation: rise 0.4s 0.25s ease both; }
.anim-6 { animation: rise 0.4s 0.30s ease both; }


/* ── RESPONSIVE MÓVIL (max 440px) ──────────────────────────────── */
@media (max-width: 440px) {
  body { padding: 0; background: white; }
  .frame { border-radius: 0; box-shadow: none; min-height: 100vh; }
}

/* ── RESPONSIVE MÓVIL PEQUEÑO (max 360px) ──────────────────────── */
@media (max-width: 360px) {
  .greeting-name { font-size: 22px; }
  .obj-grid { gap: 8px; }
  .obj-thumb { height: 85px; font-size: 36px; }
  .obj-name { font-size: 11px; }
  .cat-pill { font-size: 11px; padding: 6px 11px; }
  .top-nav { padding: 14px 16px; }
  .greeting { padding: 18px 16px 14px; }
  .search-wrap, .cats-wrap { padding: 12px 16px; }
  .section, .horiz-section { padding: 16px 16px 0; }
  .pub-banner { margin: 0 16px 18px; }
}

/* ── RESPONSIVE DESKTOP (900px+) ────────────────────────────────── */
@media (min-width: 900px) {
  body {
    padding: 0;
    background: #f0f0ed;
    align-items: stretch;
    justify-content: stretch;
  }

  .frame {
    max-width: 100%;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .top-nav {
    grid-column: 1 / -1;
    padding: 16px 40px;
    border-bottom: 1px solid var(--gray-200);
  }

  .scroll-area {
    grid-column: 2;
    grid-row: 2;
    max-width: 860px;
    width: 100%;
    padding: 0 40px;
    margin: 0;
  }

  .bottom-nav {
    grid-column: 1;
    grid-row: 2 / 4;
    flex-direction: column;
    border-top: none;
    border-right: 1px solid var(--gray-200);
    padding: 24px 16px;
    align-items: flex-start;
    gap: 4px;
    position: sticky;
    top: 61px;
    height: calc(100vh - 61px);
    overflow-y: auto;
  }

  .bnav-item {
    flex: none;
    flex-direction: row;
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    gap: 10px;
    justify-content: flex-start;
  }

  .bnav-item svg { width: 18px; height: 18px; }

  .bnav-item.active {
    background: var(--gray-100);
    color: var(--black);
  }

  .bnav-center {
    flex: none;
    width: 100%;
    padding: 8px 0;
    justify-content: flex-start;
  }

  .bnav-add {
    width: 100%;
    border-radius: 10px;
    height: 44px;
    gap: 8px;
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.03em;
  }

  .greeting { padding: 32px 0 24px; }
  .greeting-name { font-size: 30px; }
  .search-wrap { padding: 20px 0; }
  .cats-wrap { padding: 16px 0; }
  .cats-scroll { flex-wrap: wrap; overflow-x: visible; }
  .section { padding: 24px 0 0; }
  .horiz-section { padding: 24px 0 0; }
  .pub-banner { margin: 0 0 24px; }

  .obj-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .obj-thumb { height: 130px; font-size: 54px; }
  .horiz-card { width: 180px; }
  .horiz-thumb { height: 120px; font-size: 48px; }
}

/* ── FILTRO DISTANCIA ───────────────────────────────────────────── */
.filter-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.filter-overlay.open { display: flex; }
.filter-modal { background: white; border-radius: 18px; width: 100%; max-width: 300px; padding: 22px; }
.filter-modal-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.filter-modal-sub { font-size: 12px; color: var(--gray-400); margin-bottom: 16px; }
.filter-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 2px; border-bottom: 1px solid var(--gray-100); cursor: pointer;
  font-size: 13px; color: var(--black); font-family: 'DM Sans', sans-serif;
}
.filter-option:last-of-type { border-bottom: none; }
.filter-radio {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--gray-300);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.filter-radio.checked { border-color: var(--black); }
.filter-radio.checked::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--black); }
.filter-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.filter-btn-secondary, .filter-btn-primary {
  flex: 1; padding: 11px; border-radius: 10px; font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: 'DM Sans', sans-serif; border: 1.5px solid var(--gray-200);
  background: white; color: var(--black);
}
.filter-btn-primary { background: var(--black); color: white; border-color: var(--black); }
.filter-btn.active { border-color: var(--black); background: var(--black); }
.filter-btn.active svg { stroke: white; }