/* Main container for card view */
#card-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1200px;
  padding: 10px 5px;
  padding-bottom: 0;  /* Removes the bottom padding of the card container */
  overflow-y: auto;
  flex-grow: 1;
}

#card-container .card:last-child {
  margin-bottom: 15px;  /* Adds a small bottom margin to the last card */
}

/* Ensure the content takes up full height minus header and footer */
#legal-container {
  min-height: calc(100vh - /* header height */ 100px - /* footer height */ 50px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding-bottom: 10px;  /* Adjust this value to reduce or increase space at the bottom */
}

.card {
  width: 100%;
  margin: 1rem 0;
}

#toggle-view-btn {
  width: 200px;
  margin: 5px auto;
}

.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 5px;
}

.title-marker {
  height: 40px;
  margin: 0 10px;
}

/* Reduce padding after subtitle */
#legal-title-bar h3 {
  margin-bottom: 5px;
}

/* Adjust "Verified" checkbox and label */
#filters-container label {
  display: block;
  margin-top: 10px;
}

#verified-filter {
  vertical-align: middle;
  margin-right: 5px;
}

/* Reduce space between filters and "Switch to card view" button */
#filters-container {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Adjust table header size */
#locations-table th {
  padding: 5px 10px;
  white-space: nowrap;
}

/* By default, the switch button is visible and enabled */
#toggle-view-btn {
    display: inline-block;
    pointer-events: auto; /* This allows the button to be clickable */
    opacity: 1; /* Full opacity means the button is visible and looks enabled */
}

/* On mobile devices, we hide and disable the switch button */
@media (max-width: 576px) {
    #locations-table {
        display: none;
    }

    #card-container {
        display: flex;
    }

    h1 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1rem;
    }

    .title-marker {
        height: 25px;
    }

    #card-container {
        padding: 10px 5px;
    }
    
    #toggle-view-btn {
        display: none; /* This hides the button */
        pointer-events: none; /* This disables the button so it can't be clicked even if somehow visible */
        opacity: 0.5; /* This makes the button look disabled (but it's hidden so it doesn't matter) */
    }
}

/* For screens larger than 576px (not mobile) */
@media (min-width: 577px) {
  #card-container {
      flex-wrap: wrap;
      justify-content: space-around; /* Centers the cards with even spacing */
  }

  .card {
      flex: 0 1 calc(33.33% - 20px); /* Allows the card to shrink but not grow, targeting 1/3 width minus margin */
      margin: 10px;
  }
}

/* Improve alignment */
#filters-container {
  justify-content: space-between;
}

/* Improve button appearance */
.btn-primary {
  background-color: #4CAF50; /* Green */
  border: none;
  color: white;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 12px;
}

/* Loading spinner */
#loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh; /* take up half the viewport height */
}
