/* list */
.gkmb-mplace-list {
  & .listing-search-reset.font__button {
    background-color: transparent;
    color: rgb(var(--c-primary));
    border: 1px solid rgb(var(--c-primary));
  }

  & .font__button {
    hyphens: auto;
    text-wrap: balance;
  }

  & .listing-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0;
    margin-top: 2rem;
  }

  & .listing-item {
    background: rgb(var(--c-neutral-lightest));
    border-radius: var(--b-radius);
    color: rgb(var(--c-neutral-darkest));
    padding: 1rem;
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.08),
      0 2px 4px rgba(0, 0, 0, 0.04);
    transition:
      transform 0.25s ease,
      box-shadow 0.25s ease;
  }

  & .listing-item h3 {
    margin: 0 0 10px;
    font-size: 1.3rem;
    color: rgb(var(--c-primary));
    font-weight: var(--f-weight-b);
  }

  & .listing-item span {
    margin: 0 0 18px;
    color: rgb(var(--c-neutral-darkest));
    line-height: 1.5;
  }

  & ul li {
    list-style-type: none;
  }

  & .listing-search-form {
    margin-top: 1rem;
  }

  & .listing-wrapper {
    display: flex;
    gap: var(--g-gap);
  }

  & .listing-create-wrapper:not(:has(*)) {
    background-color: transparent;
  }
}

/* detail */
.gkmb-mplace-detail {
  & table.ce-table {
    width: 100%;
  }

  & .listing-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--g-gap-s);
  }

  & .listing-details {
    display: flex;
    flex-direction: column;
  }

  & .listing-images {
    width: 100%;
  }

  & .listing-actions {
    margin-top: 1rem;
  }

  & .listing-chat {
    background-color: rgb(var(--c-neutral-lighter));
    padding: 1rem 2rem;
  }

  & .listing-chat-messages {
    max-height: 500px;
    overflow-y: auto;
  }

  & .listing-chat-message {
    background-color: rgb(var(--c-neutral-lightest));
    padding: 1rem;
    position: relative;
    margin: 1rem 0;
    width: 80%;
  }

  & .listing-chat-message--own {
    right: -20%;
    position: relative;
    border-radius: var(--b-radius);
  }

  & .listing-chat-message--other {
    left: 0;
    border-radius: var(--b-radius);
  }

  & time[datetime] {
    font-weight: var(--f-weight-b);
  }

  & .listing-chat-message--own::before {
    content: "";
    position: absolute;
    bottom: -15px;
    right: 20px;
    width: 20px;
    height: 20px;
    background: rgb(var(--c-neutral-lightest));
    border-radius: 0 0 0 18px;
  }

  & .listing-chat-message--own::after {
    content: "";
    position: absolute;
    bottom: -20px;
    right: 6px;
    width: 24px;
    height: 20px;
    background: rgb(var(--c-neutral-lighter));
    border-radius: 0 0 0 18px;
  }

  & .listing-chat-message--other::before {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 20px;
    width: 20px;
    height: 20px;
    background: rgb(var(--c-neutral-lightest));
    border-radius: 0 0 18px 0;
  }

  & .listing-chat-message--other::after {
    content: "";
    position: absolute;
    bottom: -20px;
    left: 6px;
    width: 24px;
    height: 20px;
    background: rgb(var(--c-neutral-lighter));
    border-radius: 0 0 18px 0;
  }

  & .listing-chat-list {
    margin: 2.5rem 0;
  }

  & .listing-chat-list ul li {
    list-style-type: disc;
  }
}

/* approval */
.gkmb-mplace-approval {
  & .listing-item {
    background: rgb(var(--c-neutral-lightest));
    border-radius: var(--b-radius);
    margin-top: 1rem;
    padding: 1rem;
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.08),
      0 2px 4px rgba(0, 0, 0, 0.04);
  }

  & h3 {
    margin: 0 0 10px;
    font-size: 1.3rem;
    color: rgb(var(--c-primary));
    font-weight: var(--f-weight-b);
  }

  & ul {
    padding: 0;
  }

  & ul li {
    list-style-type: none;
  }

  & .listing-approval-actions {
    display: flex;
    gap: var(--g-gap-s);
    margin-top: 1rem;
  }

  & .btn.btn-secondary.font__button {
    background-color: transparent;
    color: rgb(var(--c-primary));
    border: 1px solid rgb(var(--c-primary));
  }
}

/* form */
.gkmb-mplace-form .btn.btn-secondary {
  background-color: transparent;
  color: rgb(var(--c-primary));
  border: 1px solid rgb(var(--c-primary));
  border-radius: var(--b-radius-s);
  line-height: 1.4;
  padding: 0.6rem 1.2rem;
}

@media (hover: hover) {
  .gkmb-mplace-list .listing-search-reset.font__button:hover,
  .gkmb-mplace-form .btn.btn-secondary:hover,
  .gkmb-mplace-approval .btn.btn-secondary.font__button:hover {
    background-color: rgb(var(--c-primary));
    color: rgb(var(--c-neutral-lightest));
    border: 1px solid rgb(var(--c-primary));
  }

  .gkmb-mplace-list .listing-item:hover {
    transform: translateY(-4px);
    box-shadow:
      0 10px 25px rgba(0, 0, 0, 0.12),
      0 4px 10px rgba(0, 0, 0, 0.06);
  }
}

/* =============================================================================
   Media Queries
   ========================================================================== */
@media (min-width: 640px) {
  .gkmb-mplace-detail {
    & .listing-images,
    & table.ce-table {
      width: 50%;
    }

    & .listing-chat-message {
      background-color: rgb(var(--c-neutral-lightest));
      padding: 1rem;
      position: relative;
      margin: 1rem 0;
      width: 50%;
    }

    & .listing-chat-message--own {
      right: -45%;
    }
  }
}

@media (min-width: 900px) {
  .gkmb-mplace-list .listing-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
}
