/* Shared live chat widget for all bank portals */

.portal-chat.ar-chat,
.ar-chat.portal-chat {
    position: fixed;
    right: 24px;
    bottom: 56px;
    z-index: 9999;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.portal-chat .ar-chat-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(380px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 20px 48px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.portal-chat .ar-chat-panel[hidden] {
    display: none;
}

.portal-chat .ar-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--chat-accent, #2563eb) 0%, color-mix(in srgb, var(--chat-accent, #2563eb) 82%, #000) 100%);
    color: #fff;
}

.portal-chat .ar-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.portal-chat .ar-chat-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
}

.portal-chat .ar-chat-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.portal-chat .ar-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.92;
    margin-top: 2px;
}

.portal-chat .ar-chat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #86efac;
    box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.45);
    animation: portal-chat-pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes portal-chat-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.4); }
    50% { box-shadow: 0 0 0 5px rgba(134, 239, 172, 0); }
}

.portal-chat .ar-chat-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.portal-chat .ar-chat-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.portal-chat .ar-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f3f5f7;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 260px;
    max-height: 360px;
}

.portal-chat .ar-chat-body::-webkit-scrollbar {
    width: 5px;
}

.portal-chat .ar-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 999px;
}

.portal-chat .ar-chat-system {
    align-self: center;
    max-width: 92%;
    margin: 4px 0 8px;
    padding: 8px 14px;
    font-size: 11px;
    line-height: 1.45;
    text-align: center;
    color: #5c6b73;
    background: #fff;
    border: 1px solid #e4e9ec;
    border-radius: 999px;
}

.portal-chat .ar-chat-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 82%;
    animation: portal-chat-msg-in 0.2s ease-out;
}

@keyframes portal-chat-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.portal-chat .ar-chat-msg--visitor {
    align-self: flex-end;
    align-items: flex-end;
}

.portal-chat .ar-chat-msg--admin {
    align-self: flex-start;
    align-items: flex-start;
}

.portal-chat .ar-chat-msg-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--chat-accent, #2563eb);
    padding-left: 4px;
}

.portal-chat .ar-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.portal-chat .ar-chat-msg--visitor .ar-chat-msg-bubble {
    background: linear-gradient(135deg, var(--chat-accent, #2563eb) 0%, color-mix(in srgb, var(--chat-accent, #2563eb) 88%, #fff) 100%);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.portal-chat .ar-chat-msg--admin .ar-chat-msg-bubble {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 5px;
}

.portal-chat .ar-chat-msg-meta {
    font-size: 10px;
    color: #94a3b8;
    padding: 0 4px;
}

.portal-chat .ar-chat-msg--visitor .ar-chat-msg-meta {
    text-align: right;
}

.portal-chat .ar-chat-footer {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid #eef2f4;
    background: #fff;
    align-items: center;
}

.portal-chat .ar-chat-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #dde4e8;
    border-radius: 999px;
    background: #f8fafb;
    color: #1e293b;
    padding: 11px 18px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.portal-chat .ar-chat-input::placeholder {
    color: #94a3b8;
}

.portal-chat .ar-chat-input:focus {
    outline: none;
    border-color: var(--chat-accent, #2563eb);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-accent, #2563eb) 18%, transparent);
}

.portal-chat .ar-chat-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-accent, #2563eb) 0%, color-mix(in srgb, var(--chat-accent, #2563eb) 82%, #000) 100%);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--chat-accent, #2563eb) 35%, transparent);
    transition: transform 0.12s, box-shadow 0.15s;
}

.portal-chat .ar-chat-send:hover {
    transform: scale(1.04);
}

.portal-chat .ar-chat-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.portal-chat .ar-chat-fab {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-accent, #2563eb) 0%, color-mix(in srgb, var(--chat-accent, #2563eb) 82%, #000) 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--chat-accent, #2563eb) 35%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.15s;
}

.portal-chat .ar-chat-fab:hover {
    transform: translateY(-2px);
}

.portal-chat.is-open .ar-chat-fab {
    transform: scale(0.94);
}

.portal-chat .ar-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.portal-chat .ar-chat-badge[hidden] {
    display: none;
}

.bank-kbc { --chat-accent: #005290; }
.bank-fintro { --chat-accent: #004e90; }
.bank-nagelmackers { --chat-accent: #006847; }
.bank-crelan { --chat-accent: #00843d; }

body.bank-crelan .portal-chat.ar-chat,
body.bank-crelan .ar-chat.portal-chat {
    bottom: 16px;
}

body.bank-crelan .portal-chat .ar-chat-panel {
    bottom: 72px;
}
.bank-hellobank { --chat-accent: #00a19a; }
.bank-bnpparibas { --chat-accent: #00915a; }
.bank-beobank { --chat-accent: #572381; }
.bank-argenta { --chat-accent: #00995f; }
.bank-ing { --chat-accent: #ff6200; }
.bank-belfius { --chat-accent: #c30045; }

@media (max-width: 640px) {
    .portal-chat.ar-chat {
        right: 16px;
        bottom: 48px;
    }

    .portal-chat .ar-chat-panel {
        width: calc(100vw - 32px);
        border-radius: 18px;
    }
}
