:root {
  --navy: #173f67;
  --green: #2e8b57;
  --green-dark: #247247;
  --green-light: #eaf5ef;
  --blue: #1e88e5;
  --text: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --page: #f3f5f7;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(48px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(48px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
  background: var(--page);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.container {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 42px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 10px 35px rgba(15, 23, 42, 0.1);
  text-align: center;
}

/* Header */

.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  display: block;
  width: 82px;
  height: auto;
  margin-bottom: 6px;
}

.brand-title {
  margin: 0;
  color: var(--navy);
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
}

.brand-accent {
  color: var(--green);
}

.subtitle {
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1.4;
}

/* Initial location button */

.location-form {
  margin: 0;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.filter-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 24px;
}

.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
  padding: 10px 18px;

  background: white;
  color: var(--navy);

  border: 1px solid #d7dde5;
  border-radius: 14px;

  font-size: 1rem;
  font-weight: 600;

  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-button:hover {
  border-color: var(--green);
  background: #f5faf7;
}

.filter-button.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.find-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 14px 28px;
  border-radius: 14px;
  background: var(--green);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(46, 139, 87, 0.2);
}

.find-button:hover:not(:disabled) {
  background: var(--green-dark);
}

.loading-message {
  display: none;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Result card */

.result-card {
  margin-top: 30px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
}

.result-summary {
  padding: 2px 4px 22px;
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
}

.result-bin-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--green-light);
  color: var(--green);
  font-size: 1.15rem;
}

.result-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.4px;
}

.result-details {
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin-top: 20px;
}

.result-detail {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.walking-detail {
  color: var(--navy);
  font-weight: 800;
}

.distance-detail {
  color: var(--green);
  font-weight: 800;
}

.result-detail {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.result-divider {
  width: 1px;
  margin: 0 22px;
  background: var(--border);
}

/* Loading and completed route states */

#walkingRoute.walking-loading {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

#walkingRoute.walking-route-result {
  color: var(--navy);
  font-size: 1rem;
  font-weight: 700;
}

/* Map */

#map {
  width: 100%;
  height: 360px;
  overflow: hidden;
  border-radius: 22px;
}

.custom-marker {
  border: none;
  background: transparent;
}

.user-location {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.user-dot {
  width: 14px;
  height: 14px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px rgba(30, 136, 229, 0.5);
}

.bin-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 3px solid white;
  border-radius: 50%;
  background: #173f67;
  color: white;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.4),
    0 0 0 2px rgba(23, 63, 103, 0.22);
  font-size: 16px;
}

.selected-bin {
  transform: scale(1.22);
  background: #2e8b57;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.45),
    0 0 0 4px rgba(46, 139, 87, 0.28);
}

/* Result buttons */

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 54px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

.primary-action {
  grid-column: 1 / -1;
  min-height: 60px;
  background: var(--green);
  color: white;
  font-size: 1.05rem;
  box-shadow: 0 8px 18px rgba(46, 139, 87, 0.22);
}

.primary-action:hover:not(:disabled) {
  background: var(--green-dark);
}

.secondary-action {
  min-height: 52px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  box-shadow: none;
}

.secondary-action:hover:not(:disabled) {
  border-color: #d1d5db;
  background: #f8fafc;
}

.action-button i {
  font-size: 1.1rem;
}

.data-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

.error-card {
  color: #b42318;
}

.error-card > i {
  font-size: 1.6rem;
}

.error-message {
  margin: 10px 0 0;
  font-size: 1rem;
  line-height: 1.45;
}

.site-footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a,
.privacy-container a {
  color: var(--green-dark);
  font-weight: 700;
}

.privacy-container {
  width: min(100%, 820px);
  text-align: left;
}

.privacy-back-link {
  display: inline-block;
  margin-bottom: 28px;
  text-decoration: none;
}

.privacy-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.privacy-logo {
  width: 64px;
  height: auto;
}

.privacy-header h1 {
  margin: 0;
  color: var(--navy);
  font-size: 2.25rem;
  letter-spacing: -0.7px;
}

.privacy-header p,
.privacy-updated {
  margin: 7px 0 0;
  color: var(--muted);
}

.privacy-container section {
  margin-top: 30px;
}

.privacy-container h2 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 1.35rem;
}

.privacy-container h3 {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 1.05rem;
}

.privacy-container p,
.privacy-container li {
  line-height: 1.65;
}

.privacy-container ul {
  padding-left: 24px;
}

.nearby-bins {
  margin-top: 28px;
  text-align: left;
}

.nearby-bins h3 {
  margin-bottom: 14px;
  color: #1f4e79;
  font-size: 1.2rem;
  font-weight: 700;
}

#nearbyBinsList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nearby-bin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nearby-bin-item:hover {
  background: #f8fafc;
  border-color: #2e8b57;
}

.nearby-bin-item.active {
  background: #ecfdf5;
  border-color: #2e8b57;
}

.nearby-bin-distance {
  font-weight: 700;
  color: #2e8b57;
}

.nearby-bin-arrow {
  color: #6b7280;
  font-size: 1.1rem;
}

.nearby-bin-label {
  margin-top: 2px;
  font-size: 0.8rem;
  color: #6b7280;
}

/* Mobile */

@media (max-width: 768px) {
  body {
    padding:
      calc(16px + env(safe-area-inset-top))
      calc(16px + env(safe-area-inset-right))
      calc(16px + env(safe-area-inset-bottom))
      calc(16px + env(safe-area-inset-left));
  }

  .container {
    padding: 28px 18px;
    border-radius: 20px;
  }

  .privacy-header h1 {
    font-size: 1.85rem;
  }

  .logo {
    width: 64px;
  }

  .brand-title {
    font-size: 2.35rem;
  }

  .subtitle {
    margin: 15px 0 25px;
    font-size: 1.05rem;
  }

  .filter-buttons {
    gap: 8px;
    margin: 16px 0 24px;
  }

  .filter-button {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    font-size: 0.9rem;
  }

  .result-card {
    padding: 18px;
    border-radius: 20px;
  }

  .result-summary {
    padding: 2px 4px 16px;
  }

  .result-heading h2 {
    font-size: 1.3rem;
  }

  .result-details {
    margin-top: 18px;
  }

  .result-divider {
    margin: 0 13px;
  }

  .result-detail {
    font-size: 0.95rem;
  }

  #walkingRoute.walking-route-result {
    font-size: 0.95rem;
    white-space: nowrap;
  }

  #map {
    height: 320px;
    border-radius: 16px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .primary-action {
    grid-column: auto;
  }

  .action-button {
    width: 100%;
    min-height: 56px;
    font-size: 1rem;
  }
}

@media (max-width: 390px) {
  body {
    padding:
      calc(10px + env(safe-area-inset-top))
      calc(10px + env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      calc(10px + env(safe-area-inset-left));
  }

  .container {
    padding: 24px 14px;
  }

  .result-card {
    padding: 15px;
  }

  .result-divider {
    margin: 0 9px;
  }

  .result-detail {
    font-size: 0.88rem;
  }

  #walkingRoute.walking-route-result {
    font-size: 0.88rem;
  }

  .filter-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-button {
    width: 100%;
  }
}
