$primary: #6CD4FF;
$link: #292a2c;
$grey-light: #c4c6ce;
$grey-dark: #262728;
$confirm: hsl(133deg, 100%, calc(41% + 0%));

// Path to Bulma's sass folder
@use "bulma/sass" with (
  $family-primary: '"Nunito", sans-serif',
  $grey-dark: $grey-dark,
  $grey-light: $grey-light,
  $primary: $primary,
  $link: $link,
  $control-border-width: 2px,
  $input-shadow: none
);

@use "bulma/sass/utilities/css-variables" as cv;

@include cv.system-theme($name: "dark") {
  .navbar-item > img {
    background-color: $grey-light !important;
    border-radius: 5px;
  }
  .card-header {
    background-color: $grey-dark;
  }
  a.card-footer-item.is-danger {
    color: black;
  }
  .tag {
    color: $grey-dark;
    background-color: $grey-light;
  }
}


// General Styles

.main-content {
  margin: auto;
  max-width: 80em;
  padding: 10px;
}

p > a {
  text-decoration: underline;
  word-break: break-all;
}

p > a.button {
  text-decoration: none;
}

// Cards

.card-header {
  background-color: $primary;
}


// Search form suggestion dropdown

#location-result-list {
  display: inline; //ensures that the dropdown is not restricted in width WTF
}

.result-item {
  cursor: pointer;
}

.result-item:hover {
  background-color: #b2aaaa;
}


// Toggle switch

.toggle-switch {
  display: inline-block;
  background: #ccc;
  border-radius: 16px;
  width: 58px;
  height: 32px;
  position: relative;
  vertical-align: middle;
  transition: background 0.25s;
}

.toggle-switch:before, .toggle-switch:after {
  content: "";
}

.toggle-switch:before {
  display: block;
  background: linear-gradient(to bottom, #fff 0%, #eee 100%);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  width: 24px;
  height: 24px;
  position: absolute;
  top: 4px;
  left: 4px;
  transition: left 0.25s;
}

.toggle:hover .toggle-switch:before {
  background: linear-gradient(to bottom, #fff 0%, #fff 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.checked + .toggle-switch {
  background: #56c080;
}

.checked + .toggle-switch:before {
  left: 30px;
}

.toggle-checkbox {
  position: absolute;
  visibility: hidden;
}

.slider-label {
  margin-left: 5px;
  position: relative;
  top: 2px;
}


// Button in card footer
.card-footer {
  overflow: hidden;
}

.card-footer .card-footer-item.is-confirm {
  background-color: $confirm;
}

.card-footer .card-footer-item.is-confirm:hover {
  filter: brightness(0.9);
}

.card-footer .card-footer-item.is-danger {
  background-color: sass.$danger;
}

.card-footer .card-footer-item.is-danger:hover {
  filter: brightness(0.9);
}


.card-footer .card-footer-item.is-warning {
  background-color: sass.$warning;
}

.card-footer .card-footer-item.is-warning:hover {
  filter: brightness(0.9);
}

/*******/
/* MAP */
/*******/

.map {
  border-radius: 8px;
  width: 100%;
  height: 100%
}

.marker {
  background-image: url('../img/logo_transparent.png');
  background-size: cover;
  width: 50px;
  height: 50px;
  cursor: pointer;
}

.animal-shelter-marker {
  background-image: url('../img/animal_shelter.png');
}

.map-in-content #map {
  max-height: 500px;
  width: 90%;
}

@media only screen and (min-width: 768px) {
  .maplibregl-popup {
    max-width: 280px !important;
  }
}

@media only screen and (max-width: 768px) {
  .maplibregl-popup {
    max-width: 150px !important;
  }
}

.maplibregl-popup-close-button {
  all: unset; /* Remove all inherited styles */
  font-size: 1.2rem;
  background: none;
  border: none;
  color: black;
  cursor: pointer;
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  padding: 0.25rem;
}

.popup-content {
  line-height: 1.4;
}


/*****
IMAGES
 *****/

.gallery .main-photo img {
  width: 100%;
  height: 150px;
  object-fit: cover; /* Crops the images */
  border-radius: 6px;
}

.thumbnail-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.thumbnail img {
  width: 100%;
  height: 70px;
  object-fit: cover; /* Crops the images */
  border-radius: 4px;
}

/* Ensure each thumbnail takes equal width */
.thumbnail {
  flex: 1;
}

.cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(192, 192, 192, 0.75);
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 500ms;
  border-radius: inherit; // ensure border radius of cards is followed, see https://css-tricks.com/preventing-child-background-overflow-with-inherited-border-radii/
}

.cover:hover {
  transition: opacity 500ms;
  opacity: 0;

  // For being able to click the image and for accessibility the cover should have display: none;
  // This is accepted by W3C: https://front-end.social/@mia/109433817951030826
  // However this does not yet seem to be supported to be animated by browsers.
  // Chrome claims to have shipped it: https://chromestatus.com/feature/5154958272364544
  // However I couldn't get it to work there too.
  // display: none;
  // transition: opacity 1000ms, display 100ms;
}

/**
AN Cards
 */

.an-card {
  width: 100%;
  height: 100%;
}


// Fonts

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  src: url(../fonts/nunito.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


.new-animal-ad fieldset {
  border-top: 4px solid var(--bulma-text-weak);
  margin-top: 2em;
  padding-top: 1em;
}

.new-animal-ad * {
  transition: all ease 0.5s;
}

.new-animal-ad .open {
  display: block;
}

.new-animal-ad .closed {
  display: none;
  overflow: hidden;
}

.new-animal-ad legend {
  font-weight: bold;
  padding-right: 0.2em;
  color: var(--bulma-label-color);
  font-size: 130%;
}

.feedback-backdrop {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-add-new {
  width: 40ch;
  min-height: 40ch;
  padding: 1.5em;
  background-color: var(--bulma-info-on-scheme);
  color: black;
}

.feedback-add-new.error {
  background-color: var(--bulma-danger-on-scheme);
}

.feedback-add-new.success {
  background-color: var(--bulma-success-on-scheme);
}


.notification-container {
  display: inline-block;
  position: relative;
  padding: 0;
}

.notification-label {
  padding: 2px 5px;
}

/* Make the badge float in the top right corner of the button */
.notification-badge {
  background-color: #fa3e3e;
  border-radius: 2px;
  color: white;

  padding: 1px 3px;
  font-size: 8px;

  position: absolute; /* Position the badge within the relatively positioned button */
  top: 0;
  right: 0;
}


/* Embedding Specifics */
.embed-main-content {
  padding: 20px 10px 20px 10px;
}

// FLOATING BUTTON

.floating {
  position: fixed;
  border-radius: 0.3rem;
  bottom: 4.5rem;
  right: 1rem;
}