/* DeltaSpares - chat window, floating WhatsApp icon and the shared conversation view (V101).
   WhatsApp-style colours. Loaded by includes/chat_widget.php (storefront + My Messages). */

:root { --ds-wa: #25D366; --ds-wa-dark: #128C7E; --ds-wa-head: #075E54; --ds-chat-bg: #ECE5DD; --ds-bubble-out: #DCF8C6; --ds-bubble-in: #ffffff; --ds-chat-text: #1b2733; --ds-chat-muted: #667781; --ds-chat-panel: #ffffff; --ds-chat-line: #dfe3e6; }
html[data-theme="dark"] { --ds-wa-head: #1f2c34; --ds-chat-bg: #0b141a; --ds-bubble-out: #005c4b; --ds-bubble-in: #202c33; --ds-chat-text: #e9edef; --ds-chat-muted: #8696a0; --ds-chat-panel: #111b21; --ds-chat-line: #26343d; }

/* ---- floating icon (right side) ---- */
.ds-wa-float { position: fixed; right: 18px; bottom: 22px; width: 58px; height: 58px; border-radius: 50%; border: none; background: var(--ds-wa); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0,0,0,.28); z-index: 950; transition: transform .18s ease, box-shadow .18s ease; padding: 0; }
.ds-wa-float:hover, .ds-wa-float:focus-visible { transform: scale(1.08); box-shadow: 0 12px 30px rgba(0,0,0,.34); outline: none; }
.ds-wa-float .icon { width: 32px; height: 32px; color: #fff; stroke: #fff; }
.ds-wa-float::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ds-wa); opacity: .55; z-index: -1; animation: dsWaPulse 2.6s ease-out infinite; }
@keyframes dsWaPulse { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(1.5); opacity: 0; } }
.ds-wa-badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 10px; background: #e5352b; color: #fff; font-size: .7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.ds-wa-badge[hidden] { display: none; }
@media (max-width: 640px) { .ds-wa-float { bottom: 78px; right: 14px; width: 54px; height: 54px; } }
@media (prefers-reduced-motion: reduce) { .ds-wa-float::before { animation: none; } .ds-wa-float { transition: none; } }

/* ---- the chat window ---- */
.ds-chat { position: fixed; right: 18px; bottom: 92px; width: 370px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 110px); background: var(--ds-chat-panel); color: var(--ds-chat-text); border-radius: 16px; box-shadow: 0 18px 60px rgba(0,0,0,.38); z-index: 960; display: flex; flex-direction: column; overflow: hidden; font-family: inherit; }
.ds-chat[hidden] { display: none; }
@media (max-width: 640px) { .ds-chat { right: 8px; left: 8px; width: auto; max-width: none; bottom: 8px; height: calc(100vh - 16px); max-height: none; border-radius: 14px; } }
.ds-chat-head { background: var(--ds-wa-head); color: #fff; display: flex; align-items: center; gap: 11px; padding: 12px 14px; flex-shrink: 0; }
.ds-chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--ds-wa); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ds-chat-avatar .icon { width: 24px; height: 24px; color: #fff; stroke: #fff; }
.ds-chat-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.ds-chat-title b { font-size: .98rem; }
.ds-chat-title small { font-size: .72rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-chat-close { background: none; border: none; color: #fff; font-size: 1.15rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; line-height: 1; }
.ds-chat-close:hover { background: rgba(255,255,255,.16); }
.ds-chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--ds-chat-bg); }

/* ---- start form ---- */
.ds-start { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; background: var(--ds-chat-panel); flex: 1; }
.ds-start[hidden], .ds-thread[hidden] { display: none; }
.ds-hint { margin: 0; font-size: .8rem; color: var(--ds-chat-muted); line-height: 1.5; }
.ds-start label { display: flex; flex-direction: column; gap: 4px; font-size: .74rem; font-weight: 700; color: var(--ds-chat-muted); text-transform: uppercase; letter-spacing: .3px; }
.ds-start input, .ds-start textarea { font: inherit; font-size: .92rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ds-chat-text); background: var(--ds-chat-panel); border: 1px solid var(--ds-chat-line); border-radius: 10px; padding: 10px 12px; width: 100%; box-sizing: border-box; }
.ds-start textarea { resize: vertical; min-height: 84px; }
.ds-start input:focus, .ds-start textarea:focus, .ds-compose textarea:focus { outline: none; border-color: var(--ds-wa-dark); box-shadow: 0 0 0 3px rgba(37,211,102,.22); }
.ds-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.ds-error { background: #fde8e8; color: #a31616; border: 1px solid #f5c2c2; border-radius: 8px; padding: 8px 10px; font-size: .82rem; }
.ds-error[hidden] { display: none; }
html[data-theme="dark"] .ds-error { background: #3a1d1d; color: #ffb4b4; border-color: #5c2a2a; }
.ds-send-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--ds-wa); color: #06361f; border: none; border-radius: 24px; padding: 12px 18px; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; }
.ds-send-btn .icon { width: 20px; height: 20px; color: #06361f; stroke: #06361f; }
.ds-send-btn:hover { filter: brightness(1.06); }
.ds-send-btn[disabled] { opacity: .6; cursor: wait; }
.ds-chat .ds-wa-link, .ds-wa-link { text-align: center; font-size: .8rem; color: var(--ds-wa-dark); text-decoration: none; font-weight: 600; }
.ds-chat .ds-wa-link { color: var(--ds-wa-dark); }
.ds-wa-link:hover { text-decoration: underline; }

/* ---- the conversation (shared by the window and the My Messages page) ---- */
.ds-thread { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--ds-chat-bg); }
.ds-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; background-color: var(--ds-chat-bg); }
.ds-day { align-self: center; background: rgba(255,255,255,.75); color: #54656f; font-size: .7rem; padding: 3px 10px; border-radius: 8px; margin: 6px 0; }
html[data-theme="dark"] .ds-day { background: #182229; color: #8696a0; }
.ds-msg { max-width: 82%; padding: 7px 10px 5px; border-radius: 10px; font-size: .9rem; line-height: 1.4; box-shadow: 0 1px 1px rgba(0,0,0,.13); word-wrap: break-word; overflow-wrap: anywhere; color: var(--ds-chat-text); }
.ds-msg .ds-text { white-space: pre-wrap; }
.ds-msg time { display: block; text-align: right; font-size: .65rem; color: var(--ds-chat-muted); margin-top: 2px; }
.ds-msg.out { align-self: flex-end; background: var(--ds-bubble-out); border-top-right-radius: 2px; }
.ds-msg.in { align-self: flex-start; background: var(--ds-bubble-in); border-top-left-radius: 2px; }
.ds-msg .ds-who { display: block; font-size: .68rem; font-weight: 800; color: var(--ds-wa-dark); margin-bottom: 1px; }
.ds-empty { margin: auto; color: var(--ds-chat-muted); font-size: .85rem; text-align: center; padding: 20px; }
.ds-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--ds-chat-panel); border-top: 1px solid var(--ds-chat-line); flex-shrink: 0; }
.ds-compose textarea { flex: 1; font: inherit; font-size: .92rem; color: var(--ds-chat-text); background: var(--ds-chat-bg); border: 1px solid var(--ds-chat-line); border-radius: 20px; padding: 9px 14px; resize: none; max-height: 110px; min-height: 40px; box-sizing: border-box; }
.ds-compose button { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; border: none; background: var(--ds-wa); color: #06361f; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 800; }
.ds-compose button[disabled] { opacity: .55; cursor: wait; }
.ds-closed-note { padding: 12px 14px; background: var(--ds-chat-panel); border-top: 1px solid var(--ds-chat-line); text-align: center; font-size: .85rem; color: var(--ds-chat-muted); flex-shrink: 0; }
.ds-closed-note button { margin-left: 6px; background: var(--ds-wa); color: #06361f; border: none; border-radius: 16px; padding: 6px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.ds-thread-foot { padding: 6px 12px 8px; background: var(--ds-chat-panel); text-align: center; font-size: .72rem; color: var(--ds-chat-muted); flex-shrink: 0; }
.ds-thread-foot a, .ds-chat .ds-thread-foot a { color: var(--ds-wa-dark); font-weight: 700; text-decoration: none; }
.ds-thread-foot a:hover { text-decoration: underline; }

/* ---- the "Chat on WhatsApp" button inside the 24/7 Assistance card ---- */
.mp-wa-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; margin-top: 18px; width: 100%; background: var(--ds-wa); color: #06361f; border: none; border-radius: 10px; padding: 12px 18px; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; box-sizing: border-box; }
.mp-wa-btn .icon { width: 22px; height: 22px; color: #06361f; stroke: #06361f; }
.mp-wa-btn:hover, .mp-wa-btn:focus-visible { filter: brightness(1.07); outline: none; }
.mp-wa-note { display: block; margin-top: 8px; text-align: center; font-size: .72rem; color: var(--mp-muted, #667781); }

/* the footer's "Build Vxxx" label sits at the bottom-right of the page, exactly where the floating icon lands when you scroll to the end - keep it clear of the icon */
.mp-footer-build { margin-right: 84px; }
@media (max-width: 640px) { .mp-footer-build { margin-right: 0; } }

/* ---- V112: welcome -> WhatsApp number -> code -> chat, system notes, attachments ---- */
.ds-step { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; background: var(--ds-chat-bg); }
.ds-step[hidden] { display: none; }
.ds-bubbles { padding: 16px 14px 4px; display: flex; flex-direction: column; gap: 8px; }
.ds-bubble { max-width: 90%; padding: 9px 12px 6px; border-radius: 10px; font-size: .9rem; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.13); color: var(--ds-chat-text); overflow-wrap: anywhere; }
.ds-bubble.in { align-self: flex-start; background: var(--ds-bubble-in); border-top-left-radius: 2px; }
.ds-bubble time { display: block; text-align: right; font-size: .65rem; color: var(--ds-chat-muted); margin-top: 2px; }
.ds-bubble.ds-test { background: #fff3cd; color: #664d03; font-weight: 700; border: 1px dashed #d9a520; }
.ds-step .ds-start { flex: none; background: transparent; padding-top: 8px; }
.ds-step .ds-start input { background: var(--ds-chat-panel); }
.ds-opt { text-transform: none; font-weight: 400; letter-spacing: 0; }
.ds-fine { margin: 0; font-size: .74rem; color: var(--ds-chat-muted); line-height: 1.45; text-align: center; }
.ds-code { text-align: center; letter-spacing: .5em; font-size: 1.4rem !important; font-weight: 800 !important; padding-left: 14px !important; }
.ds-links { text-align: center; font-size: .78rem; color: var(--ds-chat-muted); }
.ds-linkbtn { background: none; border: 0; padding: 4px 2px; font: inherit; color: var(--ds-wa-dark); cursor: pointer; text-decoration: underline; }
.ds-linkbtn[disabled] { color: var(--ds-chat-muted); text-decoration: none; cursor: default; }
.ds-sys { align-self: center; max-width: 92%; background: #fff3cd; color: #5f4b05; border-radius: 10px; padding: 8px 12px 5px; font-size: .8rem; line-height: 1.45; text-align: center; box-shadow: 0 1px 1px rgba(0,0,0,.1); overflow-wrap: anywhere; }
.ds-sys time { display: block; font-size: .62rem; opacity: .7; margin-top: 2px; }
.ds-sys-text { white-space: pre-wrap; }
html[data-theme="dark"] .ds-sys { background: #3b3416; color: #f1dd9a; }
.ds-img { display: block; margin: 0 0 4px; }
.ds-img img { display: block; max-width: 100%; width: 230px; max-height: 260px; object-fit: cover; border-radius: 8px; }
.ds-file { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; background: rgba(0,0,0,.06); border-radius: 8px; padding: 8px 10px; margin-bottom: 4px; min-width: 170px; }
html[data-theme="dark"] .ds-file { background: rgba(255,255,255,.07); }
.ds-file-ic { font-size: 1.5rem; }
.ds-file-t b { display: block; font-size: .82rem; overflow-wrap: anywhere; }
.ds-file-t small { color: var(--ds-chat-muted); font-size: .7rem; }
.ds-compose .ds-attach { background: transparent; color: var(--ds-chat-muted); font-size: 1.25rem; width: 36px; height: 42px; border-radius: 10px; }
.ds-compose .ds-attach:hover { color: var(--ds-wa-dark); }
.ds-compose .ds-attach.busy { opacity: .45; }

/* V117: "Prefer WhatsApp? Open in the WhatsApp app" under the mobile number and under the code */
.ds-chat .ds-wa-alt { margin: -4px 0 12px; font-size: .78rem; color: var(--ds-chat-muted); line-height: 1.4; }
.ds-chat .ds-wa-alt a { color: var(--ds-wa-dark); font-weight: 700; text-decoration: none; }
.ds-chat .ds-wa-alt a:hover, .ds-chat .ds-wa-alt a:focus-visible { text-decoration: underline; }
/* V122 - the floating icon as a plain link (chat window deactivated: it opens WhatsApp itself) */
a.ds-wa-float { text-decoration: none; }

/* V157: the Live chat button under "Chat on WhatsApp" uses the site's orange (amber) instead of WhatsApp green. */
.mp-wa-btn.mp-live-btn { margin-top: 10px; background: var(--mp-amber, #f0a500); color: #0a2540; }
.mp-wa-btn.mp-live-btn .icon { color: #0a2540; stroke: #0a2540; }
