/* ═══════════════════════════════════════════════════════
   MLH Messaging — Contact Form & Inbox
   ═══════════════════════════════════════════════════════ */

/* ── Shared tokens ── */
:root {
  --mlh-teal:   #1D9E75;
  --mlh-navy:   #0d1b2a;
  --mlh-gold:   #B8985F;
  --mlh-dark:   #1e293b;
  --mlh-mid:    #475569;
  --mlh-light:  #94a3b8;
  --mlh-border: rgba(0,0,0,.1);
  --mlh-radius: 10px;
  --mlh-font:   'DM Sans', sans-serif;
}

/* ═══════════════════════════════════════════════════════
   CONTACT FORM
   ═══════════════════════════════════════════════════════ */

.mlh-cf {
  background: #fff;
  border: 1px solid var(--mlh-border);
  border-radius: var(--mlh-radius);
  overflow: hidden;
  max-width: 680px;
  font-family: var(--mlh-font);
}

.mlh-cf__head {
  background: var(--mlh-navy);
  padding: 24px 28px 20px;
  color: #fff;
}
.mlh-cf__lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mlh-teal);
  margin-bottom: 8px;
}
.mlh-cf__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px;
}
.mlh-cf__subtitle {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  margin: 0;
  line-height: 1.5;
}

.mlh-cf__form {
  padding: 24px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mlh-cf__row {
  display: grid;
  gap: 14px;
}
.mlh-cf__row--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 540px) {
  .mlh-cf__row--2 { grid-template-columns: 1fr; }
}

.mlh-cf__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}
.mlh-cf__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mlh-dark);
  letter-spacing: .01em;
}
.mlh-cf__req { color: #e11d48; margin-left: 1px; }
.mlh-cf__opt { color: var(--mlh-light); font-weight: 400; font-size: 11px; margin-left: 4px; }

.mlh-cf__input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  font-family: var(--mlh-font);
  color: var(--mlh-dark);
  background: #fff;
  transition: border-color .18s;
  box-sizing: border-box;
  appearance: none;
}
.mlh-cf__input:focus {
  outline: none;
  border-color: var(--mlh-teal);
  box-shadow: 0 0 0 3px rgba(29,158,117,.12);
}
.mlh-cf__textarea { resize: vertical; min-height: 110px; }
.mlh-cf__select { cursor: pointer; }

.mlh-cf__counter {
  font-size: 11px;
  color: var(--mlh-light);
  text-align: right;
  margin-top: 2px;
}

.mlh-cf__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--mlh-mid);
  line-height: 1.5;
}
.mlh-cf__consent input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--mlh-teal);
  cursor: pointer;
}
.mlh-cf__consent a { color: var(--mlh-teal); }

.mlh-cf__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mlh-cf__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--mlh-teal);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-family: var(--mlh-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, transform .1s;
  align-self: flex-start;
}
.mlh-cf__btn:hover  { background: #178a64; }
.mlh-cf__btn:active { transform: scale(.98); }
.mlh-cf__btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.mlh-cf__disclaimer {
  font-size: 11.5px;
  color: var(--mlh-light);
  margin: 0;
  line-height: 1.5;
}

.mlh-cf__feedback {
  border-radius: 7px;
  padding: 0;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .2s;
}
.mlh-cf__feedback.success {
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.mlh-cf__feedback.error {
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* ═══════════════════════════════════════════════════════
   INBOX — THREAD LIST
   ═══════════════════════════════════════════════════════ */

.mlh-inbox {
  font-family: var(--mlh-font);
  margin-top: 8px;
}

.mlh-inbox__hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.mlh-inbox__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mlh-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mlh-inbox__badge {
  display: inline-block;
  padding: 2px 10px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.mlh-inbox__empty {
  padding: 32px 0;
  color: var(--mlh-mid);
  font-size: 14px;
  line-height: 1.7;
}

.mlh-thread-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--mlh-border);
  border-radius: var(--mlh-radius);
  overflow: hidden;
}

.mlh-thread-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-bottom: 1px solid var(--mlh-border);
  transition: background .15s;
}
.mlh-thread-row:last-child { border-bottom: none; }
.mlh-thread-row:hover      { background: #f8fafc; }
.mlh-thread-row--unread    { background: #f0fdf8; }
.mlh-thread-row--unread:hover { background: #e8f9f3; }

.mlh-thread-row__avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: var(--mlh-teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.mlh-thread-row__body {
  flex: 1;
  min-width: 0;
}
.mlh-thread-row__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.mlh-thread-row__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--mlh-dark);
  white-space: nowrap;
}
.mlh-thread-row__time {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--mlh-light);
  white-space: nowrap;
}
.mlh-thread-row__bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mlh-thread-row__subject {
  font-size: 12.5px;
  color: var(--mlh-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.mlh-thread-row__count {
  font-size: 11px;
  color: var(--mlh-light);
  white-space: nowrap;
}

.mlh-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mlh-teal);
  flex-shrink: 0;
}

/* Status badges */
.mlh-thread-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.mlh-thread-status--open     { background: #fef3c7; color: #92400e; }
.mlh-thread-status--replied  { background: #d1fae5; color: #065f46; }
.mlh-thread-status--closed   { background: #f3f4f6; color: #6b7280; }
.mlh-thread-status--archived { background: #e5e7eb; color: #9ca3af; }

/* ═══════════════════════════════════════════════════════
   THREAD VIEW
   ═══════════════════════════════════════════════════════ */

.mlh-thread-view {
  font-family: var(--mlh-font);
}

.mlh-thread-view__nav {
  margin-bottom: 16px;
}
.mlh-thread-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mlh-teal);
  text-decoration: none;
}
.mlh-thread-back:hover { text-decoration: underline; }

.mlh-thread-view__hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--mlh-border);
  border-radius: var(--mlh-radius);
  margin-bottom: 16px;
}
.mlh-thread-view__subject {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mlh-dark);
  margin: 0 0 6px;
}
.mlh-thread-view__client {
  font-size: 13px;
  color: var(--mlh-mid);
}
.mlh-thread-view__client a { color: var(--mlh-teal); text-decoration: none; }
.mlh-thread-view__client a:hover { text-decoration: underline; }

/* Message bubbles */
.mlh-msg-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.mlh-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.mlh-msg--professional {
  flex-direction: row-reverse;
}

.mlh-msg__avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: var(--mlh-mid);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.mlh-msg--professional .mlh-msg__avatar {
  background: var(--mlh-teal);
}

.mlh-msg__bubble {
  max-width: 72%;
  background: #fff;
  border: 1px solid var(--mlh-border);
  border-radius: 12px;
  padding: 12px 16px;
}
.mlh-msg--professional .mlh-msg__bubble {
  background: #f0fdf8;
  border-color: rgba(29,158,117,.2);
}

.mlh-msg__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.mlh-msg__name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mlh-dark);
}
.mlh-msg__you {
  font-size: 10.5px;
  background: var(--mlh-teal);
  color: #fff;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .03em;
}
.mlh-msg__time {
  font-size: 11px;
  color: var(--mlh-light);
  margin-left: auto;
}
.mlh-msg__body {
  font-size: 14px;
  color: var(--mlh-dark);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Reply box */
.mlh-reply-box {
  background: #fff;
  border: 1px solid var(--mlh-border);
  border-radius: var(--mlh-radius);
  padding: 20px;
}
.mlh-reply-box__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--mlh-dark);
  margin: 0 0 12px;
}
.mlh-reply-form__textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  font-family: var(--mlh-font);
  color: var(--mlh-dark);
  background: #fff;
  resize: vertical;
  min-height: 90px;
  box-sizing: border-box;
  transition: border-color .18s;
}
.mlh-reply-form__textarea:focus {
  outline: none;
  border-color: var(--mlh-teal);
  box-shadow: 0 0 0 3px rgba(29,158,117,.12);
}
.mlh-reply-form__footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}
.mlh-reply-form__note {
  font-size: 12px;
  color: var(--mlh-light);
}

/* Mobile responsive */
@media (max-width: 600px) {
  .mlh-thread-row__avatar { width: 36px; height: 36px; font-size: .85rem; }
  .mlh-thread-view__hdr { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mlh-thread-view__client { font-size: .8rem; flex-wrap: wrap; }
  .mlh-msg { gap: 8px; }
  .mlh-msg__avatar { width: 32px; height: 32px; font-size: .78rem; }
  .mlh-reply-box { padding: 16px; }
  .mlh-reply-form__footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mlh-reply-form__footer .mlh-cf__btn { width: 100%; justify-content: center; }
}
