/* Responsive behavior for the marketplace chat layout. */

/* Wide desktop: hide compact controls and show the plain title. */
@media (min-width: 1100px) {
  body#module-wkmpchat-chat .columns-container .container {
    max-width: 1280px !important;
  }

  .wk_mp_chat_layout {
    grid-template-columns: 300px minmax(420px, 1fr) minmax(330px, 390px);
  }

  .wk_mobile_controls {
    display: none !important;
  }

  .wk_mobile_close_details {
    display: none !important;
  }

  .wk_desktop_title {
    display: block !important;
  }

  .wk_mp_chat_main {
    border-right: 1px solid #edf0f3;
  }

  .wk_mp_chat_details {
    display: flex;
  }
}

@media (max-width: 1099px) {
  html.wk_mobile_overlay_locked,
  body.wk_mobile_overlay_locked {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.wk_mobile_overlay_locked {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
  }

  .wk_mp_chat_layout {
    grid-template-columns: 260px minmax(0, 1fr);
    position: relative;
  }

  .wk_mp_chat_details {
    display: none;
  }

  .wk_desktop_title {
    display: none;
  }

  .wk_mobile_controls {
    display: grid !important;
  }

  .wk_mobile_controls .wk_mobile_details {
    width: 28px;
    min-height: 28px;
    padding: 0;
    justify-content: center;
  }

  .wk_mobile_controls .wk_mobile_details span {
    display: none;
  }

  .wk_mp_chat_layout .wk_mp_chat_header {
    height: 58px;
    min-height: 58px;
    padding: 8px 12px;
  }

  body.mobile_show_details .wk_mp_chat_details {
    display: flex;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    z-index: 1001;
    background: #fff;
    border-left: 0;
    border-radius: 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    animation: wkSlideUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.mobile_show_details .wk_mp_details_header {
    height: 64px;
    min-height: 64px;
    padding: 0 16px;
    justify-content: space-between;
  }

  body.mobile_show_details .wk_mp_details_body {
    padding: 18px 16px 32px;
  }

  body.mobile_show_details .wk_mobile_close_details {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0;
    color: #111 !important;
  }

  body.mobile_show_details .wk_mobile_close_details i {
    font-size: 0;
    line-height: 1;
  }

  body.mobile_show_details .wk_mobile_close_details i::before {
    content: "x";
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-style: normal;
  }
}

@media (max-width: 767px) {
  .wk_desktop_title {
    display: none;
  }

  .wk_mp_chat_layout {
    display: flex;
    height: calc(100vh - 120px);
    min-height: 560px;
    overflow: visible;
    padding-bottom: 12px;
  }

  .wk_mp_chat_main {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .wk_mp_chat_layout .wk_mp_chat_header {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 58px;
    min-height: 58px;
    padding: 8px 12px;
  }

  .wk_mp_chat_subtitle {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .wk_mp_chat_sidebar {
    display: none;
  }

  body.mobile_show_sidebar .wk_mp_chat_sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    padding-top: 46px;
    border-right: none;
    box-shadow: none;
    background: #fff;
  }

  body.mobile_show_sidebar .wk_mp_chat_main,
  body.mobile_show_sidebar .wk_mp_chat_details {
    display: none;
  }

  body.mobile_show_details .wk_mp_chat_details {
    display: flex;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    z-index: 1001;
    background: #fff;
    border-left: 0;
    border-radius: 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    animation: wkSlideUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.mobile_show_details .wk_mobile_close_details {
    display: inline-flex;
  }

  .wk_mobile_close_details {
    display: none;
  }

  body.mobile_show_sidebar .wk_mp_chat_layout::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(58, 140, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 8;
  }

  body.mobile_show_sidebar .columns-container {
    position: relative;
  }

  body.mobile_show_sidebar .columns-container::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(58, 140, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 5;
    pointer-events: none;
  }
}

@media (max-width: 767px) {
  .wk_mp_chat_layout .wk_mp_chat_header {
    height: 82px;
    min-height: 82px;
    flex-direction: column;
    align-items: stretch;
  }
  .wk_mp_sidebar_title {
    height: 56px;
  }
  .wk_mobile_controls {
    grid-template-columns: auto minmax(0, 1fr) auto;
    justify-content: stretch;
    width: 100%;
    column-gap: 14px;
  }

  .wk_mobile_title {
    text-align: left;
  }

  .wk_mobile_title h2 {
    max-width: 260px;
  }

  .wk_mobile_controls .wk_mobile_details {
    justify-self: end;
  }

  .wk_mp_chat_subtitle {
    display: block;
    margin: 4px 0 0 58px;
    max-width: calc(100% - 58px);
    color: #59677a;
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
  }

  /* Prevent iPhone Safari from auto-zooming the focused chat textarea. */
  #wk_mp_chat_message_input {
    font-size: 16px !important;
  }
}

@media (max-width: 767px) {
  .wk_mp_chat_sidebar {
    display: none;
  }
}

@media (max-width: 1099px) {
  body.mobile_show_details {
    overflow: hidden;
  }

  body.mobile_show_details::before {
    content: "";
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483646 !important;
    background: rgba(0, 0, 0, 0.58);
  }

  body.mobile_show_details .wk_mp_chat_details {
    display: flex !important;
    position: fixed !important;
    top: 18px;
    bottom: 18px;
    left: 50%;
    right: auto;
    width: min(calc(100vw - 40px), 377px);
    height: auto;
    max-height: calc(100vh - 36px);
    max-height: calc(100dvh - 36px);
    transform: translateX(-50%);
    z-index: 2147483647 !important;
    background: #fff;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile_show_details .wk_mp_details_header {
    display: flex;
    height: 72px;
    min-height: 72px;
    padding: 0 18px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #edf0f3;
    background: #fff;
  }

  body.mobile_show_details .wk_mp_details_header h2 {
    font-size: 24px;
  }

  body.mobile_show_details .wk_mp_details_body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 18px calc(32px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile_show_details .wk_mobile_close_details {
    display: inline-flex !important;
    width: 36px;
    height: 36px;
  }

  body.mobile_show_details .wk_mp_listing_card {
    margin: 0 0 24px;
  }

  body.mobile_show_details .wk_mp_listing_img_wrapper {
    padding: 18px 0 18px;
  }

  body.mobile_show_details .wk_mp_listing_img {
    height: auto;
    aspect-ratio: 1.52 / 1;
    border-radius: 10px;
  }

  body.mobile_show_details .wk_mp_listing_title {
    font-size: 28px;
    line-height: 1.15;
    margin: 0 0 12px;
  }

  body.mobile_show_details .wk_mp_listing_location {
    font-size: 16px;
    line-height: 1.55;
  }

  body.mobile_show_details .wk_mp_listing_actions {
    margin-bottom: 24px;
  }

  body.mobile_show_details .wk_btn_book {
    height: 48px;
    margin-bottom: 0;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
  }

  body.mobile_show_details .wk_mp_trip_details h3,
  body.mobile_show_details .wk_mp_payment_details h3 {
    height: auto;
    line-height: 1.2;
    margin: 0 0 10px;
    font-size: 20px;
  }

  body.mobile_show_details .wk_mp_payment_details {
    margin-top: 24px;
  }

  body.mobile_show_details .wk_mp_detail_item,
  body.mobile_show_details .wk_mp_payment_item {
    min-height: 48px;
    height: auto;
    padding: 13px 0;
  }

  body.mobile_show_details .wk_mp_detail_label,
  body.mobile_show_details .wk_mp_detail_value,
  body.mobile_show_details .wk_mp_payment_label,
  body.mobile_show_details .wk_mp_payment_value {
    font-size: 16px;
    line-height: 1.4;
  }

  body.mobile_show_details .wk_mp_payment_total .wk_mp_payment_label,
  body.mobile_show_details .wk_mp_payment_total .wk_mp_payment_value {
    font-weight: 700;
  }
}

@keyframes wkSlideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
