/* CARIDIA site assistant (chat window + WhatsApp handover). Markup is built in assets/js/caridia-chat.js. */
.cchat-launcher,
.cchat-panel {
    --cchat-navy: #1f2f5c;
    --cchat-gold: #a89070;
    --cchat-wa: #075e54;
    --cchat-line: #dfe3ec;
    --cchat-soft: #f3f5f9;
    font-family: inherit;
    box-sizing: border-box;
}
.cchat-panel *, .cchat-launcher * { box-sizing: border-box; }

.cchat-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 26px;
    background: var(--cchat-navy);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(31, 47, 92, .28);
}
.cchat-launcher:hover { background: #16234a; color: #fff; }
.cchat-launcher svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.cchat-launcher-wa { background: var(--cchat-wa); }
.cchat-launcher-wa:hover { background: #054c44; }
.cchat-launcher-open { display: none; }

.cchat-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9991;
    display: flex;
    flex-direction: column;
    width: 370px;
    max-width: calc(100vw - 24px);
    height: 540px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    border: 1px solid var(--cchat-line);
    border-radius: 16px;
    background: #fff;
    color: #1b2233;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(20, 30, 60, .26);
}
.cchat-panel[hidden] { display: none; }

.cchat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 12px 14px 18px;
    background: var(--cchat-navy);
    color: #fff;
    border-bottom: 3px solid var(--cchat-gold);
}
.cchat-head strong { display: block; font-size: 16px; font-weight: 800; line-height: 1.2; }
.cchat-head small { display: block; margin-top: 3px; font-size: 12px; line-height: 1.35; color: #dbe1f0; }
.cchat-close {
    flex: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.cchat-close:hover { background: rgba(255, 255, 255, .14); }

.cchat-log {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
}
.cchat-msg {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.cchat-msg-assistant { align-self: flex-start; background: var(--cchat-soft); border-bottom-left-radius: 4px; }
.cchat-msg-user { align-self: flex-end; background: var(--cchat-navy); color: #fff; border-bottom-right-radius: 4px; }
.cchat-msg a { color: var(--cchat-navy); font-weight: 600; text-decoration: underline; }
.cchat-typing { color: #5b6478; font-style: italic; }

.cchat-msg .cchat-handoff,
.cchat-foot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
}
.cchat-msg .cchat-handoff {
    margin-top: 10px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 22px;
    background: var(--cchat-wa);
    color: #fff;
    font-size: 14.5px;
    white-space: normal;
}
.cchat-msg .cchat-handoff:hover { background: #054c44; }
.cchat-handoff svg, .cchat-foot-link svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

.cchat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--cchat-line); }
.cchat-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #b9c0d0;
    border-radius: 22px;
    background: #fff;
    color: inherit;
    font: inherit;
    font-size: 16px;
}
.cchat-send {
    flex: none;
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 22px;
    background: var(--cchat-navy);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.cchat-send:hover { background: #16234a; }
.cchat-send:disabled { opacity: .55; cursor: default; }

.cchat-foot { padding: 4px 16px 14px; text-align: center; }
.cchat-foot-link { min-height: 36px; color: var(--cchat-wa); font-size: 14px; }
.cchat-foot-link:hover { text-decoration: underline; }
.cchat-foot small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: #5b6478; }

.cchat-launcher:focus-visible,
.cchat-close:focus-visible,
.cchat-send:focus-visible,
.cchat-input:focus-visible,
.cchat-panel a:focus-visible {
    outline: 3px solid var(--cchat-gold);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .cchat-launcher { right: 12px; bottom: 12px; }
    .cchat-panel {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        height: calc(100dvh - 24px);
        max-height: 640px;
    }
}
