/*
 * Styling for the Shopify App Proxy fragment (app/api/shopify-proxy).
 * Loaded via <link> on a merchant's own store page, inside their theme —
 * every rule is scoped under .fts-root and every class is namespaced
 * (fts-*) so nothing here collides with the theme's own CSS or globals.
 * Deliberately NOT shared with app/globals.css, which styles the standalone
 * app and can safely use :root / unprefixed classes since it owns the page.
 *
 * Sizes here are px, not rem: rem is relative to the HOST PAGE's <html>
 * font-size, which this fragment doesn't control and can't predict — e.g.
 * AKP Aviation's theme sets html { font-size: 62.5% }, so 1rem there is
 * 10px, not the usual 16px, silently shrinking every size in this file.
 * px sizing renders identically regardless of whatever font-size scheme
 * the merchant's theme uses.
 */

.fts-root {
  --fts-color-surface: #ffffff;
  --fts-color-border: #e2e5ea;
  --fts-color-text: #1a1d23;
  --fts-color-text-muted: #5b6270;
  --fts-color-primary: #1f6feb;
  --fts-color-primary-dark: #1655b8;
  --fts-color-danger: #b3261e;
  --fts-color-danger-bg: #fdecea;
  --fts-color-danger-border: #f5c2be;
  --fts-color-caa-bg: #e6f4ea;
  --fts-color-caa-text: #1e7b34;
  --fts-color-highlight-bg: #fff1a8;
  --fts-radius: 10px;
  --fts-radius-sm: 6px;
  --fts-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --fts-shadow-md: 0 4px 14px rgba(16, 24, 40, 0.1);

  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  font-family: inherit;
  font-size: 16px;
  color: var(--fts-color-text);
}

.fts-root h1 {
  font-size: 28px;
  margin: 0 0 20px;
}

.fts-lead {
  color: var(--fts-color-text-muted);
  font-size: 17px;
}

.fts-hint {
  color: var(--fts-color-text-muted);
}

.fts-back-link {
  margin-bottom: 24px;
}

.fts-error {
  color: var(--fts-color-danger);
  background: var(--fts-color-danger-bg);
  border: 1px solid var(--fts-color-danger-border);
  padding: 12px 16px;
  border-radius: var(--fts-radius-sm);
}

/* Search form */

.fts-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  background: var(--fts-color-surface);
  border: 1px solid var(--fts-color-border);
  border-radius: var(--fts-radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--fts-shadow-sm);
}

.fts-search-form .fts-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 160px;
  min-width: 140px;
}

.fts-search-form label {
  font-size: 15px;
  font-weight: 600;
  color: var(--fts-color-text-muted);
}

.fts-search-form input,
.fts-search-form select {
  padding: 9px 10px;
  border: 1px solid var(--fts-color-border);
  border-radius: var(--fts-radius-sm);
  font-size: 15px;
  background: #fff;
  font-family: inherit;
}

.fts-search-form input:focus,
.fts-search-form select:focus {
  outline: 2px solid var(--fts-color-primary);
  outline-offset: 1px;
}

.fts-search-form button {
  padding: 10px 22px;
  border: none;
  border-radius: var(--fts-radius-sm);
  background: var(--fts-color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  flex: 0 0 auto;
}

.fts-search-form button:hover {
  background: var(--fts-color-primary-dark);
}

/* Map */

.fts-map {
  height: 400px;
  width: 100%;
  border-radius: var(--fts-radius);
  margin-bottom: 24px;
  box-shadow: var(--fts-shadow-sm);
  /* Leaflet assigns its markers/controls large z-index values internally
   * (proportional to pixel position, easily 1000+). Without a stacking
   * context of its own, those values get compared directly against the
   * merchant theme's own page-level elements (e.g. a sticky header) and
   * can end up drawn on top of them while scrolling. Isolating the map
   * into its own stacking context contains everything inside it, so it
   * can never escape above elements outside the map regardless of what
   * z-index Leaflet uses internally. */
  isolation: isolate;
}

/* Results list */

.fts-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.fts-empty-message {
  color: var(--fts-color-text-muted);
}

.fts-result-card {
  background: var(--fts-color-surface);
  border: 1px solid var(--fts-color-border);
  border-radius: var(--fts-radius);
  padding: 18px 20px;
  box-shadow: var(--fts-shadow-sm);
}

.fts-result-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.fts-result-card h2 a {
  text-decoration: none;
  color: var(--fts-color-text);
}

.fts-result-card h2 a:hover {
  color: var(--fts-color-primary);
}

.fts-result-card .fts-distance {
  color: var(--fts-color-primary);
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 6px;
}

.fts-result-card .fts-address,
.fts-result-card .fts-courses {
  color: var(--fts-color-text-muted);
  font-size: 15px;
  margin: 2px 0;
}

.fts-result-card mark {
  background: var(--fts-color-highlight-bg);
  color: var(--fts-color-text);
  border-radius: 3px;
  padding: 0;
}

/* School detail fragment */

.fts-detail .fts-school-header {
  margin-bottom: 24px;
}

.fts-detail .fts-school-header h1 {
  margin: 6px 0 8px;
}

.fts-badge-caa {
  display: inline-block;
  background: var(--fts-color-caa-bg);
  color: var(--fts-color-caa-text);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 0;
}

.fts-detail section {
  background: var(--fts-color-surface);
  border: 1px solid var(--fts-color-border);
  border-radius: var(--fts-radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--fts-shadow-sm);
}

.fts-detail section h2 {
  margin-top: 0;
  font-size: 17px;
}

.fts-detail section ul {
  margin: 0;
  padding-left: 18px;
}

.fts-detail section li {
  margin: 5px 0;
}
