/* ============================================================
 *  PÁGINA "NOSSAS LOJAS" — Store Locator
 *  ------------------------------------------------------------
 *  Busca/filtro 100% no cliente (ver assets/js/lojas.js).
 *  Reaproveita tokens, base e componentes da home.
 *  ============================================================ */

/* ---------- NAV: item ativo ---------- */
.nav__list a.is-active,
.nav__list a[aria-current="page"] { color: var(--color-brand); font-weight: var(--fw-semibold); }
.nav-drawer__list a[aria-current="page"] .nav-drawer__txt { color: var(--color-brand); }

/* ---------- HERO ---------- */
.lojas-hero {
  background: var(--color-bg);
  padding-top: calc(var(--topbar-h) + var(--space-12));
  padding-bottom: var(--space-10);
  text-align: center;
}
.lojas-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.lojas-hero .eyebrow { margin-bottom: 18px; }
.lojas-hero__title { color: var(--color-white); margin-bottom: 22px; }
.lojas-hero__sub {
  max-width: 640px;
  margin-inline: auto;
  color: var(--color-ink-100);
}

/* ---------- BUSCA / AUTOCOMPLETE ---------- */
.locator-search {
  background: var(--color-bg);
  padding-bottom: var(--space-14);
}
.locator-search__col {
  max-width: 720px;
  margin-inline: auto;
}

.ac { position: relative; }

.ac__field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 64px;
  padding: 0 18px 0 20px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.ac.is-open .ac__field,
.ac__field:focus-within {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 4px rgba(234, 97, 32, 0.12);
}
.ac__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--color-brand);
}
.ac__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0;
}
.ac__input::placeholder { color: rgba(255, 255, 255, 0.5); }
.ac__input:focus { outline: none; }

.ac__clear,
.ac__chevron {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.55);
}
.ac__clear { width: 20px; height: 20px; }
.ac__clear:hover { color: var(--color-white); }
.ac__chevron {
  width: 20px;
  height: 20px;
  color: var(--color-brand);
  transition: transform var(--duration-normal) var(--ease-out);
  pointer-events: none;
}
.ac.is-open .ac__chevron { transform: rotate(180deg); }
.ac__clear[hidden] { display: none; }

/* painel de sugestões — só aparece quando focado/aberto */
.ac__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: var(--z-overlay);
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
}
.ac.is-open .ac__panel { display: block; }

.ac__group-label {
  padding: 12px 12px 4px;
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: 0.71875rem; /* ~11.5px */
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.ac__option {
  padding: 11px 12px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9375rem; /* 15px */
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac__option.is-active {
  background: rgba(234, 97, 32, 0.16);
  color: var(--color-brand);
  font-weight: var(--fw-semibold);
}
.ac__empty {
  padding: 18px 12px;
  font-size: var(--fs-body);
  color: var(--color-text-tertiary);
  text-align: center;
}
/* skeletons no carregamento */
.ac__skeleton {
  height: 16px;
  margin: 14px 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.06) 63%);
  background-size: 400% 100%;
  animation: ac-shimmer 1.4s ease infinite;
}
@keyframes ac-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* controles de localização / status */
.locator-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: 14px;
}
.btn-locate {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: 0.78125rem; /* 12.5px */
  color: var(--color-white);
  transition: border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.btn-locate:hover { border-color: var(--color-brand); background: rgba(234,97,32,0.08); }
.btn-locate .ico { width: 16px; height: 16px; color: var(--color-brand); }
.btn-locate[data-state="active"] .ico { color: var(--color-accent-success); }
.btn-locate[data-state="loading"] .ico { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.locator-status {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  color: var(--color-text-tertiary);
}
.locator-status a { color: var(--color-brand); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- RESULTADOS ---------- */
.locator-results {
  background: var(--color-bg);
  padding-block: var(--space-2) var(--space-24);
}
.results__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
.results__title {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  font-size: 2.125rem; /* 34px */
  line-height: 1.1;
  color: var(--color-white);
}
.results__count {
  margin-top: 4px;
  font-size: var(--fs-body);
  color: var(--color-text-tertiary);
}
.results__sort {
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-small);
  color: var(--color-text-tertiary);
  letter-spacing: 0.3px;
}

.stores-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ---------- CARD DE LOJA ---------- */
.store-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  transition: transform var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out);
}
.store-card:hover { transform: translateY(-4px); border-color: var(--color-border-strong); }

.store-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.store-card__namewrap { display: flex; flex-direction: column; min-width: 0; }
.store-card__name {
  font-family: var(--font-body); /* Textbook New */
  font-weight: var(--fw-bold);
  font-size: 1.125rem; /* 18px */
  line-height: 1.15;
  color: var(--color-white);
}

.store-card__dist {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(234, 97, 32, 0.14);
  color: var(--color-brand);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: 0.75rem; /* 12px */
  white-space: nowrap;
}

.store-card__row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.store-card__addr { margin-top: 14px; }
.store-card__phone { margin-top: 10px; align-items: center; }
.store-card__row .ico {
  flex-shrink: 0;
  width: 16px; height: 16px;
  margin-top: 2px;
}
.store-card__phone .ico { margin-top: 0; color: var(--color-accent-success); }
.store-card__addr .ico { color: var(--color-ink-300); }
.store-card__text {
  font-family: var(--font-body);
  font-size: 0.75rem; /* 12px */
  line-height: 1.5;
  color: var(--color-ink-200);
}
.store-card__phone .store-card__text { color: rgba(255, 255, 255, 0.8); line-height: 1.2; }

.store-card__actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.store-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 38px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: 0.75rem; /* 12px */
  letter-spacing: 0.2px;
  color: var(--color-ink-900);
  transition: filter var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.store-btn:hover { filter: brightness(1.06); }
.store-btn:active { transform: translateY(1px); }
.store-btn .ico { width: 16px; height: 16px; }
.store-btn--route { background: var(--color-brand); }
.store-btn--wa { background: var(--color-accent-success); }

/* skeleton de card */
.store-card.is-skeleton { pointer-events: none; min-height: 196px; }
.store-card.is-skeleton .sk {
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 37%, rgba(255,255,255,0.05) 63%);
  background-size: 400% 100%;
  animation: ac-shimmer 1.4s ease infinite;
}

/* estados vazio/erro */
.locator-feedback {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-16) var(--space-4);
  color: var(--color-text-secondary);
}
.locator-feedback h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
  color: var(--color-white);
  margin-bottom: var(--space-2);
}
.locator-feedback p { font-size: var(--fs-body); color: var(--color-text-tertiary); }

/* sentinela do scroll infinito */
.stores-sentinel { grid-column: 1 / -1; height: 1px; }
.stores-more {
  grid-column: 1 / -1;
  text-align: center;
  padding-top: var(--space-6);
  font-size: var(--fs-small);
  color: var(--color-text-tertiary);
}

/* ---------- RESPONSIVO ---------- */
@media (max-width: 1024px) {
  .stores-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .stores-grid { grid-template-columns: 1fr; }
  .results__head { align-items: flex-start; }
}
@media (max-width: 480px) {
  .ac__field { height: 58px; }
  .store-card__actions { flex-direction: row; }
}
