/*
  Run 169 app and phone styles
  File: public_html/assets/css/run169-app.css

  Everything that changes the layout is inside the phone media query
  (max-width: 760px), so the desktop site looks exactly as before.
*/

/* ---------- Remembered member note (all screens) ---------- */
.run169-remembered {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 212, 0, 0.14);
  border: 1px solid rgba(255, 212, 0, 0.45);
  color: var(--navy-deep);
  font-size: 0.92rem;
  font-weight: 700;
}
.run169-remembered strong { font-weight: 900; }
.run169-remembered-change {
  background: var(--navy-deep);
  color: var(--yellow);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 36px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ---------- Town search box (built only on phones) ---------- */
.run169-select-replaced {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  min-height: 0 !important;
}
.run169-town-combo { position: relative; }
.run169-town-combo .run169-town-input,
.town-entry .run169-field .run169-town-combo .run169-town-input {
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(11, 17, 64, 0.18);
  border-radius: 17px;
  background-color: #fff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6079' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 16px center !important;
  background-size: 20px 20px !important;
  color: var(--navy-ink);
  padding: 15px 18px 15px 46px;
  font: 650 1rem 'Manrope', sans-serif;   /* 16px keeps iPhones from zooming in */
  outline: none;
}
.run169-town-combo .run169-town-input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 212, 0, 0.18);
}
.run169-town-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: #fff;
  border: 1px solid rgba(11, 17, 64, 0.14);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(6, 10, 45, 0.22);
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.run169-town-list li {
  padding: 14px 14px;
  min-height: 48px;
  border-radius: 10px;
  color: var(--navy-deep);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
}
.run169-town-list li[aria-selected="true"],
.run169-town-list li[data-town]:active { background: rgba(255, 212, 0, 0.25); }
.run169-town-list li.run169-town-none { color: var(--muted); font-weight: 700; cursor: default; }

/* ---------- Bottom tab bar ---------- */
.run169-tabbar { display: none; }

@media (max-width: 760px) {
  .run169-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--navy-ink);
    border-top: 1px solid rgba(255, 212, 0, 0.22);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
    padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
  }
  .run169-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 54px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
  }
  .run169-tabbar a svg { width: 24px; height: 24px; }
  .run169-tabbar a.active { color: var(--yellow); background: rgba(255, 212, 0, 0.10); }
  .run169-tabbar a[data-tab="submit"] svg {
    width: 30px;
    height: 30px;
    padding: 4px;
    border-radius: 10px;
    background: var(--yellow);
    color: var(--navy-deep);
  }

  /* room for the tab bar so nothing hides behind it */
  .run169-has-tabbar body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .run169-has-tabbar .mobile-menu { padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px)); }

  /* ---------- Easier Submit Town form on phones ---------- */
  #page-submit-town .section { padding: 22px 0 28px; }
  #page-submit-town .run169-form { gap: 16px; }
  #page-submit-town .run169-form-card { padding: 20px 16px; border-radius: 20px; }
  #page-submit-town .run169-form-card h3 { font-size: 1rem; }
  #page-submit-town .run169-form-note { font-size: 0.9rem; }

  /* three mode choices become compact full-width rows */
  #page-submit-town .submit-town-mode-buttons { grid-template-columns: 1fr; gap: 8px; }
  #page-submit-town .submit-town-mode-button { min-height: 0; padding: 14px 16px; }
  #page-submit-town .submit-town-mode-button.active::before { display: none; }
  #page-submit-town .submit-town-mode-button span { font-size: 0.8rem; }

  #page-submit-town .town-entry { padding: 16px 14px; border-radius: 18px; }
  #page-submit-town .town-entry-actions { justify-content: stretch; }
  #page-submit-town .town-entry-actions .btn,
  #page-submit-town .submit-town-bulk-actions button { width: 100%; min-height: 52px; }
  #page-submit-town .remove-town-btn,
  #page-submit-town .clear-town-btn { min-height: 40px; padding: 9px 16px; }

  /* Big full-width Submit button at the end of the form */
  #page-submit-town #submitTownSubmitBtn {
    width: 100%;
    min-height: 60px;
    font-size: 0.9rem;
  }

  #page-submit-town .run169-remembered { font-size: 0.88rem; }
}

/* ---------- When opened from the home screen icon ---------- */
.run169-standalone .topbar { padding-top: env(safe-area-inset-top, 0px); }
@media (max-width: 760px) {
  .run169-standalone #page-submit-town .page-hero { padding: 18px 0 16px; }
  .run169-standalone #page-submit-town .breadcrumb,
  .run169-standalone #page-submit-town .page-hero .pill { display: none; }
  .run169-standalone #page-submit-town .page-hero h1 { font-size: 1.35rem; margin-bottom: 6px; }
  .run169-standalone #page-submit-town .page-hero p.lead { font-size: 0.92rem; }
  .run169-standalone .footer { padding-bottom: 20px; }
}
