/* TIM Stores Map — self-contained styles */

:root {
  --ink: #0c1a2e;
  --ink-soft: #3a4a63;
  --muted: #6b7a90;
  --paper: #f4f6f9;
  --panel: #ffffff;
  --line: #d8dee8;
  --accent: #0057b8;
  --accent-deep: #003d82;
  --accent-soft: #e8f1fb;
  --selected: #ff6b00;
  --shadow: 0 12px 40px rgba(12, 26, 46, 0.12);
  --radius: 14px;
  --sidebar-w: min(400px, 100%);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  min-height: 100dvh;
}

/* —— Sidebar —— */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
  z-index: 2;
}

.sidebar__header {
  padding: 1.5rem 1.35rem 1rem;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(0, 87, 184, 0.08), transparent 55%),
    linear-gradient(180deg, #fafbfd 0%, #fff 100%);
}

.brand {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.sidebar__header h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.4rem 0 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.search input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.15);
}

.search input::placeholder {
  color: #9aa8bc;
}

.store-list {
  list-style: none;
  margin: 0;
  padding: 0.65rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scroll-behavior: smooth;
}

.store-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.4rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.store-item:hover {
  background: var(--accent-soft);
}

.store-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.store-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(0, 87, 184, 0.35);
  box-shadow: inset 3px 0 0 var(--accent);
}

.store-item__name {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.store-item__meta {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.store-item__city {
  color: var(--accent-deep);
  font-weight: 500;
}

.sidebar__footer {
  padding: 0.75rem 1.35rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

/* —— Map —— */
.map-panel {
  position: relative;
  min-height: 280px;
}

#map {
  width: 100%;
  height: 100%;
  background: #c5d4e3;
}

.detail-card {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 1000;
  width: min(360px, calc(100% - 2rem));
  padding: 1.15rem 1.25rem 1.25rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: card-in 0.28s ease;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detail-card__close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.detail-card__close:hover {
  background: var(--paper);
  color: var(--ink);
}

.detail-card__tag {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.detail-card h2 {
  margin: 0 1.5rem 0.45rem 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1.2;
}

.detail-card__address {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.detail-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.detail-card__meta dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.detail-card__meta dd {
  margin: 0;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.detail-card__maps {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
}

.detail-card__maps:hover {
  background: var(--accent-deep);
}

/* —— Markers —— */
.tim-marker {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--accent);
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 61, 130, 0.4);
  transition: transform 0.2s, background 0.2s;
}

.tim-marker.is-active {
  background: var(--selected);
  transform: rotate(-45deg) scale(1.2);
  box-shadow: 0 4px 14px rgba(255, 107, 0, 0.5);
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-family: var(--font);
}

.leaflet-popup-content {
  margin: 0.75rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.35;
}

.leaflet-popup-content strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

/* —— Mobile —— */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 48vh 52vh;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    order: 2;
  }

  .map-panel {
    order: 1;
  }

  .sidebar__header h1 {
    font-size: 1.55rem;
  }

  .detail-card {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.65rem;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .detail-card,
  .store-item,
  .tim-marker {
    animation: none;
    transition: none;
  }
}
