import { Box, Container, Typography } from "@mui/material";
import styled from "styled-components";
import selectedTheme from "../../../themes";
import { IconButton } from "../../Buttons/IconButton/IconButton";
import { PrimaryButton } from "../../Buttons/PrimaryButton/PrimaryButton";
import { Icon } from "../../Icon/Icon";
import { ReactComponent as Eye } from "../../../assets/images/svg/eye-striked.svg";
import { ReactComponent as Remove } from "../../../assets/images/svg/trash.svg";
import { ReactComponent as Edit } from "../../../assets/images/svg/edit.svg";
import { ReactComponent as Star } from "../../../assets/images/svg/star.svg";

export const OfferCardContainer = styled(Container)`
  display: ${(props) => (props.skeleton ? "none" : "flex")};
  flex-direction: column;
  width: ${(props) => (!props.halfwidth ? "100%" : "49%")};
  box-sizing: border-box;
  margin: 10px 0;
  background-color: ${(props) =>
    props.sponsored === "true"
      ? selectedTheme.backgroundSponsoredColor
      : "white"};
  border-radius: 4px;
  ${(props) =>
    props.sponsored === "true" &&
    `border: 1px solid ${selectedTheme.borderSponsoredColor};`}
  padding: 16px;
  max-width: 2000px;
  height: 180px;
  position: relative;
  @media (max-width: 550px) {
    height: 184px;
    padding: 18px;
    padding-top: 12px;
    ${(props) =>
      props.vertical &&
      `
      height: 330px;
      width: 180px;
      margin: 0 18px;
    `}
  }
`;
export const OfferFlexContainer = styled(Container)`
  display: flex;
  flex-direction: row;
  margin: 0;
  padding: 0;
  max-height: 184px;
  @media (max-width: 600px) {
    ${(props) =>
      props.vertical &&
      `
      flex-direction: column;
    `}
  }
`;
export const OfferImage = styled.img`
  max-width: 144px;
  max-height: 144px;
  width: 144px;
  height: 144px;
  @media (max-width: 600px) {
    ${(props) =>
      !props.vertical &&
      `
      max-width: 108px;
    max-height: 108px;
    width: 108px;
    height: 108px;
    `}
  }
`;
export const OfferInfo = styled(Box)`
  display: flex;
  flex: 2;
  flex-direction: column;
  justify-content: space-between;
  margin-left: 18px;
  ${(props) =>
    props.vertical &&
    `
    margin-left: 0;
    margin-top: 5px;
  `}
`;
export const OfferTitle = styled(Typography)`
  font-family: "Open Sans";
  flex: 1;
  color: ${selectedTheme.primaryPurple};
  font-weight: 700;
  font-size: 24px;
  width: calc(100% - 120px);
  cursor: pointer;
  @media (max-width: 550px) {
    width: 100%;
    font-size: 18px;
    display: none;
    ${(props) =>
      props.vertical &&
      `
      display: flex;
      flex: none;
      position: relative;
      line-height: 22px; 
      margin-top: 5px;
      font-size: 18px;

    `}
  }
`;
export const OfferAuthor = styled(Box)`
  display: flex;
  flex: 1;
  flex-direction: column;
`;
export const OfferAuthorName = styled(Typography)`
  font-family: "Open Sans";
  line-height: 22px;
  font-size: 16px;
  color: ${selectedTheme.primaryText};
  @media (max-width: 600px) {
    font-size: 14px;
    ${(props) =>
      props.vertical &&
      `
        line-height: 19px;
        font-size: 14px;
        position: absolute;
        bottom: 80px;
    `}
  }
`;
export const OfferLocation = styled(Typography)`
  font-family: "Open Sans";
  color: ${selectedTheme.primaryDarkText};
  line-height: 16px;
  font-size: 12px;
  ${(props) =>
    props.vertical &&
    `
    font-size: 12px;
    margin-top: 5px;
    position: absolute;
    bottom: 61px;
  `}
`;
export const OfferDetails = styled(Box)`
  display: flex;
  flex-direction: row;
  flex-wrap: ${(props) => (!props.halfwidth ? "no-wrap" : "wrap")};
  justify-content: start;
  gap: 1rem;
  @media (max-width: 650px) {
    flex-direction: column;
    justify-content: center;
    gap: 0;
  }
`;
export const OfferCategory = styled(Box)`
  font-family: "Open Sans";
  color: ${selectedTheme.primaryText};
  line-height: 16px;
  font-size: 12px;
  ${(props) =>
    props.vertical &&
    `
    position: absolute;
    bottom: 15px;
  `}
`;
export const OfferPackage = styled(Box)`
  font-family: "Open Sans";
  color: ${selectedTheme.primaryText};
  line-height: 16px;
  font-size: 12px;
`;
export const OfferViews = styled(Box)`
  font-family: "Open Sans";
  color: ${selectedTheme.primaryText};
  line-height: 16px;
  font-size: 12px;
  ${(props) =>
    props.vertical &&
    `
    display: none;
  `}
`;
export const OfferDescriptionTitle = styled(Box)`
  font-family: "Open Sans";
  font-size: 12px;
  color: ${selectedTheme.primaryDarkText};
  line-height: 16px;
`;
export const OfferDescriptionText = styled(Box)`
  font-family: "Open Sans";
  font-size: 16px;
  color: ${selectedTheme.primaryDarkText};
  line-height: 22px;
  max-width: calc(100% - 230px);
  max-height: 120px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  @media (max-width: 1500px) {
    display: none;
  }
`;
export const OfferDescription = styled(Box)`
  flex: 3;
  margin: auto 0;
  padding-left: 35px;
  @media (max-width: 1500px) {
    display: none;
  }
`;
export const Line = styled(Box)`
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  height: 100px;
  width: 0;
  margin: auto 0;
  @media (max-width: 1500px) {
    display: none;
  }
`;
export const DetailIcon = styled(Icon)`
  & svg {
    width: 14px;
    position: relative;
    top: -1px;
  }
`;
export const DetailText = styled(Typography)`
  font-family: "Open Sans";
  color: ${selectedTheme.primaryText};
  line-height: 16px;
  font-size: 12px;
  position: relative;
  top: -2px;
  left: 3px;
`;
export const CheckButton = styled(PrimaryButton)`
  width: 180px;
  height: 48px;
  position: absolute;
  bottom: 9px;
  right: 9px;
  &:hover button {
    background-color: ${selectedTheme.primaryPurple} !important;
    color: white !important;
  }
  @media (max-width: 650px) {
    display: none;
  }
`;
export const MessageIcon = styled(IconButton)`
  ${(props) => !props.showMessageIcon && "display: none;"}
  width: 40px;
  height: 40px;
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: ${selectedTheme.primaryIconBackgroundColor};
  border-radius: 100%;
  padding-top: 2px;
  text-align: center;
  @media (max-width: 600px) {
    width: 30px;
    height: 30px;
    top: 16px;
    right: 16px;
    padding: 0;
    ${(props) =>
      props.vertical &&
      `
      display: none;
    `}
    & button svg {
      width: 16px;
      height: 16px;
      position: relative;
      top: -3px;
      left: -2.4px;
    }
  }
`;
export const OfferImageContainer = styled(Box)`
  min-width: 144px;
  min-height: 144px;
  width: 144px;
  height: 144px;
  @media (max-width: 600px) {
    ${(props) =>
      !props.vertical
        ? `
      min-width: 108px;
      min-height: 108px;
      width: 108px;
      height: 108px;
    `
        : `margin-top: 4px;`}
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 4px 4px 9px rgba(0, 0, 0, 0.12);
  }
`;
export const OfferTitleAboveImage = styled(OfferTitle)`
  padding-bottom: 12px;
  padding-top: 5px;
  padding-left: 1px;
  display: block;
  ${(props) => props.vertical && `display: none;`}
  @media (min-width: 551px) {
    display: none;
  }
`;
export const EyeIcon = styled(Eye)`
  width: 12px;
  height: 11px;
  @media (max-width: 600px) {
    position: relative;
    top: 1px !important;
  }
`;
export const RemoveIconContainer = styled(MessageIcon)`
  display: block;
  top: 18px;
  right: 18px;

  @media screen and (max-width: 600px) {
    position: absolute;
    display: block;
    right: 20px;
    top: 75%;
  }
`;
export const RemoveIcon = styled(Remove)``;
export const EditIconContainer = styled(MessageIcon)`
  display: block;
  top: 18px;
  right: 76px;

  @media screen and (max-width: 600px) {
    position: absolute;
    display: block;
    right: 20px;
    top: 60%;
  }
`;
export const EditIcon = styled(Edit)``;
export const StarIconContainer = styled(MessageIcon)`
  display: block;
  opacity: ${(props) => (props.disabled ? "0.4" : "1")};
  ${(props) =>
    props.disabled &&
    `
    cursor: initial;
    & button {
      cursor: initial;
    }
  `}
`;
export const StarIcon = styled(Star)`
  & path {
    stroke: ${(props) =>
      props.disabled
        ? selectedTheme.primaryPurpleDisabled
        : selectedTheme.primaryPurple};
  }
`;
