.navbar {
  padding: 1.5em 3em;
}

body {
  font-family: "Manrope", sans-serif;
  background: url(../images/lukas-blazek-f-TWhXOrLiU-unsplash_low.jpg) no-repeat center center fixed;
  background-size: cover;
}

html, body {
  height: 100%;
}

#content-wrapper {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

h1 {
  font-size: 3em;
}

h2 {
  font-size: 2em;
  margin: 2em 0 0.5em 0;
}

#content-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loader-message {
  text-align: center;
}

.loader-message p {
  margin-top: 1rem;
  font-family: 'Manrope', sans-serif;
  color: #333;
}

#form-wrapper {
  display: flex;
  align-content: center;
  justify-content: center;
  flex-wrap: wrap;
  height: 50vh;
  transition: height 0.3s ease, padding 0.3s ease;
}

#form-wrapper.compact {
  height: auto;
}

#form-wrapper.compact .select2-selection--multiple {
  overflow: visible;
  min-height: 0 !important;
  height: auto !important;
}

@media (max-width: 768px) {
  #form-wrapper.compact {
    height: auto;
  }
  .select2-container--open .select2-dropdown {
    top: 100% !important;
    bottom: auto !important;
  }
}

#body-text-wrapper,
#search-wrapper {
  flex: 1 0 auto;
}

#search_form {
  text-align: center;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: normal;
  gap: 0.5rem;
}

#homepage-h2-title {
  text-align: center;
  font-weight: bold;
  padding-bottom: 10px;
}

#results-wrapper {
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  #results-wrapper {
    margin-top: 1rem;
  }
}

#search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

#load-more {
  margin-top: 2rem;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.search-item {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0px 5px 5px -6px rgba(0, 0, 0, 0.253);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.search-item:hover {
  box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.search-item-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 1rem;
  display: block;
}

.search-item-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.search-item h4 {
  margin: 0 0 0.5rem 0;
  font-weight: 700;
  color: #275dad;
}

.search-item h4 a {
  color: #275dad;
  text-decoration: none;
}

.search-item h4 a:hover {
  text-decoration: underline;
}

.search-item p {
  margin: 0 0 1rem 0;
  color: #5b616a;
  flex-grow: 1;
  font-size: 0.95rem;
  line-height: 1.5;
}

.search-item-btn {
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.btn-primary {
  background-color: #6c757d;
  color: white;
  border-color: #6c757d;
}

.btn-primary:hover {
  background-color: #5a6268;
  color: white;
  border-color: #5a6268;
}

.search-item a {
  word-break: break-all;
  text-decoration: none;
}

.search-item a:hover {
  text-decoration: underline;
}

@media only screen and (max-width: 768px) {
  #search-results {
    grid-template-columns: 1fr;
  }
  
  #results-wrapper {
    padding: 1rem 0.5rem;
  }
}

#food-select-field {
  width: 60%;
  min-width: 220px;
  max-width: 400px;
}

.select2-container--default .select2-selection--multiple {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-size: 1rem;
  padding: 8px 12px;
}

.submit-btn {
  height: 48px;
  padding: 0 28px;
  background-color: #5b616a;
  color: #edf0f4;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  margin-left: 0.5rem;
  transition: background 0.2s;
  display: flex;
  align-items: center;
}

.submit-btn:disabled {
  background: #ced3dc;
  color: #fff;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  #search_form {
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.5rem 0.5rem;
    align-items: stretch;
  }
  #food-select-field,
  .select2-container,
  .select2-container--default .select2-selection--multiple,
  .submit-btn {
    width: 100%;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  #food-select-field {
    font-size: 1.25rem;
    min-height: 56px;
    padding: 0.75rem 1rem;
    border-radius: 10px;
  }
  .select2-container--default .select2-selection--multiple {
    min-height: 56px;
    font-size: 1.15rem;
    padding: 1rem 1rem;
    border-radius: 10px;
  }
  .submit-btn {
    min-height: 56px;
    font-size: 1.25rem;
    border-radius: 10px;
    margin-left: 0;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(39,93,173,0.10);
    display: block;
  }
}

h2#homepage-h2-title {
  color: #5b616a;
}

.body-text-wrapper {
  background-color: #edf0f4;
  min-height: 100vh;
}

.body-text {
  background-color: #fff;
  -webkit-box-shadow: 0px 5px 5px -6px rgba(0, 0, 0, 0.253);
          box-shadow: 0px 5px 5px -6px rgba(0, 0, 0, 0.253);
  border-radius: 5px;
  padding: 2em;
  height: 100vh;
}

footer {
  padding: 1em;
  background: #5b616a;
  text-align: center;
  color: #fff;
}

/* SELECT2 */
.select2-selection.select2-selection--multiple,
.select2-container--default.select2-selection--multiple,
.select2-dropdown {
  border: none !important;
  -webkit-box-shadow: 0px 5px 5px -6px rgba(0, 0, 0, 0.253);
  box-shadow: 0px 5px 5px -6px rgba(0, 0, 0, 0.253);
}

.select2-selection.select2-selection--multiple {
  padding: 10px;
}

input.select2-search__field {
  width: inherit !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: #275dad;
}

footer {
  margin-top: auto;
  text-align: center;
  padding: 1rem 0;
}