/* Lead Autopsy WhatsApp & Call Connect - frontend widget
   Colours come from --lacrm-wa-color and --lacrm-phone-color set inline on #lacrm-wa-root. */

.lacrm-wa-root, .lacrm-wa-root * { box-sizing: border-box; }

.lacrm-wa-root {
    --lacrm-wa-color: #25D366;
    --lacrm-phone-color: #2563eb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ----- Launcher buttons ----- */
.lacrm-wa-launcher {
    position: fixed;
    bottom: 22px;
    z-index: 999990;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 6px 22px rgba(0,0,0,.28);
    transition: transform .18s ease, box-shadow .18s ease;
    -webkit-tap-highlight-color: transparent;
}
.lacrm-wa-launcher:hover { transform: scale(1.07); box-shadow: 0 8px 28px rgba(0,0,0,.34); }
.lacrm-wa-launcher:active { transform: scale(.96); }
/* Icon hardening. Some page builders ship global SVG resets (for example
   forcing every svg to 1em or auto height, or overriding fill) that win over
   the SVG width/height/fill attributes and shrink or hide our icons. The rules
   below lock the widget icons down so no theme can interfere. */
.lacrm-wa-launcher svg {
    position: relative;
    z-index: 2;
    display: block !important;
    flex: 0 0 auto !important;
    max-width: none !important;
    max-height: none !important;
}
.lacrm-whatsapp-launcher svg { width: 30px !important; height: 30px !important; }
.lacrm-phone-launcher svg    { width: 26px !important; height: 26px !important; }
.lacrm-wa-launcher svg,
.lacrm-wa-launcher svg path { fill: #fff !important; }

/* Same protection for the panel, submit and inline-button icons. */
.lacrm-wa-root svg,
.lacrm-wa-inline svg { max-width: none !important; max-height: none !important; vertical-align: middle; }
.lacrm-wa-header-avatar svg { width: 22px !important; height: 22px !important; }
.lacrm-wa-submit svg        { width: 18px !important; height: 18px !important; }
.lacrm-wa-inline-btn svg    { width: 22px !important; height: 22px !important; }
.lacrm-wa-header-avatar svg, .lacrm-wa-header-avatar svg path,
.lacrm-wa-submit svg, .lacrm-wa-submit svg path,
.lacrm-wa-inline-btn svg, .lacrm-wa-inline-btn svg path { fill: #fff !important; }

.lacrm-wa-launcher.lacrm-pos-right { right: 22px; }
.lacrm-wa-launcher.lacrm-pos-left  { left: 22px; }

.lacrm-whatsapp-launcher { background: var(--lacrm-wa-color); }
.lacrm-phone-launcher    { background: var(--lacrm-phone-color); }

/* When both buttons share a side, PHP adds .lacrm-stacked to the phone
   launcher so it sits above WhatsApp instead of overlapping it. */
.lacrm-phone-launcher.lacrm-stacked { bottom: 92px; }

/* ----- CTA bubble beside the WhatsApp icon ----- */
.lacrm-wa-cta {
    position: fixed;
    bottom: 30px;
    z-index: 999989;
    background: var(--cta-bg, #fff);
    color: var(--cta-fg, #1f2937);
    font-size: var(--cta-fs, 13px);
    max-width: var(--cta-maxw, 150px);
    line-height: 1.25;
    padding: 9px 24px 9px 13px;
    border-radius: 12px;
    box-shadow: 0 6px 22px rgba(0,0,0,.18);
    cursor: pointer;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
    animation: lacrm-cta-in .35s ease .9s both;
}
.lacrm-wa-cta.lacrm-pos-right { right: 90px; }
.lacrm-wa-cta.lacrm-pos-left  { left: 90px; }

/* little tail pointing at the icon */
.lacrm-wa-cta::after {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 7px solid transparent;
}
.lacrm-wa-cta.lacrm-pos-right::after { right: -12px; border-left-color: var(--cta-bg, #fff); }
.lacrm-wa-cta.lacrm-pos-left::after  { left: -12px;  border-right-color: var(--cta-bg, #fff); }

.lacrm-wa-cta-text { display: block; }

.lacrm-wa-cta-close {
    position: absolute;
    top: 3px;
    right: 6px;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    opacity: .45;
    font-size: 15px;
    line-height: 14px;
    cursor: pointer;
}
.lacrm-wa-cta-close:hover { opacity: 1; }

@keyframes lacrm-cta-in {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .lacrm-wa-cta { animation: none; }
}

/* ----- WhatsApp pulse ----- */
.lacrm-wa-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--lacrm-wa-color);
    opacity: .55;
    z-index: 1;
    animation: lacrm-wa-pulse 2.2s ease-out infinite;
}
@keyframes lacrm-wa-pulse {
    0%   { transform: scale(1);   opacity: .55; }
    70%  { transform: scale(1.7); opacity: 0; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* ----- Phone ring waves ----- */
.lacrm-ring-wave {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--lacrm-phone-color);
    z-index: 1;
    animation: lacrm-ring 1.8s ease-out infinite;
}
.lacrm-ring-wave-2 { animation-delay: .6s; }
@keyframes lacrm-ring {
    0%   { transform: scale(1);   opacity: .8; }
    100% { transform: scale(2.1); opacity: 0; }
}
.lacrm-phone-launcher svg { animation: lacrm-shake 2.4s ease-in-out infinite; transform-origin: center; }
@keyframes lacrm-shake {
    0%, 60%, 100% { transform: rotate(0); }
    5%, 15%, 25%  { transform: rotate(-14deg); }
    10%, 20%, 30% { transform: rotate(14deg); }
}

/* ----- Chat panel ----- */
.lacrm-wa-panel {
    position: fixed;
    bottom: 92px;
    z-index: 999991;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0,0,0,.28);
    opacity: 0;
    transform: translateY(16px) scale(.98);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
.lacrm-wa-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.lacrm-wa-panel.lacrm-pos-right { right: 22px; }
.lacrm-wa-panel.lacrm-pos-left  { left: 22px; }

.lacrm-wa-panel-header {
    background: var(--lacrm-wa-color);
    color: #fff;
    padding: 16px 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}
.lacrm-wa-header-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.lacrm-wa-header-text { display: flex; flex-direction: column; line-height: 1.25; }
.lacrm-wa-header-text strong { font-size: 15px; }
.lacrm-wa-header-text span { font-size: 12px; opacity: .92; }
.lacrm-wa-close {
    position: absolute; top: 10px; right: 12px;
    background: transparent; border: none; color: #fff;
    font-size: 22px; line-height: 1; cursor: pointer; opacity: .85; padding: 2px 6px;
}
.lacrm-wa-close:hover { opacity: 1; }

.lacrm-wa-panel-body {
    padding: 14px 16px 16px;
    background: #f5f6f6;
    max-height: 70vh;
    overflow-y: auto;
}

/* WhatsApp-style greeting bubble */
.lacrm-wa-greeting { margin-bottom: 14px; }
.lacrm-wa-bubble {
    background: #fff;
    border-radius: 0 12px 12px 12px;
    padding: 10px 12px;
    font-size: 13px;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    line-height: 1.45;
}
.lacrm-wa-bubble small { color: #6b7280; display: inline-block; margin-top: 4px; }

/* Fields */
.lacrm-wa-field { display: block; margin-bottom: 10px; }
.lacrm-wa-field > span { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.lacrm-wa-field > span em { color: #dc2626; font-style: normal; }
.lacrm-wa-field input,
.lacrm-wa-field textarea,
.lacrm-wa-field select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
    color: #111827;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.lacrm-wa-field input:focus,
.lacrm-wa-field textarea:focus,
.lacrm-wa-field select:focus {
    border-color: var(--lacrm-wa-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--lacrm-wa-color) 22%, transparent);
}
.lacrm-wa-field textarea { resize: vertical; min-height: 44px; }
.lacrm-wa-invalid { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220,38,38,.18) !important; }

.lacrm-wa-error {
    background: #fef2f2; color: #b91c1c;
    border: 1px solid #fecaca; border-radius: 8px;
    padding: 8px 10px; font-size: 12px; margin-bottom: 10px;
}

/* Submit */
.lacrm-wa-submit {
    width: 100%;
    background: var(--lacrm-wa-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter .15s ease, transform .1s ease;
}
.lacrm-wa-submit:hover { filter: brightness(1.05); }
.lacrm-wa-submit:active { transform: scale(.985); }
.lacrm-wa-submit.sending { opacity: .75; pointer-events: none; }

.lacrm-wa-footer-note { text-align: center; font-size: 11px; color: #9ca3af; margin-top: 10px; }

/* ----- Inline shortcode button ----- */
.lacrm-wa-inline {
    --lacrm-wa-color: #25D366;
    margin: 16px 0;
}
.lacrm-wa-inline-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: var(--lacrm-wa-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37,211,102,.35);
    transition: transform .12s ease, filter .15s ease;
    font-family: inherit;
}
.lacrm-wa-inline-btn:hover { transform: translateY(-1px); filter: brightness(1.04); }

/* ----- Mobile ----- */
@media (max-width: 480px) {
    .lacrm-wa-panel { width: calc(100vw - 24px); bottom: 88px; }
    .lacrm-wa-panel.lacrm-pos-right { right: 12px; }
    .lacrm-wa-panel.lacrm-pos-left  { left: 12px; }
    .lacrm-wa-launcher { width: 54px; height: 54px; bottom: 18px; }
    .lacrm-wa-launcher.lacrm-pos-right { right: 16px; }
    .lacrm-wa-launcher.lacrm-pos-left  { left: 16px; }
}
