/* ==========================================================================
   Modern Contact Hours — widget
   ========================================================================== */

.mch-widget {
    --mch-accent: #0b7d66;
    --mch-bg: #ffffff;
    --mch-surface: #f7f7f5;
    --mch-text: #17181a;
    --mch-muted: #6b7280;
    --mch-border: rgba(23, 24, 26, 0.08);
    --mch-shadow: 0 24px 60px -20px rgba(17, 24, 39, 0.25), 0 2px 6px rgba(17, 24, 39, 0.06);
    --mch-radius: 20px;
    --mch-ease: cubic-bezier(.22,.8,.22,1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
    color: var(--mch-text);
    line-height: 1.5;
    font-size: 14px;
}
.mch-widget.mch-theme-dark {
    --mch-bg: #111214;
    --mch-surface: #1a1b1e;
    --mch-text: #f3f4f6;
    --mch-muted: #9ca3af;
    --mch-border: rgba(255,255,255,0.08);
    --mch-shadow: 0 24px 60px -20px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
}

/* --- Floating position --- */
.mch-widget.mch-floating { position: fixed; z-index: 99998; }
.mch-widget.mch-pos-bottom-right { right: var(--mch-offset-x, 22px); bottom: var(--mch-offset-y, 22px); }
.mch-widget.mch-pos-bottom-left  { left: var(--mch-offset-x, 22px); bottom: var(--mch-offset-y, 22px); }

/* --- Launcher button --- */
/* The button itself is the animation host — transforms and box-shadow live
 * here so they can extend outside any clip-path the inner shape uses. */
.mch-launcher {
    position: relative;
    width: var(--mch-launcher-size, 60px); height: var(--mch-launcher-size, 60px);
    background: transparent;
    color: #fff;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px -8px color-mix(in srgb, var(--mch-accent) 60%, transparent),
                0 2px 6px rgba(0,0,0,0.1);
    transition: transform .35s var(--mch-ease), box-shadow .3s var(--mch-ease);
    border-radius: 50%; /* default; overridden per shape */
}
.mch-launcher:hover { transform: translateY(-2px) scale(1.04); }
.mch-launcher:active { transform: scale(0.96); }

/* The visible "skin" — color, shape, clipping live here. By splitting the
 * shape from the button, animations on the button (translate, rotate, glow)
 * are not clipped by clip-path forms like hexagon. */
.mch-launcher-shape {
    position: absolute;
    inset: 0;
    background: var(--mch-accent);
    border-radius: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    pointer-events: none; /* let clicks fall through to the button */
}

.mch-launcher-icon { display:inline-flex; transition: transform .45s var(--mch-ease); }
.mch-widget.mch-is-panel-open .mch-launcher-icon { transform: rotate(90deg) scale(0.9); }

.mch-widget.mch-is-closed .mch-launcher { filter: saturate(0.75) brightness(0.95); }

/* --- Panel --- */
.mch-panel {
    position: absolute;
    bottom: calc(100% + 14px);
    width: 360px;
    max-width: calc(100vw - 40px);
    background: var(--mch-bg);
    border-radius: var(--mch-radius);
    box-shadow: var(--mch-shadow);
    border: 1px solid var(--mch-border);
    overflow: hidden;
    transform: translateY(12px) scale(.98);
    opacity: 0;
    pointer-events: none;
    transition: transform .35s var(--mch-ease), opacity .25s var(--mch-ease);
    display: flex;
    flex-direction: column;
    max-height: min(640px, calc(100vh - 110px));
}
.mch-widget.mch-pos-bottom-right .mch-panel { right: 0; transform-origin: bottom right; }
.mch-widget.mch-pos-bottom-left  .mch-panel { left: 0;  transform-origin: bottom left; }
.mch-widget.mch-is-panel-open .mch-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.mch-widget.mch-inline {
    position: relative;
    display: block;
    max-width: 440px;
    margin: 20px auto;
}
.mch-widget.mch-inline .mch-panel {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    width: 100%;
    max-width: 100%;
}

/* Header */
.mch-panel-header {
    position: relative;
    padding: 22px 22px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    background:
        radial-gradient(140% 120% at 0% 0%, color-mix(in srgb, var(--mch-accent) 18%, transparent) 0%, transparent 60%),
        var(--mch-bg);
    border-bottom: 1px solid var(--mch-border);
}
.mch-avatar {
    width: 42px; height: 42px;
    border-radius: 14px;
    background: var(--mch-accent);
    color: #fff;
    display:flex; align-items:center; justify-content:center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--mch-accent) 60%, transparent);
}
.mch-header-text { flex: 1; min-width: 0; }
.mch-brand {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
}
.mch-tag {
    font-size: 12.5px;
    color: var(--mch-muted);
    margin-top: 2px;
}
.mch-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--mch-muted);
    width: 32px; height: 32px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s;
}
.mch-close:hover { background: var(--mch-surface); color: var(--mch-text); }

/* Status strip */
.mch-status-bar {
    padding: 10px 22px;
    font-size: 12.5px;
    color: var(--mch-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--mch-surface);
    border-bottom: 1px solid var(--mch-border);
}
.mch-status-bar strong { color: var(--mch-text); font-weight: 600; }
.mch-status-bar .mch-sep { opacity: 0.4; }
.mch-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #d1d5db;
    box-shadow: 0 0 0 0 rgba(0,0,0,0);
}
.mch-is-open .mch-dot {
    background: #10b981;
    animation: mchBlink 2s ease-in-out infinite;
}
.mch-is-closed .mch-dot { background: #f59e0b; }
@keyframes mchBlink {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* Agent presence row removed in v2.5.5 — agent presence didn't add value
 * and confused customers when shown alongside opening hours. */

/* Hide the status bar entirely once the customer is inside an active chat —
 * opening hours are irrelevant when a conversation is already running, and
 * removing the bar gives the chat thread more visual space. */
.mch-widget.mch-is-chat-active .mch-status-bar { display: none; }

/* Body */
.mch-body {
    padding: 18px 22px 8px;
    overflow-y: auto;
    flex: 1;
}

/* Channels */
.mch-channels {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.mch-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--mch-surface);
    border: 1px solid var(--mch-border);
    color: var(--mch-text);
    text-decoration: none;
    transition: transform .2s var(--mch-ease), background .2s, border-color .2s;
}
.mch-channel:hover {
    transform: translateX(2px);
    border-color: color-mix(in srgb, var(--mch-accent) 40%, var(--mch-border));
    background: color-mix(in srgb, var(--mch-accent) 6%, var(--mch-surface));
}
.mch-channel-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--mch-bg);
    color: var(--mch-accent);
    display:flex; align-items:center; justify-content:center;
    border: 1px solid var(--mch-border);
    flex-shrink: 0;
}
.mch-channel-text { display:flex; flex-direction:column; min-width:0; }
.mch-channel-text strong { font-size: 13.5px; font-weight: 600; }
.mch-channel-text small {
    color: var(--mch-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Divider */
.mch-divider {
    display:flex; align-items: center; gap: 10px;
    margin: 14px 0 12px;
    color: var(--mch-muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.mch-divider::before, .mch-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--mch-border);
}

/* Form inputs with floating labels */
.mch-contact-form { display: flex; flex-direction: column; gap: 10px; }

/* Two-step flow */
.mch-step { display: none; flex-direction: column; gap: 10px; }
.mch-step.is-active { display: flex; animation: mchStepIn .35s var(--mch-ease); }
@keyframes mchStepIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mch-greeting {
    font-size: 15.5px; font-weight: 600;
    letter-spacing: -0.01em; margin: 0 0 2px;
}
.mch-greeting-sub {
    font-size: 13px; color: var(--mch-muted); margin: 0 0 6px;
}

.mch-back {
    align-self: flex-start;
    background: transparent; border: none; cursor: pointer;
    padding: 4px 0;
    color: var(--mch-muted); font-size: 12.5px; font-family: inherit;
    display: inline-flex; align-items: center; gap: 4px;
    transition: color .2s;
}
.mch-back:hover { color: var(--mch-text); }

.mch-primary-btn {
    margin-top: 4px;
    background: var(--mch-accent); color: #fff; border: none;
    border-radius: 12px; padding: 13px 16px;
    font-size: 14px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform .2s var(--mch-ease), filter .2s;
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--mch-accent) 60%, transparent);
}
.mch-primary-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.mch-primary-btn:active { transform: translateY(0); }
.mch-primary-btn[disabled] { opacity: 0.7; cursor: progress; }
.mch-primary-btn svg { transition: transform .3s var(--mch-ease); }
.mch-primary-btn:hover svg { transform: translate(2px, 0); }
.mch-input { position: relative; }
.mch-input input, .mch-input textarea {
    width: 100%;
    box-sizing: border-box;
    background: var(--mch-surface);
    border: 1px solid var(--mch-border);
    border-radius: 12px;
    padding: 18px 14px 8px;
    color: var(--mch-text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.mch-input textarea { min-height: 80px; padding-top: 22px; }
.mch-input input:focus, .mch-input textarea:focus {
    outline: none;
    border-color: var(--mch-accent);
    background: var(--mch-bg);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--mch-accent) 15%, transparent);
}
.mch-input label {
    position: absolute;
    top: 14px;
    left: 14px;
    font-size: 13px;
    color: var(--mch-muted);
    pointer-events: none;
    transition: transform .2s var(--mch-ease), color .2s, font-size .2s;
    background: transparent;
}
.mch-input input:focus + label,
.mch-input input:not(:placeholder-shown) + label,
.mch-input textarea:focus + label,
.mch-input textarea:not(:placeholder-shown) + label {
    transform: translateY(-7px);
    font-size: 11px;
    color: var(--mch-accent);
    font-weight: 500;
}

.mch-hp { position: absolute; left: -9999px; opacity: 0; }

/* Legacy .mch-send class kept as alias — inherits from .mch-primary-btn */
.mch-send { /* styled by .mch-primary-btn */ }

.mch-feedback {
    font-size: 13px;
    min-height: 0;
    color: var(--mch-muted);
    text-align: center;
    transition: color .2s;
    padding: 0 4px;
}
.mch-feedback.is-success { color: #10b981; font-weight: 500; }
.mch-feedback.is-error { color: #ef4444; }

/* Footer */
.mch-footer {
    padding: 10px 22px 14px;
    font-size: 11px;
    color: var(--mch-muted);
    text-align: center;
    border-top: 1px solid var(--mch-border);
    background: var(--mch-surface);
}

/* Mobile */
@media (max-width: 480px) {
    .mch-widget.mch-floating .mch-panel {
        width: calc(100vw - 24px);
        bottom: calc(100% + 10px);
    }
    .mch-widget.mch-pos-bottom-right { right: 14px; bottom: 14px; }
    .mch-widget.mch-pos-bottom-left  { left: 14px;  bottom: 14px; }
}
.mch-widget.mch-hide-mobile.mch-floating {
    @media (max-width: 640px) { display: none; }
}
@media (max-width: 640px) {
    .mch-widget.mch-hide-mobile.mch-floating { display: none; }
}

/* ==========================================================================
   Live chat - customer side
   ========================================================================== */
.mch-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin: -18px -22px -8px;
    min-height: 360px;
    max-height: 60vh;
}

.mch-chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mch-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}
.mch-msg-customer { align-self: flex-end; align-items: flex-end; }
.mch-msg-agent { align-self: flex-start; align-items: flex-start; }

.mch-msg-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
}
.mch-msg-customer .mch-msg-bubble {
    background: var(--mch-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mch-msg-agent .mch-msg-bubble {
    background: var(--mch-surface);
    color: var(--mch-text);
    border: 1px solid var(--mch-border);
    border-bottom-left-radius: 4px;
}
.mch-msg-meta {
    font-size: 10.5px;
    color: var(--mch-muted);
    margin-top: 2px;
    padding: 0 4px;
}

.mch-chat-composer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--mch-border);
    background: var(--mch-bg);
}
.mch-chat-composer input {
    flex: 1;
    background: var(--mch-surface);
    border: 1px solid var(--mch-border);
    border-radius: 10px;
    padding: 9px 14px;
    color: var(--mch-text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
}
.mch-chat-composer input:focus {
    outline: none;
    border-color: var(--mch-accent);
    background: var(--mch-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mch-accent) 15%, transparent);
}
.mch-chat-composer button {
    background: var(--mch-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    width: 38px; height: 38px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: filter .15s, transform .15s;
}
.mch-chat-composer button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.mch-chat-end {
    background: transparent;
    border: none;
    color: var(--mch-muted);
    font-size: 11.5px;
    padding: 6px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    border-top: 1px solid var(--mch-border);
}
.mch-chat-end:hover { color: #ef4444; }

/* Customer-side: system note when chat ends */
.mch-msg-system-end {
    align-self: center;
    background: rgba(245,158,11,0.1);
    color: #b45309;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(245,158,11,0.25);
    margin: 6px 0;
    text-align: center;
}
.mch-widget.mch-theme-dark .mch-msg-system-end {
    background: rgba(245,158,11,0.12);
    color: #fbbf24;
}

/* ==========================================================================
   Launcher SHAPES (driven by [data-launcher] on .mch-widget)
   ========================================================================== */

/* CHAT — perfectly round circle (default) */
.mch-widget[data-launcher="chat"] .mch-launcher,
.mch-widget[data-launcher="chat"] .mch-launcher-shape {
    border-radius: 50%;
}

/* BUBBLE — speech bubble with one pointed corner toward the page */
.mch-widget[data-launcher="bubble"] .mch-launcher {
    border-radius: 22px 22px 22px 6px;
    width: calc(var(--mch-launcher-size, 60px) * 1.05);
    height: calc(var(--mch-launcher-size, 60px) * 0.92);
}
.mch-widget[data-launcher="bubble"] .mch-launcher-shape { border-radius: inherit; }
.mch-widget[data-launcher="bubble"].mch-pos-bottom-left .mch-launcher {
    border-radius: 22px 22px 6px 22px;
}

/* SQUARE — rounded square */
.mch-widget[data-launcher="square"] .mch-launcher,
.mch-widget[data-launcher="square"] .mch-launcher-shape {
    border-radius: 14px;
}

/* PILL — wide pill shape, ideal with a label inside */
.mch-widget[data-launcher="pill"] .mch-launcher {
    border-radius: 999px;
    width: calc(var(--mch-launcher-size, 60px) * 1.5);
}
.mch-widget[data-launcher="pill"] .mch-launcher-shape { border-radius: inherit; }

/* HEXAGON — clip-path lives on the SHAPE, not the button. This lets
 * box-shadow, transforms, and other animations extend beyond the hex
 * boundary instead of being clipped. */
.mch-widget[data-launcher="hexagon"] .mch-launcher {
    border-radius: 0;
    /* Box-shadow looks weird around a hexagon; use a drop-shadow filter on
     * the shape inside instead. */
    box-shadow: none;
}
.mch-widget[data-launcher="hexagon"] .mch-launcher-shape {
    border-radius: 0;
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.18));
}

/* OUTLINE — circle with a transparent center and an accent ring */
.mch-widget[data-launcher="outline"] .mch-launcher,
.mch-widget[data-launcher="outline"] .mch-launcher-shape {
    border-radius: 50%;
}
.mch-widget[data-launcher="outline"] .mch-launcher-shape {
    background: transparent;
    border: 3px solid var(--mch-accent);
    color: var(--mch-accent);
}
.mch-widget[data-launcher="outline"] .mch-launcher {
    box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.15);
}
.mch-widget[data-launcher="outline"] .mch-launcher svg { color: var(--mch-accent); }

/* MINIMAL — small rounded square */
.mch-widget[data-launcher="minimal"] .mch-launcher {
    border-radius: 12px;
    width: calc(var(--mch-launcher-size, 60px) * 0.78);
    height: calc(var(--mch-launcher-size, 60px) * 0.78);
}
.mch-widget[data-launcher="minimal"] .mch-launcher-shape { border-radius: inherit; }
.mch-widget[data-launcher="minimal"] .mch-launcher-icon svg {
    width: 60%; height: 60%;
}

/* ==========================================================================
   Launcher ATTENTION EFFECTS (driven by [data-effect])
   ========================================================================== */

/* Default: hide the pulse ring (only the "pulse" effect uses it) */
.mch-widget .mch-launcher-pulse { display: none; }

/* PULSE — concentric ring radiating outward.
 * The ring is always circular, sized to circumscribe the launcher.
 * This looks consistent across all shapes (including hexagon, pill, etc). */
.mch-widget[data-effect="pulse"] .mch-launcher-pulse {
    display: block;
    position: absolute;
    top: 50%; left: 50%;
    width: 100%; height: 100%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--mch-accent);
    opacity: 0.55;
    pointer-events: none;
    animation: mchAttnPulse 2s ease-out infinite;
}
@keyframes mchAttnPulse {
    0%   { transform: translate(-50%, -50%) scale(0.95); opacity: 0.55; }
    70%  { transform: translate(-50%, -50%) scale(1.55); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1.55); opacity: 0; }
}

/* VIBRATE — fast nervous jiggle every 4s */
.mch-widget[data-effect="vibrate"] .mch-launcher {
    animation: mchAttnVibrate 4s linear infinite;
}
@keyframes mchAttnVibrate {
    0%, 88%, 100% { transform: translate(0, 0); }
    89% { transform: translate(-1px, 1px); }
    90% { transform: translate(1px, -1px); }
    91% { transform: translate(-2px, 1px); }
    92% { transform: translate(2px, -1px); }
    93% { transform: translate(-1px, -1px); }
    94% { transform: translate(1px, 1px); }
    95% { transform: translate(-2px, 0); }
    96% { transform: translate(2px, 0); }
    97% { transform: translate(-1px, 1px); }
    98% { transform: translate(1px, -1px); }
}

/* BOUNCE — gentle vertical hop every 3s */
.mch-widget[data-effect="bounce"] .mch-launcher {
    animation: mchAttnBounce 3s ease-in-out infinite;
}
@keyframes mchAttnBounce {
    0%, 100% { transform: translateY(0); }
    8%       { transform: translateY(-12px); }
    16%      { transform: translateY(0); }
    24%      { transform: translateY(-6px); }
    32%      { transform: translateY(0); }
}

/* WIGGLE — playful left/right rotation every 5s */
.mch-widget[data-effect="wiggle"] .mch-launcher {
    animation: mchAttnWiggle 5s ease-in-out infinite;
    transform-origin: 50% 80%;
}
@keyframes mchAttnWiggle {
    0%, 88%, 100% { transform: rotate(0); }
    90%  { transform: rotate(-12deg); }
    92%  { transform: rotate(10deg); }
    94%  { transform: rotate(-8deg); }
    96%  { transform: rotate(6deg); }
    98%  { transform: rotate(-3deg); }
}

/* GLOW — accent-color halo softly breathes */
.mch-widget[data-effect="glow"] .mch-launcher {
    animation: mchAttnGlow 2.4s ease-in-out infinite;
}
@keyframes mchAttnGlow {
    0%, 100% { box-shadow: 0 8px 24px -10px var(--mch-accent), 0 0 0 0 var(--mch-accent); }
    50%      { box-shadow: 0 8px 32px -8px var(--mch-accent), 0 0 0 8px color-mix(in srgb, var(--mch-accent) 25%, transparent); }
}

/* SPARKLE — tiny twinkling dot in the corner. Positioned relative to the
 * outer button (not the clipped shape), so it shows up correctly for hexagon
 * and other clipped forms too. */
.mch-widget[data-effect="sparkle"] .mch-launcher::after {
    content: "";
    position: absolute;
    top: -2px; right: -2px;
    width: 10px; height: 10px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px 2px var(--mch-accent), 0 0 4px 1px #fff;
    animation: mchAttnSparkle 1.6s ease-in-out infinite;
    z-index: 2;
}
@keyframes mchAttnSparkle {
    0%, 100% { opacity: 0.3; transform: scale(0.6); }
    50%      { opacity: 1;   transform: scale(1.15); }
}
/* On outline shape, give the dot more contrast */
.mch-widget[data-effect="sparkle"][data-launcher="outline"] .mch-launcher::after {
    background: var(--mch-accent);
    box-shadow: 0 0 8px 2px var(--mch-accent);
}

/* Pause all animations once the panel is open or on hover. We pause the
 * button-level animations (vibrate/bounce/wiggle/glow) AND the pulse ring
 * + sparkle pseudo-element. */
.mch-widget.mch-is-panel-open .mch-launcher,
.mch-widget .mch-launcher:hover,
.mch-widget.mch-is-panel-open .mch-launcher::after,
.mch-widget .mch-launcher:hover::after {
    animation-play-state: paused !important;
}
.mch-widget.mch-is-panel-open .mch-launcher-pulse,
.mch-widget .mch-launcher:hover ~ .mch-launcher-pulse,
.mch-widget .mch-launcher:hover .mch-launcher-pulse {
    animation-play-state: paused;
}

/* Locked chat state (after agent closes or customer ends) */
.mch-chat-container.mch-is-locked .mch-chat-composer {
    padding: 14px 16px;
    border-top: 1px solid var(--mch-border);
}
.mch-chat-composer .mch-restart-chat {
    flex: 1;
    width: auto;
    height: auto;
    min-height: 40px;
    background: var(--mch-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: filter .15s, transform .15s;
}
.mch-chat-composer .mch-restart-chat:hover { filter: brightness(1.08); }
.mch-chat-composer .mch-restart-chat:active { transform: translateY(1px); }

/* Availability indicator inside Step 1 */
.mch-availability {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    margin: 0 0 14px;
    background: var(--mch-surface);
    border: 1px solid var(--mch-border);
    color: var(--mch-muted);
    transition: background .2s, color .2s, border-color .2s;
}
.mch-availability-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    flex-shrink: 0;
}
.mch-availability.is-online {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #047857;
}
.mch-availability.is-online .mch-availability-dot {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    animation: mchAvailPulse 2s ease-in-out infinite;
}
.mch-availability.is-offline {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.22);
    color: #b45309;
}
.mch-availability.is-offline .mch-availability-dot {
    background: #f59e0b;
}
.mch-widget.mch-theme-dark .mch-availability.is-online { color: #6ee7b7; }
.mch-widget.mch-theme-dark .mch-availability.is-offline { color: #fbbf24; }

@keyframes mchAvailPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
    50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.mch-primary-btn:disabled {
    cursor: not-allowed !important;
    transform: none !important;
}

/* "(optional)" hint inside floating labels */
.mch-field-hint {
    color: var(--mch-muted);
    font-size: 0.85em;
    font-weight: 400;
    margin-left: 4px;
}

/* Field error state */
.mch-input.is-invalid input,
.mch-input.is-invalid textarea {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}
.mch-input-error {
    color: #ef4444;
    font-size: 11.5px;
    margin: 4px 0 0 4px;
    line-height: 1.4;
    display: block;
}

/* ==========================================================================
   Typing indicator (customer side)
   ========================================================================== */
.mch-typing-row {
    padding: 4px 14px 6px;
    display: flex;
    align-items: center;
}
.mch-typing-bubble {
    display: inline-flex;
    gap: 3px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
}
.mch-typing-bubble span {
    width: 6px;
    height: 6px;
    background: var(--mch-muted, #9ca3af);
    border-radius: 50%;
    animation: mchTypingBounce 1.4s infinite ease-in-out;
}
.mch-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.mch-typing-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mchTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
    30%           { transform: translateY(-3px); opacity: 1; }
}

/* System notes inside the chat thread (apology, agent joined, etc).
 * Subtle italics-style note centered between message bubbles. */
.mch-system-note {
    text-align: center;
    font-size: 12px;
    color: var(--mch-muted);
    font-style: italic;
    padding: 8px 16px;
    margin: 8px 0;
    line-height: 1.4;
}

/* Typing indicator: name beside dots ("Anna is typing…") */
.mch-typing-name {
    font-size: 11.5px;
    color: var(--mch-muted);
    font-style: italic;
    margin-left: 4px;
}


/* ==========================================================================
   v2.7.0: Image attachments (customer side)
   ========================================================================== */

.mch-attach-btn {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px;
    color: var(--mch-muted, #9ca3af);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.mch-attach-btn:hover {
    color: var(--mch-text);
    background: rgba(255, 255, 255, 0.04);
}

.mch-attach-preview {
    padding: 8px 14px;
    border-top: 1px solid var(--mch-border);
    background: rgba(0, 0, 0, 0.02);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mch-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    background: var(--mch-surface);
    border: 1px solid var(--mch-border);
    border-radius: 6px;
    font-size: 12px;
    max-width: 200px;
}
.mch-attach-chip img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.mch-attach-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mch-text);
}
.mch-attach-chip-x {
    background: transparent;
    border: 0;
    color: var(--mch-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
}
.mch-attach-chip-x:hover { color: #ef4444; }

.mch-attach-error {
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border-radius: 6px;
    font-size: 12px;
    width: 100%;
    margin-top: 4px;
}

.mch-msg-attachments {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mch-msg-img-link {
    display: block;
    max-width: 240px;
}
.mch-msg-img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    cursor: zoom-in;
    display: block;
}
.mch-msg-file {
    display: inline-block;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--mch-text);
    text-decoration: none;
    font-size: 13px;
}
.mch-msg-file:hover { background: rgba(255, 255, 255, 0.12); }
