/* ═══════════════════════════════════════════════════════════════ */
/* Rainbow Live Chat — WhatsApp Web parity overrides               */
/* Loaded after livechat-core/ui so it can refine tokens without   */
/* touching feature CSS. Values follow web.whatsapp.com light theme */
/* ═══════════════════════════════════════════════════════════════ */

:root {
  --wa-font: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  --wa-teal: #00a884;
  --wa-teal-dark: #008069;
  --wa-green: #25d366;
  --wa-panel: #f0f2f5;
  --wa-panel-hover: #f5f6f6;
  --wa-border: #e9edef;
  --wa-text: #111b21;
  --wa-text-secondary: #667781;
  --wa-icon: #54656f;
  --wa-bubble-out: #d9fdd3;
  --wa-bubble-in: #ffffff;
  --wa-chat-bg: #efeae2;
  --wa-tick-read: #53bdeb;
}

.lc-container,
.lc-container button,
.lc-container input,
.lc-container textarea,
.lc-container select {
  font-family: var(--wa-font);
}

/* ── Sidebar header ─────────────────────────────────────────────── */
.lc-sidebar-header { background: #fff; border-bottom: none; padding: 0 0 6px; gap: 0; }
.lc-sidebar-topbar { background: #fff; padding: 12px 16px 6px; }
.lc-sidebar-title { font-size: 22px; font-weight: 700; color: var(--wa-text); }
.lc-search-wrap {
  margin: 4px 12px 0;
  height: 35px;
  background: var(--wa-panel);
  border: 1px solid transparent;
  border-radius: 8px;
  flex: 0 0 auto;
}
.lc-search-wrap:focus-within { border-color: transparent; background: #fff; box-shadow: inset 0 0 0 1px var(--wa-teal); }
.lc-search { font-size: 15px; }
.lc-search::placeholder { color: #8696a0; }

/* ── Filter chips: single WA row ────────────────────────────────── */
.lc-filter-chips {
  padding: 4px 12px 8px;
  gap: 6px;
  row-gap: 6px;
  border-bottom: none;
  align-items: center;
  flex-wrap: wrap;
  overflow: visible;
}
.lc-chip {
  background: #fff;
  color: var(--wa-icon);
  border: 1px solid var(--wa-border);
  border-radius: 24px;
  padding: 4px 12px;
  font-size: 14px;
  line-height: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lc-chip:hover { background: var(--wa-panel-hover); }
.lc-chip.active { background: #e7fce3; color: var(--wa-teal-dark); border-color: #e7fce3; }
.lc-chip-icon { padding: 4px 8px; }
.lc-chip-divider { width: 1px; height: 18px; background: var(--wa-border); margin: 0 2px; flex: 0 0 1px; }
.lc-channel-chips { display: inline-flex; gap: 4px; }

/* ── Chat list rows ─────────────────────────────────────────────── */
.lc-chat-list { background: #fff; }
.lc-chat-item {
  padding: 0 16px 0 13px;
  height: 72px;
  align-items: center;
  border-bottom: none;
  transition: background .1s;
}
.lc-chat-item:hover { background: var(--wa-panel-hover); }
.lc-chat-item.active { background: var(--wa-panel); }
.lc-avatar { width: 49px; height: 49px; margin-right: 15px; font-size: 18px; }
/* WA default avatar: neutral grey disc with white silhouette (no per-contact colours) */
.lc-avatar .avatar-initials, .lc-header-avatar .avatar-initials, .lc-contact-avatar .avatar-initials {
  background-color: #dfe5e7 !important;
  color: transparent;
  font-size: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 212 212'%3E%3Ccircle cx='106' cy='106' r='106' fill='%23dfe5e7'/%3E%3Ccircle cx='106' cy='84' r='36' fill='%23fff'/%3E%3Cpath fill='%23fff' d='M40 176c10-32 36-48 66-48s56 16 66 48c-17 20-40 32-66 32s-49-12-66-32z'/%3E%3C/svg%3E") !important;
  background-size: cover;
}
.lc-chat-info { border-top: 1px solid #f0f2f5; height: 100%; justify-content: center; }
.lc-chat-item:first-child .lc-chat-info { border-top-color: transparent; }
.lc-chat-item:hover .lc-chat-info, .lc-chat-item.active .lc-chat-info { border-top-color: transparent; }
.lc-chat-name { font-size: 17px; font-weight: 400; color: var(--wa-text); line-height: 21px; }
.lc-chat-time { font-size: 12px; color: var(--wa-text-secondary); line-height: 14px; margin-left: 6px; }
.lc-chat-time-unread { color: #1daa61; }
.lc-chat-top { margin-bottom: 2px; align-items: baseline; }
.lc-chat-phone { font-size: 12px; color: var(--wa-text-secondary); margin-left: 6px; white-space: nowrap; flex-shrink: 0; }
.lc-chat-preview { font-size: 14px; color: var(--wa-text-secondary); line-height: 20px; display: flex; align-items: center; gap: 2px; min-width: 0; }
.lc-chat-preview-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lc-preview-ticks { flex: 0 0 auto; margin-right: 2px; }
.lc-preview-ticks svg { width: 16px; height: 11px; }
.lc-preview-bot { flex: 0 0 auto; }
.lc-has-unread .lc-chat-name { font-weight: 500; }
.lc-has-unread .lc-chat-preview { color: var(--wa-text); font-weight: 500; }
.lc-unread { background: var(--wa-green); color: #fff; font-size: 12px; font-weight: 500; min-width: 20px; height: 20px; }
.lc-hover-actions { background: linear-gradient(to right, transparent 0%, var(--wa-panel-hover) 30%); }
.lc-chat-item.active .lc-hover-actions { background: linear-gradient(to right, transparent 0%, var(--wa-panel) 30%); }
.lc-channel-badge { margin-left: 4px; flex: 0 0 auto; }

/* ── Chat header ────────────────────────────────────────────────── */
.lc-chat-header { height: 59px; padding: 10px 16px; background: var(--wa-panel); border-bottom: none; }
.lc-header-avatar { width: 40px; height: 40px; }
.lc-header-info { margin-left: 15px; }
.lc-header-name { font-size: 16px; font-weight: 400; color: var(--wa-text); line-height: 21px; }
.lc-header-phone { font-size: 13px; color: var(--wa-text-secondary); line-height: 20px; }
.lc-header-actions { gap: 4px; }
.lc-header-actions button:hover { background: rgba(11, 20, 26, .1); }

/* ── Messages ───────────────────────────────────────────────────── */
.lc-messages { padding: 12px 6% 8px; gap: 0; background-color: #efeae2; }
/* stronger doodle contrast so the wallpaper reads as WA's, not flat grey */
.lc-messages { background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cstyle%3E.d%7Bfill:%23cfc7ba;opacity:.6%7D%3C/style%3E%3C/defs%3E%3Cpath class='d' d='M20 15c1.5 0 3-1 3-2.5s-1-2-2.5-2.5c.5-1 0-2.5-1.2-3-.5-1.5-2-2-3.3-1.5-1-1.5-2.8-1.5-3.8 0-1.3-.5-2.8 0-3.3 1.5-1.2.5-1.7 2-1.2 3C6.2 10.5 5 12 5 13.5 5 15.5 7 17 9 17h11z'/%3E%3Ccircle class='d' cx='60' cy='30' r='3'/%3E%3Ccircle class='d' cx='62' cy='30' r='3'/%3E%3Cpath class='d' d='M58 33c0-1.5 2-3 4-3s4 1.5 4 3'/%3E%3Cpath class='d' d='M140 20l2-6 2 6-6-4h8z'/%3E%3Ccircle class='d' cx='100' cy='50' r='6' fill='none' stroke='%23cfc7ba' stroke-width='1.2' opacity='.4'/%3E%3Cpath class='d' d='M100 44v3m0 6v3m-6-6h3m6 0h3'/%3E%3Cpath class='d' d='M30 70l8 0 0 6-8 0z' fill='none' stroke='%23cfc7ba' stroke-width='1' opacity='.35'/%3E%3Cpath class='d' d='M34 70v-3m-2 3v-2'/%3E%3Cpath class='d' d='M170 60c-2 0-3.5 1.5-3.5 3s1.5 3 3.5 3 3.5-1.5 3.5-3-1.5-3-3.5-3zm-1 2.5c-.4 0-.7-.3-.7-.7s.3-.7.7-.7.7.3.7.7-.3.7-.7.7z'/%3E%3Cpath class='d' d='M80 90h12v8H80z' fill='none' stroke='%23cfc7ba' stroke-width='1' opacity='.35'/%3E%3Cpath class='d' d='M82 94h8M82 96h5'/%3E%3Cpath class='d' d='M150 100l-4 8h8z' fill='none' stroke='%23cfc7ba' stroke-width='1' opacity='.4'/%3E%3Cpath class='d' d='M40 130a5 5 0 1 1 10 0 5 5 0 1 1-10 0z' fill='none' stroke='%23cfc7ba' stroke-width='1' opacity='.35'/%3E%3Cpath class='d' d='M42 130h6m-3-3v6'/%3E%3Cpath class='d' d='M120 140l3-8 3 8-8-5h10z' fill='none' stroke='%23cfc7ba' stroke-width='1' opacity='.35'/%3E%3Cpath class='d' d='M175 150c0 0 2-4 4-4s4 4 4 4' fill='none' stroke='%23cfc7ba' stroke-width='1.2' opacity='.4'/%3E%3Cpath class='d' d='M177 146c1-1 2-1.5 2-1.5m4 5.5c0 0 1-.5 2-1.5'/%3E%3Cpath class='d' d='M15 170h6v8h-6z' fill='none' stroke='%23cfc7ba' stroke-width='1' opacity='.3'/%3E%3Ccircle class='d' cx='18' cy='174' r='1.5'/%3E%3Cpath class='d' d='M100 170l5-3v6z'/%3E%3C/svg%3E"); }
.lc-date-sep { margin: 10px 0 12px; }
.lc-date-sep span {
  background: #fff;
  color: #54656f;
  font-size: 12.5px;
  line-height: 21px;
  padding: 5px 12px 6px;
  border-radius: 7.5px;
  text-transform: uppercase;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.lc-bubble-wrap { margin-bottom: 12px; }
.lc-bubble-wrap.continuation { margin-bottom: 2px; }
.lc-bubble-wrap + .lc-bubble-wrap.continuation { margin-top: -10px; }
.lc-bubble { max-width: 65%; font-size: 14.2px; line-height: 19px; padding: 6px 7px 8px 9px; border-radius: 7.5px; }
.lc-bubble.guest { background: var(--wa-bubble-in); }
.lc-bubble.bot { background: var(--wa-bubble-out); }
.lc-bubble-meta { font-size: 11px; color: var(--wa-text-secondary); }
.lc-bubble.bot .lc-bubble-meta { color: rgba(17, 27, 33, .6); }
.lc-ticks-read { color: var(--wa-tick-read); }
.lc-ticks svg, .lc-preview-ticks svg { width: 18px; height: 12px; }
.lc-ticks-delivered, .lc-ticks-sent { color: #8696a0; }
.lc-ticks-pending { color: #8696a0; }
.lc-ticks-pending svg { width: 14px; height: 14px; }
.lc-bubble-wrap.lc-pending .lc-bubble { opacity: .85; }
.lc-bubble-chevron { position: absolute; top: 3px; right: 5px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0; }
.lc-bubble.guest .lc-bubble-chevron { background: linear-gradient(to left, #fff 60%, rgba(255,255,255,0)); }
.lc-bubble.bot .lc-bubble-chevron { background: linear-gradient(to left, var(--wa-bubble-out) 60%, rgba(217,253,211,0)); }

/* Scroll-to-bottom FAB (WA) */
.lc-scroll-fab {
  position: absolute;
  right: 20px;
  bottom: 78px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--wa-icon);
  box-shadow: 0 1px 1px rgba(11, 20, 26, .06), 0 2px 5px rgba(11, 20, 26, .2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.lc-scroll-fab:hover { background: var(--wa-panel-hover); }
.lc-scroll-fab-count {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--wa-green);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  text-align: center;
}

/* ── Composer ───────────────────────────────────────────────────── */
.lc-input-area { background: var(--wa-panel); padding: 6px 16px 10px; gap: 6px; min-height: 62px; }
.lc-emoji-wrap { position: relative; flex-shrink: 0; }
.lc-emoji-btn, .lc-attach-btn, .lc-mic-btn, .lc-schedule-btn {
  background: none; border: none; cursor: pointer; padding: 8px; border-radius: 50%;
  color: var(--wa-icon); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.lc-emoji-btn:hover, .lc-attach-btn:hover, .lc-mic-btn:hover, .lc-schedule-btn:hover { background: rgba(11, 20, 26, .1); color: var(--wa-icon); }
.lc-emoji-btn.active { color: var(--wa-teal); }
/* WA uses a plain "+" icon, not a filled green circle */
.lc-attach-plus { background: none; color: var(--wa-icon); width: 40px; height: 40px; }
.lc-attach-plus:hover { background: rgba(11, 20, 26, .1); color: var(--wa-icon); }
.lc-input-box {
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px 11px;
  font-size: 15px;
  line-height: 20px;
  min-height: 42px;
  color: var(--wa-text);
}
.lc-input-box::placeholder { color: #8696a0; }
/* mic ↔ send toggle: send only appears once there is content */
.lc-send-btn { display: none; background: var(--wa-teal); color: #fff; width: 40px; height: 40px; }
.lc-send-btn:hover:not(:disabled) { background: var(--wa-teal-dark); }
.lc-send-btn svg { width: 22px; height: 22px; }
.lc-input-area.lc-has-text .lc-send-btn { display: flex; }
.lc-input-area.lc-has-text .lc-mic-btn { display: none; }
.lc-input-area.lc-has-text .lc-schedule-btn { display: flex; }

.lc-emoji-picker {
  position: absolute;
  bottom: 48px;
  left: 0;
  width: 352px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16);
  padding: 8px;
  z-index: 60;
  animation: lc-attach-slide-up .15s ease-out;
}
.lc-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 260px; overflow-y: auto; }
.lc-emoji-cell {
  background: none; border: none; cursor: pointer; font-size: 22px; line-height: 1;
  width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.lc-emoji-cell:hover { background: var(--wa-panel); }

/* ── Empty state (right pane) ───────────────────────────────────── */
.lc-empty-state { background: #f0f2f5; border-bottom: 6px solid var(--wa-teal); }
.lc-empty-state h3 { font-size: 32px; font-weight: 300; color: #41525d; }
.lc-empty-state p { font-size: 14px; color: #667781; line-height: 20px; max-width: 460px; }

/* ── Scrollbars like WA Web ──────────────────────────────────────── */
.lc-chat-list::-webkit-scrollbar, .lc-messages::-webkit-scrollbar { width: 6px; }
.lc-chat-list::-webkit-scrollbar-thumb, .lc-messages::-webkit-scrollbar-thumb { background: rgba(11, 20, 26, .2); border-radius: 3px; }
.lc-chat-list::-webkit-scrollbar-track, .lc-messages::-webkit-scrollbar-track { background: transparent; }

/* ── Reactions chip + emoji picker sections ─────────────────────── */
.lc-bubble-wrap.lc-has-reaction { margin-bottom: 22px; }
.lc-msg-reaction {
  position: absolute;
  bottom: -14px;
  background: #fff;
  border: 1px solid #e9edef;
  border-radius: 12px;
  padding: 1px 6px;
  font-size: 13px;
  line-height: 18px;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  cursor: default;
}
.lc-bubble-wrap.guest .lc-msg-reaction { left: 6px; }
.lc-bubble-wrap.bot .lc-msg-reaction { right: 6px; }
.lc-emoji-section { font-size: 12px; color: #667781; padding: 6px 8px 2px; text-transform: uppercase; letter-spacing: .02em; }
.lc-emoji-picker { max-height: 340px; overflow-y: auto; }
.lc-emoji-grid { max-height: none; overflow: visible; }

/* ── Quote block (reply) + failed send ──────────────────────────── */
.lc-quote {
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(11, 20, 26, .05);
  border-left: 4px solid var(--wa-teal);
  border-radius: 6px;
  padding: 5px 10px 6px 8px;
  margin: -2px 0 6px;
  font-size: 13px; line-height: 18px;
  cursor: default;
}
.lc-bubble.bot .lc-quote { background: rgba(11, 20, 26, .06); border-left-color: #06cf9c; }
.lc-quote-author { color: var(--wa-teal-dark); font-weight: 500; font-size: 12.5px; }
.lc-quote-text { color: var(--wa-text-secondary); white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.lc-bubble-wrap.lc-failed .lc-bubble { opacity: 1; box-shadow: 0 0 0 1px #f15c6d inset; }
.lc-retry-btn { background: none; border: none; color: #f15c6d; font-size: 11px; cursor: pointer; padding: 0 2px; margin-left: 4px; font-family: inherit; }
.lc-retry-btn:hover { text-decoration: underline; }

/* ── WhatsApp SVG bubble tails (replace CSS triangles) ──────────── */
.lc-bubble.guest::before, .lc-bubble.bot::before {
  border: none; width: 8px; height: 13px; top: 0;
  background-repeat: no-repeat; background-size: 8px 13px;
}
.lc-bubble.guest::before {
  left: -8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath fill='%23fff' d='M1.533 3.568L8 12.193V1H2.812C1.042 1 .474 2.156 1.533 3.568z'/%3E%3C/svg%3E");
}
.lc-bubble.bot::before {
  right: -8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath fill='%23d9fdd3' d='M5.188 1H0v11.193l6.467-8.625C7.526 2.156 6.958 1 5.188 1z'/%3E%3C/svg%3E");
}
/* Row divider spans text column to the right edge (WA inset) */
.lc-chat-item { padding-right: 0; }
.lc-chat-info { padding-right: 15px; }
/* Emoji picker: tab strip + search */
.lc-emoji-picker { padding: 0; width: 376px; }
.lc-emoji-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid #e9edef; }
.lc-emoji-tab { background: none; border: none; border-bottom: 3px solid transparent; font-size: 18px; padding: 6px 8px 5px; cursor: pointer; border-radius: 0; opacity: .7; }
.lc-emoji-tab:hover { opacity: 1; }
.lc-emoji-tab.active { border-bottom-color: var(--wa-teal); opacity: 1; }
.lc-emoji-search-wrap { padding: 8px 8px 4px; }
.lc-emoji-search { width: 100%; box-sizing: border-box; border: none; border-radius: 8px; background: #f0f2f5; padding: 7px 12px; font-size: 14px; outline: none; }
.lc-emoji-search:focus { box-shadow: inset 0 0 0 1px var(--wa-teal); background: #fff; }
.lc-emoji-body { max-height: 260px; overflow-y: auto; padding: 0 8px 8px; }

/* ── Inline media (images / voice / video / documents) ──────────── */
.lc-media-img-wrap { display: block; margin: -3px -3px 4px -5px; border-radius: 6px; overflow: hidden; }
.lc-media-img { display: block; max-width: 330px; max-height: 330px; width: 100%; object-fit: cover; border-radius: 6px; background: #f0f2f5; }
.lc-media-video { display: block; max-width: 330px; width: 100%; border-radius: 6px; margin: -3px 0 4px -5px; background: #000; }
.lc-media-audio { display: block; width: 260px; max-width: 100%; height: 40px; margin: 2px 0 4px; }
.lc-media-doc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(11, 20, 26, .05); border-radius: 6px; color: var(--wa-text); text-decoration: none; margin: -2px 0 4px; font-size: 14px; }
.lc-media-doc:hover { background: rgba(11, 20, 26, .09); }
