/*
:root {
  --accent: #5ccfc0;
  --bg: #10151c;
  --surface: #18202a;
  --text: #f0f0f0;
  --text-muted: #a0a0a0;
  --hover: #1e2833;
  --font-weight-bold: 600;
}
*/

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --hover: #efece5;
  --accent: #2f6b4f;
  --text: #1d1d1b;
  --text-muted: #66635c;
  --font-weight-bold: 600;
}

/* Reset all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Fraunces', serif;
  background-color: var(--bg);
  color: var(--text);
}

#app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--surface);
  border-bottom: 1px solid var(--hover);
  padding: 1rem;
}

#app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
}

main {
  padding: 1rem;
}

#restaurant-list {
  /* Reset list styles */
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.restaurant-card {
  background-color: var(--surface);
  border-radius: 0.75rem;
  border: 1px solid var(--hover);
  padding: 1rem;
}

.restaurant-card:hover {
  background-color: var(--hover);
}

.restaurant-card.nearest {
  border-left: 6px solid var(--accent);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.favorite-button {
  /* Reset button styles */
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--accent);
  /* Ensure the button is accessible */
  min-width: 44px;
  min-height: 44px;
}

.card-address {
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: var(--font-weight-bold);
  margin-top: 0.5rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px; /* Fully rounded */
  background-color: var(--accent);
  color: var(--bg);
}

#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#filters label,
#login-form label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-group {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

/* Style for the select dropdown */
select,
input {
  font: inherit;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--hover);
  border-radius: 0.75rem;
  padding: 0.65rem;
  min-height: 44px;
}

select:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#nearest-button {
  flex-basis: 100%;
  font: inherit;
  font-weight: var(--font-weight-bold);
  background-color: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 0.75rem;
  min-height: 44px;
  cursor: pointer;
}

.view-toggle {
  font-weight: var(--font-weight-bold);
  display: flex;
  margin-bottom: 1rem;
  border: 1px solid var(--hover);
  border-radius: 0.75rem;
  overflow: hidden;
}

.view-toggle button {
  font: inherit;
  flex: 1;
  color: var(--text);
  background-color: transparent;
  border: none;
  border-radius: 0;
  min-height: 44px;
  cursor: pointer;
}

.view-toggle button.active {
  background-color: var(--accent);
  color: var(--bg);
}

.view-toggle button.active:focus-visible {
  outline: 2px solid var(--bg);
  outline-offset: -2px;
}

.view-toggle button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  border-radius: 0.4rem;
}

#user-button {
  font: inherit;
  background: none;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  min-height: 44px;
  cursor: pointer;
}

dialog {
  width: min(90vw, 40rem);
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 0.75rem;
  padding: 0;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(1px);
}

.dialog-content {
  padding: 1rem;
  max-height: 80vh;
  overflow-y: auto;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--hover);
}

.dialog-header h2 {
  font-size: 1.25rem;
  margin: 0;
}

.dialog-header button {
  margin-bottom: 0.5rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.restaurant-info {
  color: var(--text-muted);
  margin: 0.75rem 0;
}

/* Reset list styles for menu list */
#menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#menu-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
  border-bottom: 1px solid var(--hover);
}

#menu-list li:last-child {
  border-bottom: none;
}

#menu-list li span:last-child {
  white-space: nowrap;
  font-weight: var(--font-weight-bold);
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

#login-form button {
  font: inherit;
  font-weight: var(--font-weight-bold);
  background-color: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 0.75rem;
  min-height: 44px;
  cursor: pointer;
  margin-top: 0.5rem;
}

#map {
  margin-top: 1rem;
}

#map-container {
  min-height: 16rem;
  color: var(--text-muted);
  background-color: var(--surface);
  border: 1px solid var(--hover);
  border-radius: 0.75rem;
}

@media (min-width: 768px) {
  main {
    display: grid;
    grid-template-columns: 24rem 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      'filters map'
      'list    map';
    gap: 1rem;
  }

  #filters {
    grid-area: filters;
    margin-bottom: 0;
  }

  #restaurants {
    grid-area: list;
  }

  #map {
    grid-area: map;
    margin-top: 0;
    position: sticky;
    top: 1rem;
    align-self: start;
    height: calc(100vh - 2rem);
  }

  #map-container {
    height: 100%;
  }

  main .view-toggle {
    display: none;
  }
}
