@import "../../styles/vars.scss";

.item__info p {
  margin: 0 0 12px 0;
}

.item {
  display: flex;
  flex-direction: column;
  margin: 0 20px;
  border-radius: 15px;
  background-color: white;
  height: 450px;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1), min-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;

  &--expanded {
    height: auto !important;
    min-height: 450px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1), min-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  &--clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
  }

  @media (min-width: 1800px) {
    height: 480px;

    &--expanded {
      height: auto !important;
      min-height: 480px;
    }
  }

  @media (max-width: 1300px) {
    height: 430px;

    &--expanded {
      height: auto !important;
      min-height: 430px;
    }
  }

  @media (max-width: 1200px) {
    height: 410px;

    &--expanded {
      height: auto !important;
      min-height: 410px;
    }
  }

  @media (max-width: 1100px) {
    height: 390px;

    &--expanded {
      height: auto !important;
      min-height: 390px;
    }
  }

  @media (max-width: $laptopWidth) {
    height: 370px;
    margin: 0 15px;

    &--expanded {
      height: auto !important;
      min-height: 370px;
    }
  }

  @media (max-width: $tabletWidth) {
    height: 500px;

    &--expanded {
      height: auto !important;
      min-height: 500px;
    }
  }

  @media (max-width: 740px) {
    height: 480px;

    &--expanded {
      height: auto !important;
      min-height: 480px;
    }
  }

  @media (max-width: 690px) {
    height: 460px;

    &--expanded {
      height: auto !important;
      min-height: 460px;
    }
  }

  @media (max-width: 635px) {
    height: 440px;

    &--expanded {
      height: auto !important;
      min-height: 440px;
    }
  }

  @media (max-width: 570px) {
    height: 420px;

    &--expanded {
      height: auto !important;
      min-height: 420px;
    }
  }

  @media (max-width: $mobileWidth) {
    height: 400px;
    margin: 0 10px;

    &--expanded {
      height: auto !important;
      min-height: 400px;
    }
  }

  @media (max-width: 420px) {
    height: 380px;

    &--expanded {
      height: auto !important;
      min-height: 380px;
    }
  }
}

.item__image:hover {
  text-decoration: none;
}

.item__image {
  border-top-right-radius: 15px;
  border-top-left-radius: 15px;
  width: 100%;
  height: 250px;
  object-fit: cover;
  object-position: center;
  display: block;

  @media (max-width: 1300px) {
    height: 230px;
  }

  @media (max-width: 1200px) {
    height: 210px;
  }

  @media (max-width: 1100px) {
    height: 190px;
  }

  @media (max-width: $laptopWidth) {
    height: 170px;
  }

  @media (max-width: $tabletWidth) {
    height: 300px;
  }

  @media (max-width: 740px) {
    height: 280px;
  }

  @media (max-width: 690px) {
    height: 250px;
  }

  @media (max-width: 635px) {
    height: 220px;
  }

  @media (max-width: 570px) {
    height: 190px;
  }

  @media (max-width: $mobileWidth) {
    height: 210px;
  }

  @media (max-width: 420px) {
    height: 190px;
  }
}

.item__info {
  margin: 20px 20px 15px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
  position: relative;

  @media (max-width: $mobileWidth) {
    margin: 15px 15px 10px 15px;
  }
}

.item__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  &--collapsed {
    max-height: 250px;
    overflow: hidden;
    position: relative;

    &::after {
      content: "";
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 20px;
      background: linear-gradient(transparent, white);
      pointer-events: none;
      transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @media (max-width: $mobileWidth) {
      max-height: 200px !important;
    }
    @media (max-width: 420px) {
      max-height: 180px !important;
    }
  }

  &:not(.item__content--collapsed) {
    max-height: none !important;
    overflow: visible;
    
    &::after {
      opacity: 0;
    }
  }
}

.item__expand-wrapper {
  margin-top: auto;
  padding-top: 2px;
  position: relative;
  z-index: 10;
  background: white;
  border-radius: 0 0 15px 15px;
  padding-bottom: 2px;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  min-height: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  @media (max-width: $mobileWidth) {
    padding-top: 4px;
    padding-bottom: 4px;
    margin-top: 4px;
  }
}

.item__price {
  font-size: 25px;

  @media (min-width: 1800px) {
    font-size: 29px;
  }

  @media (min-width: 768.98px) and (max-width: $laptopWidth) {
    font-size: 23px;
  }
}

.item__desc {
  font-size: 20px;
  line-height: 1.4;
  margin-bottom: 8px !important;
  word-wrap: break-word;
  hyphens: auto;

  @media (min-width: 1800px) {
    font-size: 24px;
  }

  @media (min-width: 768.98px) and (max-width: $laptopWidth) {
    font-size: 18px;
  }
}

.item__address {
  font-size: 17px;
  line-height: 1.3;
  word-wrap: break-word;
  hyphens: auto;

  @media (min-width: 1800px) {
    font-size: 21px;
  }

  @media (min-width: 768.98px) and (max-width: $laptopWidth) {
    font-size: 16px;
  }
}

.item__expand-btn {
  background: none;
  border: none;
  color: #007bff !important;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 0;
  margin-bottom: 2px;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  flex-shrink: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  z-index: 15;
  display: block;
  width: 100%;

  &:hover {
    color: #0056b3 !important;
    text-decoration: underline;
    transform: translateY(-1px);
  }

  &:focus {
    outline: none;
    color: #007bff !important;
  }

  &:visited {
    color: #007bff !important;
  }

  @media (min-width: 1800px) {
    font-size: 13px;
    padding: 3px 0;
  }

  @media (min-width: 768.98px) and (max-width: $laptopWidth) {
    font-size: 10px;
    padding: 2px 0;
  }

  @media (max-width: $tabletWidth) {
    font-size: 11px;
    padding: 3px 0;
    margin-bottom: 2px;
  }

  @media (max-width: $mobileWidth) {
    font-size: 11px;
    margin-bottom: 1px;
    padding: 3px 0;
    min-height: 18px;
    display: flex;
    align-items: center;
  }
}

.item__expand-wrapper {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
