/*
 * Muhuga live chat (inbox, thread, floating widget) and share menu.
 * Loaded with muhuga-ui.css on the front end and on Muhuga → Messages in wp-admin.
 */
.mc, .mc-widget, .mh-share, .mc-ui {
	--mc-green: #16a34a;
	--mc-forest: #0b3d24;
	--mc-lime: #bef264;
	--mc-ink: #0f172a;
	--mc-muted: #64748b;
	--mc-line: rgba(15, 23, 42, .09);
	--mc-bg: #f8fafc;
	font-family: inherit;
	color: var(--mc-ink);
	box-sizing: border-box;
}
.mc *, .mc-widget *, .mh-share *, .mc-ui * { box-sizing: border-box; }

/* ---------------- Avatars, buttons, inputs ---------------- */
.mc-avatar { flex: none; width: 42px; height: 42px; border-radius: 13px; object-fit: cover; background: #fff; box-shadow: 0 0 0 1px var(--mc-line); }
.mc-avatar--initial { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--mc-green), var(--mc-forest)); color: #fff; font-weight: 800; font-size: 17px; box-shadow: none; }
.mc-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border: 0; border-radius: 13px; background: var(--mc-forest); color: #fff !important; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.mc-btn:hover { background: #062b19; }
.mc-btn[disabled] { opacity: .6; cursor: wait; }
.mc-input { width: 100%; border: 1px solid #cbd5e1; border-radius: 14px; padding: 11px 14px; font: inherit; font-size: 15px; line-height: 1.45; color: var(--mc-ink); background: #fff; resize: none; }
.mc-input:focus { outline: none; border-color: var(--mc-green); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.mc-back { flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f1f5f9; color: var(--mc-ink); font-size: 18px; cursor: pointer; }
.mc-back:hover { background: #e2e8f0; }
.mc-safety { margin: 0; padding: 8px 14px; font-size: 12px; color: var(--mc-muted); background: #f8fafc; border-top: 1px solid var(--mc-line); }

/* ---------------- Inbox layout ---------------- */
.mc { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: min(680px, 78vh); border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--mc-line), 0 16px 40px -24px rgba(15, 23, 42, .3); }
.mc-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--mc-line); background: var(--mc-bg); }
.mc-tabs { display: flex; gap: 4px; padding: 10px; border-bottom: 1px solid var(--mc-line); }
.mc-tabs button { flex: 1; padding: 8px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-size: 13px; font-weight: 700; color: var(--mc-muted); cursor: pointer; }
.mc-tabs button[aria-pressed="true"] { background: #fff; color: var(--mc-ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.mc-list { flex: 1; overflow-y: auto; padding: 8px; }
.mc-none { padding: 24px 14px; color: var(--mc-muted); font-size: 14px; text-align: center; }
.mc-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px; border: 0; border-radius: 14px; background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.mc-item:hover { background: #fff; }
.mc-item[aria-current="true"] { background: #fff; box-shadow: 0 0 0 1px rgba(22, 163, 74, .35); }
.mc-item__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mc-item__top { display: flex; justify-content: space-between; gap: 8px; }
.mc-item__top strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-item__top time { flex: none; font-size: 11.5px; color: var(--mc-muted); }
.mc-item__preview { font-size: 13px; color: var(--mc-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-item--unread .mc-item__preview { color: var(--mc-ink); font-weight: 600; }
.mc-badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--mc-green); color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.mc-pane { display: flex; min-width: 0; min-height: 0; }
.mc-empty { margin: auto; text-align: center; color: var(--mc-muted); }
.mc-empty span { font-size: 40px; }

/* ---------------- Thread ---------------- */
.mc-thread { display: flex; flex-direction: column; width: 100%; min-height: 0; background: #fff; }
.mc-thread__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--mc-line); }
.mc-thread__who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mc-thread__who strong { font-size: 15.5px; }
.mc-thread__who span { font-size: 12.5px; color: var(--mc-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-thread__link { font-size: 13px; font-weight: 700; color: var(--mc-green); text-decoration: none; white-space: nowrap; }
.mc-messages { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 8px; background:
	radial-gradient(circle at 20% 0%, rgba(190, 242, 100, .12), transparent 40%), linear-gradient(#f8fafc, #f8fafc); }
.mc-msg { max-width: min(78%, 520px); display: flex; flex-direction: column; gap: 3px; animation: mc-pop .18s ease-out both; }
.mc-msg__name { font-size: 11.5px; font-weight: 700; color: var(--mc-muted); padding-left: 4px; }
.mc-msg__body { padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.mc-msg__time { font-size: 11px; color: #94a3b8; padding: 0 6px; }
.mc-msg--theirs { align-self: flex-start; }
.mc-msg--theirs .mc-msg__body { background: #fff; border: 1px solid var(--mc-line); border-bottom-left-radius: 6px; }
.mc-msg--mine { align-self: flex-end; align-items: flex-end; }
.mc-msg--mine .mc-msg__body { background: linear-gradient(135deg, var(--mc-green), #15803d); color: #fff; border-bottom-right-radius: 6px; }
.mc-msg--admin.mc-msg--theirs .mc-msg__body { background: #ecfdf5; border-color: rgba(22, 163, 74, .25); }
.mc-composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--mc-line); background: #fff; }
.mc-send { flex: none; width: 46px; height: 46px; border: 0; border-radius: 14px; background: var(--mc-forest); color: var(--mc-lime); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.mc-send:hover { background: #062b19; }
.mc-send[disabled] { opacity: .6; }
@keyframes mc-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
	.mc { grid-template-columns: minmax(0, 1fr); height: min(640px, 80vh); }
	.mc-side { border-right: 0; }
	.mc .mc-pane { display: none; }
	.mc.mc--thread-open .mc-side { display: none; }
	.mc.mc--thread-open .mc-pane { display: flex; }
}
@media (min-width: 761px) { .mc .mc-thread__head .mc-back { display: none; } }

/* ---------------- Floating widget (farm & product pages) ---------------- */
.mc-widget { position: fixed; right: 20px; bottom: 20px; z-index: 99990; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.mc-widget__fab { display: inline-flex; align-items: center; gap: 9px; height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 999px; background: linear-gradient(135deg, var(--mc-forest), #136b3c); color: #fff; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 16px 36px -10px rgba(6, 43, 25, .65); transition: transform .15s ease; }
.mc-widget__fab:hover { transform: translateY(-2px); }
.mc-widget__fab svg { color: var(--mc-lime); }
.mc-widget__panel { position: relative; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: #fff; box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .45), 0 0 0 1px var(--mc-line); animation: mc-pop .2s ease-out both; }
.mc-widget__panel[hidden] { display: none !important; }
.mc-widget__head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: linear-gradient(150deg, var(--mc-forest), #062b19); color: #fff; }
.mc-widget__head > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mc-widget__head strong { font-size: 16px; }
.mc-widget__head span { font-size: 13px; color: rgba(236, 253, 243, .75); }
.mc-widget__head .mc-back { background: rgba(255, 255, 255, .12); color: #fff; }
.mc-widget__close { flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; font-size: 15px; }
.mc-widget__close--float { position: absolute; top: 14px; right: 14px; z-index: 2; background: #f1f5f9; color: var(--mc-ink); }
.mc-widget__body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.mc-choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--mc-line); border-radius: 16px; background: #fff; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.mc-choice:hover { border-color: rgba(22, 163, 74, .5); box-shadow: 0 10px 24px -16px rgba(11, 61, 36, .5); }
.mc-choice > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mc-choice strong { font-size: 15px; }
.mc-choice > span:nth-child(2) > span { font-size: 13px; color: var(--mc-muted); }
.mc-choice__go { color: var(--mc-green); font-weight: 800; }
.mc-widget__body .mc-safety { border: 0; border-radius: 12px; margin-top: auto; }
.mc-widget__start { justify-content: flex-end; }
.mc-widget__start .mc-input { min-height: 110px; }
.mc-widget__login p { margin: 0 0 6px; color: #334155; line-height: 1.6; }
.mc-widget .mc-thread--compact { height: 100%; }
.mc-widget .mc-thread--compact .mc-thread__head { padding-right: 56px; }
@media (max-width: 520px) {
	.mc-widget { right: 12px; bottom: 12px; left: 12px; align-items: stretch; }
	.mc-widget__fab { align-self: flex-end; }
	.mc-widget__panel { width: 100%; height: calc(100vh - 100px); }
}

/* ---------------- Share menu ---------------- */
.mh-share { position: absolute; z-index: 99995; padding: 16px; border-radius: 20px; background: #fff; box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .45), 0 0 0 1px var(--mc-line); animation: mc-pop .16s ease-out both; }
.mh-share__title { margin: 0 0 12px; font-size: 14px; font-weight: 800; color: var(--mc-ink); }
.mh-share__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mh-share__item { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 4px; border: 0; border-radius: 14px; background: transparent; font: inherit; font-size: 12px; font-weight: 600; color: #334155 !important; text-decoration: none !important; cursor: pointer; }
.mh-share__item:hover, .mh-share__item:focus-visible { background: #f1f5f9; outline: none; }
.mh-share__icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: #f8fafc; box-shadow: 0 0 0 1px var(--mc-line); }
.mh-share__icon svg { width: 28px; height: 28px; }
.mh-share__link { margin-top: 12px; padding: 9px 12px; border-radius: 12px; background: #f8fafc; font-size: 12.5px; color: var(--mc-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
	.mc-msg, .mc-widget__panel, .mh-share { animation: none !important; }
}
/* Themes often give textareas a large min-height; the composer grows with its content instead. */
.mc-composer .mc-input { min-height: 46px !important; height: 46px; max-height: 140px; }
.mc-widget__start .mc-input { height: auto; }
.woocommerce-MyAccount-navigation-link--muhuga-messages { --mh-nav-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12Z'/%3E%3C/svg%3E"); }

/* Attachments, typing, seen */
.mc-attach { flex: none; width: 40px; height: 46px; border: 0; border-radius: 12px; background: transparent; color: var(--mc-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.mc-attach:hover, .mc-attach:focus-visible { background: #f1f5f9; color: var(--mc-ink); }
.mc-file-chip { display: flex; align-items: center; gap: 10px; margin: 0 14px; padding: 8px 10px; border-radius: 12px; background: #f1f5f9; font-size: 13px; }
.mc-file-chip[hidden] { display: none; }
.mc-file-chip img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.mc-file-chip__icon { font-size: 22px; }
.mc-file-chip__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mc-file-chip button { border: 0; background: transparent; cursor: pointer; font-size: 14px; color: var(--mc-muted); padding: 4px 8px; }
.mc-msg__image { display: block; border-radius: 16px; overflow: hidden; max-width: 260px; box-shadow: 0 0 0 1px var(--mc-line); background: #f1f5f9; }
.mc-msg__image img { display: block; width: 100%; height: auto; max-height: 280px; object-fit: cover; }
.mc-msg__file { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--mc-line); color: var(--mc-ink) !important; text-decoration: none; }
.mc-msg__file > span:first-child { font-size: 24px; }
.mc-msg__file strong { display: block; font-size: 13.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-msg__file small { color: var(--mc-muted); font-size: 12px; }
.mc-msg__seen { font-size: 11px; font-weight: 700; color: var(--mc-green); padding: 0 6px; }
.mc-typing { padding: 4px 18px 8px; font-size: 12.5px; font-style: italic; color: var(--mc-muted); }
.mc-typing[hidden] { display: none; }
.mc-composer__extra:empty { display: none; }
.mc-composer__extra { padding: 8px 14px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.mc-chip-btn { border: 1px solid var(--mc-line); background: #f8fafc; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; color: var(--mc-forest); cursor: pointer; }
.mc-chip-btn:hover { background: #ecfdf5; border-color: rgba(22, 163, 74, .35); }
.mc-btn--ghost { background: #fff; color: var(--mc-ink) !important; box-shadow: inset 0 0 0 1px #cbd5e1; }
.mc-btn--ghost:hover { background: #f8fafc; }

/* System notes (quote accepted, order paid…) */
.mc-msg--system { align-self: center; max-width: 92%; align-items: center; }
.mc-msg--system .mc-msg__time { display: none; }
.mc-system { padding: 7px 14px; border-radius: 999px; background: #ecfdf5; color: #166534; font-size: 12.5px; font-weight: 600; text-align: center; }

/* Quote card */
.mc-msg--quote { max-width: min(92%, 420px); }
.mc-quote { width: 100%; min-width: 260px; border-radius: 18px; background: #fff; border: 1px solid var(--mc-line); box-shadow: 0 8px 24px -18px rgba(15, 23, 42, .35); overflow: hidden; color: var(--mc-ink); }
.mc-quote__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: linear-gradient(135deg, var(--mc-forest), #14532d); color: #fff; }
.mc-quote__status { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: var(--mc-lime); }
.mc-quote--declined .mc-quote__status, .mc-quote--withdrawn .mc-quote__status, .mc-quote--expired .mc-quote__status { color: #fecaca; }
.mc-quote__items { list-style: none; margin: 0; padding: 6px 14px; }
.mc-quote__items li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--mc-line); }
.mc-quote__items img, .mc-quote__noimg { flex: none; width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: #f0fdf4; display: inline-flex; align-items: center; justify-content: center; }
.mc-quote__name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; }
.mc-quote__name small { color: var(--mc-muted); font-size: 12px; }
.mc-quote__amt { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.mc-quote__row { display: flex; justify-content: space-between; padding: 6px 14px; font-size: 13.5px; }
.mc-quote__total { font-size: 15px; border-top: 1px solid var(--mc-line); padding-top: 10px; }
.mc-quote__note { margin: 6px 14px; padding: 8px 10px; border-radius: 10px; background: #f8fafc; font-size: 13px; white-space: pre-wrap; }
.mc-quote__meta { margin: 4px 14px 10px; font-size: 12px; color: var(--mc-muted); }
.mc-quote__actions { display: flex; gap: 8px; padding: 0 14px 12px; flex-wrap: wrap; }
.mc-quote__actions .mc-btn { min-height: 40px; padding: 0 16px; font-size: 14px; flex: 1; }
.mc-quote__safe { margin: 0; padding: 8px 14px; font-size: 12px; color: #166534; background: #f0fdf4; }

/* Quote builder dialog */
.mc-qb { display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; }
.mc-qb .mc-input { width: 100%; max-width: 100%; }
.mc-qb__labels, .mc-qb__row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, .8fr) minmax(0, 1.1fr) 32px; gap: 8px; align-items: center; }
.mc-qb__labels span { font-size: 12px; font-weight: 700; color: var(--mc-muted); }
.mc-qb .mc-input { padding: 9px 10px; font-size: 14px; border-radius: 10px; min-height: 0; }
.mc-qb__remove { border: 0; background: transparent; color: var(--mc-muted); cursor: pointer; font-size: 15px; }
.mc-qb__add { align-self: flex-start; border: 0; background: none; color: var(--mc-green); font: inherit; font-weight: 700; cursor: pointer; padding: 4px 0; }
.mc-qb__field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; }
.mc-qb__total { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: #f0fdf4; font-size: 15px; }
@media (max-width: 560px) {
	.mc-qb__labels { display: none; }
	.mc-qb__row { grid-template-columns: 1fr 1fr 32px; }
	.mc-qb__row select { grid-column: 1 / -1; }
}
.mc-widget__fab { position: relative; }
.mc-widget__badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff; }
.mc-widget__badge[hidden] { display: none; }
