/* =======================
   DayHelper conversation UI
   Conversation list + chat bubbles + job request cards
======================= */

.chatPage {
  width: 100%;
  min-height: calc(100dvh - 7rem);
  margin: 0;
  padding: 1.6rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 255, 0, 0.05), transparent 25%),
    #eef2f3;
  box-sizing: border-box;
}

.chatPage ~ .site-footer {
  display: none !important;
}

.chatShell {
  width: min(150rem, 100%);
  height: calc(100dvh - 10rem);
  min-height: 58rem;
  margin: 0 auto;

  display: grid;
  grid-template-columns: minmax(28rem, 36rem) minmax(0, 1fr);

  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 1.8rem;
  background: #ffffff;
  box-shadow: 0 1.2rem 4rem rgba(0, 0, 0, 0.12);
}

.chatSidebar {
  min-width: 0;
  min-height: 0;

  display: grid;
  grid-template-rows: auto auto 1fr;

  background: #ffffff;
  border-right: 1px solid rgba(0, 0, 0, 0.11);
}

.chatSidebar__header {
  min-height: 8rem;
  padding: 1.7rem 1.8rem;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;

  background: #000000;
  color: #ffffff;
}

.chatEyebrow {
  margin: 0 0 0.25rem;
  color: #00ff00;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.chatSidebar__header h1 {
  margin: 0;
  color: #ffffff;
  font-size: 2.4rem;
  line-height: 1.1;
  font-weight: 800;
}

.chatNewButton {
  width: 4.2rem;
  height: 4.2rem;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: #00ff00;
  color: #000000;

  font-size: 2.7rem;
  line-height: 1;
  font-weight: 500;
  text-decoration: none;
}

.chatNewButton:hover {
  background: #00d900;
  color: #000000;
}

.chatSearch {
  padding: 1.2rem;
  background: #f7f8f8;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.chatSearch input {
  width: 100%;
  min-height: 4.4rem;
  padding: 0.8rem 1.3rem;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 999px;
  outline: none;

  background: #ffffff;
  color: #000000;
  font-size: 1.35rem;
}

.chatSearch input:focus {
  border-color: #00cc00;
  box-shadow: 0 0 0 3px rgba(0, 255, 0, 0.12);
}

.chatConversationList {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chatConversation {
  min-height: 8rem;
  padding: 1.2rem 1.4rem;

  display: grid;
  grid-template-columns: 5.3rem minmax(0, 1fr);
  align-items: center;
  gap: 1.2rem;

  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: inherit;
  text-decoration: none;

  transition: background 0.16s ease;
}

.chatConversation:hover,
.chatConversation--active {
  background: #ecffec;
  color: inherit;
}

.chatConversation--active {
  box-shadow: inset 0.4rem 0 0 #00dd00;
}

.chatAvatar {
  width: 5.3rem;
  height: 5.3rem;
  flex: 0 0 auto;

  border-radius: 50%;
  object-fit: cover;
  background: #e6e6e6;
}

.chatAvatar--header {
  width: 4.8rem;
  height: 4.8rem;
}

.chatConversation__content {
  min-width: 0;
}

.chatConversation__top,
.chatConversation__bottom {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.chatConversation__top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: #111111;
  font-size: 1.5rem;
  font-weight: 800;
}

.chatConversation__top time {
  flex: 0 0 auto;
  color: #777777;
  font-size: 1.05rem;
  white-space: nowrap;
}

.chatConversation__bottom {
  margin-top: 0.35rem;
}

.chatConversation__bottom p {
  min-width: 0;
  margin: 0;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: #626262;
  font-size: 1.25rem;
  line-height: 1.3;
}

.chatConversation__bottom p span {
  color: #3d3d3d;
  font-weight: 700;
}

.chatUnreadBadge {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: #00e600;
  color: #000000;

  font-size: 1.05rem;
  font-weight: 900;
}

.chatWelcomePane {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  background:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.86)),
    radial-gradient(circle, rgba(0, 255, 0, 0.16) 1px, transparent 1px);
  background-size: auto, 2rem 2rem;
}

.chatWelcomePane__inner {
  width: min(52rem, 82%);
  text-align: center;
}

.chatWelcomePane__mark {
  width: 8rem;
  height: 8rem;
  margin: 0 auto 2rem;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 2.2rem;
  background: #000000;
  color: #00ff00;

  font-size: 2.6rem;
  font-weight: 900;
}

.chatWelcomePane h2 {
  margin: 0 0 1rem;
  color: #000000;
  font-size: 2.8rem;
}

.chatWelcomePane p {
  margin: 0;
  color: #555555;
  font-size: 1.5rem;
  line-height: 1.6;
}

.chatEmptyState,
.chatThreadEmpty {
  padding: 4rem 2.5rem;
  text-align: center;
}

.chatEmptyState__icon,
.chatThreadEmpty__icon {
  margin-bottom: 1rem;
  font-size: 4rem;
}

.chatEmptyState h2,
.chatThreadEmpty h2 {
  margin: 0 0 0.8rem;
  color: #000000;
  font-size: 2rem;
}

.chatEmptyState p,
.chatThreadEmpty p {
  margin: 0 0 2rem;
  color: #666666;
  font-size: 1.35rem;
  line-height: 1.5;
}

/* Thread */

.chatThread {
  min-width: 0;
  min-height: 0;

  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;

  background:
    linear-gradient(rgba(246, 250, 246, 0.94), rgba(246, 250, 246, 0.94)),
    radial-gradient(circle, rgba(0, 170, 0, 0.18) 1px, transparent 1px);
  background-size: auto, 1.8rem 1.8rem;
}

.chatThreadHeader {
  min-height: 7.2rem;
  padding: 1rem 1.4rem;

  display: flex;
  align-items: center;
  gap: 1rem;

  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: #ffffff;
}

.chatBackButton {
  width: 4rem;
  height: 4rem;

  display: none;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  color: #000000;
  text-decoration: none;
  font-size: 3.5rem;
  line-height: 1;
}

.chatBackButton:hover {
  background: #efffef;
  color: #000000;
}

.chatThreadHeader__person {
  min-width: 0;
  flex: 1 1 auto;

  display: flex;
  align-items: center;
  gap: 1rem;

  color: inherit;
  text-decoration: none;
}

.chatThreadHeader__person span {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chatThreadHeader__person strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: #111111;
  font-size: 1.55rem;
  font-weight: 800;
}

.chatThreadHeader__person small {
  margin-top: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: #707070;
  font-size: 1.15rem;
}

.chatRequestButton {
  flex: 0 0 auto;
  min-height: 4rem;
  padding: 0.8rem 1.3rem;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: #00ff00;
  color: #000000;

  font-size: 1.2rem;
  font-weight: 800;
  text-decoration: none;
}

.chatRequestButton:hover {
  background: #00d900;
  color: #000000;
}

.chatTimeline {
  min-height: 0;
  padding: 2rem clamp(1.2rem, 3vw, 4rem) 3rem;

  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.chatEvent {
  width: 100%;
  margin: 0.8rem 0;

  display: flex;
}

.chatEvent--incoming {
  justify-content: flex-start;
}

.chatEvent--outgoing {
  justify-content: flex-end;
}

.chatBubble {
  max-width: min(72%, 68rem);
  padding: 1rem 1.2rem 0.7rem;

  border-radius: 1.5rem;
  background: #ffffff;
  color: #111111;
  box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.08);
}

.chatEvent--outgoing .chatBubble {
  border-bottom-right-radius: 0.45rem;
  background: #d8ffd8;
}

.chatEvent--incoming .chatBubble {
  border-bottom-left-radius: 0.45rem;
}

.chatBubble__subject {
  margin: 0 0 0.4rem;
  color: #006400;
  font-size: 1.2rem;
  font-weight: 800;
}

.chatBubble__body {
  margin: 0;
  color: #111111;
  font-size: 1.45rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chatBubble__meta {
  margin-top: 0.6rem;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;

  color: #777777;
  font-size: 0.95rem;
}

.chatBubble__meta a {
  color: #5b5b5b;
  text-decoration: underline;
}

/* Request cards inside timeline */

.chatEvent--request {
  margin: 1.5rem 0;
}

.chatRequestCard {
  width: min(78%, 64rem);
  padding: 1.5rem;

  border: 1px solid rgba(0, 170, 0, 0.25);
  border-left: 0.5rem solid #00cc00;
  border-radius: 1.4rem;
  background: #ffffff;
  box-shadow: 0 0.4rem 1.4rem rgba(0, 0, 0, 0.08);
}

.chatEvent--outgoing .chatRequestCard {
  background: #f1fff1;
}

.chatRequestCard__header {
  margin-bottom: 1rem;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.chatRequestCard__label {
  color: #008800;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chatRequestCard h3 {
  margin: 0.2rem 0 0;
  color: #000000;
  font-size: 1.75rem;
  line-height: 1.25;
}

.chatStatus {
  flex: 0 0 auto;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;

  background: #eeeeee;
  color: #222222;

  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

.chatStatus--pending {
  background: #fff3c4;
  color: #755300;
}

.chatStatus--accepted {
  background: #dfffe0;
  color: #006d00;
}

.chatStatus--completed {
  background: #dcecff;
  color: #003d8f;
}

.chatStatus--rejected,
.chatStatus--canceled {
  background: #ffe0e0;
  color: #920000;
}

.chatRequestCard > p {
  margin: 0.55rem 0;
  color: #333333;
  font-size: 1.3rem;
  line-height: 1.45;
}

.chatRequestCard__description {
  padding: 0.8rem 0;
}

.chatRequestCard__details {
  margin: 1rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.chatRequestCard__details div {
  padding: 0.8rem 1rem;
  border-radius: 0.8rem;
  background: #f5f7f5;
}

.chatRequestCard__details dt {
  color: #777777;
  font-size: 1rem;
  font-weight: 700;
}

.chatRequestCard__details dd {
  margin: 0.25rem 0 0;
  color: #111111;
  font-size: 1.25rem;
  font-weight: 700;
}

.chatCompletionState {
  margin: 1rem 0;

  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.chatCompletionState span {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  background: #fff3c4;
  color: #765800;

  font-size: 1.05rem;
  font-weight: 700;
}

.chatCompletionState span.is-done {
  background: #dbffdb;
  color: #006900;
}

.chatRequestCard__actions {
  margin-top: 1.2rem;

  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.chatRequestCard__actions .btn {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0.7rem 1.1rem !important;
  font-size: 1.1rem !important;
}

.chatRequestCard__time {
  display: block;
  margin-top: 1rem;
  color: #888888;
  font-size: 0.95rem;
  text-align: right;
}

/* Composer */

.chatComposer {
  min-height: 7.2rem;
  padding: 1rem 1.3rem;

  display: flex;
  align-items: flex-end;
  gap: 0.9rem;

  border-top: 1px solid rgba(0, 0, 0, 0.11);
  background: #ffffff;
}

.chatComposer__field {
  min-width: 0;
  flex: 1 1 auto;
}

.chatComposer__input {
  width: 100% !important;
  min-height: 4.6rem;
  max-height: 15rem;
  padding: 1.15rem 1.4rem !important;

  resize: none;
  overflow-y: auto;

  border: 1px solid rgba(0, 0, 0, 0.16) !important;
  border-radius: 2.3rem !important;
  outline: none;

  background: #f4f6f4 !important;
  color: #000000 !important;

  font-size: 1.4rem !important;
  line-height: 1.45 !important;
}

.chatComposer__input:focus {
  border-color: #00cc00 !important;
  box-shadow: 0 0 0 3px rgba(0, 255, 0, 0.12);
}

.chatComposer__error {
  margin: 0.4rem 0 0 1rem;
  color: #b00000;
  font-size: 1.05rem;
}

.chatSendButton {
  width: 4.8rem;
  height: 4.8rem;
  flex: 0 0 auto;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 0;
  border-radius: 50%;

  background: #00ff00;
  color: #000000;

  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.chatSendButton:hover {
  background: #00d900;
}

.chatBlockedNotice {
  padding: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff4d8;
  color: #735700;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

/* Tablet / iPad */

@media screen and (max-width: 1400px) {
  .chatPage {
    min-height: calc(
      100dvh - var(--dh-statusbar-height, 0px) - 8.2rem - var(--safe-bottom, 0px)
    );
    padding: 0;
  }

  .chatShell {
    width: 100%;
    height: calc(
      100dvh - var(--dh-statusbar-height, 0px) - 8.2rem - var(--safe-bottom, 0px)
    );
    min-height: 0;

    grid-template-columns: minmax(27rem, 33rem) minmax(0, 1fr);

    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chatSidebar__header {
    min-height: 7rem;
  }

  .chatThreadHeader {
    min-height: 7rem;
  }
}

/* Phone */

@media screen and (max-width: 759px) {
  .chatShell,
  .chatShell--listOnly {
    grid-template-columns: 1fr;
  }

  .chatPage--thread .chatSidebar {
    display: none;
  }

  .chatPage--list .chatWelcomePane {
    display: none;
  }

  .chatPage--list .chatSidebar {
    border-right: 0;
  }

  .chatBackButton {
    display: inline-flex;
  }

  .chatThreadHeader {
    padding-left: 0.5rem;
  }

  .chatRequestButton {
    padding: 0.7rem 1rem;
    font-size: 1rem;
  }

  .chatTimeline {
    padding: 1.3rem 1rem 2rem;
  }

  .chatBubble {
    max-width: 86%;
  }

  .chatRequestCard {
    width: 92%;
  }

  .chatRequestCard__details {
    grid-template-columns: 1fr;
  }

  .chatComposer {
    min-height: 6.8rem;
    padding: 0.8rem;
  }

  .chatSendButton {
    width: 4.5rem;
    height: 4.5rem;
  }
}

/* Very small phone */

@media screen and (max-width: 420px) {
  .chatSidebar__header h1 {
    font-size: 2rem;
  }

  .chatConversation {
    grid-template-columns: 4.8rem minmax(0, 1fr);
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .chatAvatar {
    width: 4.8rem;
    height: 4.8rem;
  }

  .chatThreadHeader__person strong {
    font-size: 1.35rem;
  }

  .chatThreadHeader__person small {
    font-size: 1rem;
  }

  .chatRequestButton {
    max-width: 9.5rem;
    text-align: center;
    line-height: 1.15;
  }
}
