:root {
    --rc-primary: var(--cookie-consent-primary, #1b3867);
    --rc-primary-hover: var(--cookie-consent-primary-hover, #14294c);
    --rc-bg: #ffffff;
    --rc-text: #1b1b1b;
    --rc-border: rgba(0, 0, 0, 0.1);
}

/* Safety: enforce hidden attribute visibility for chat lists */
.direct-chat-messages[hidden] {
    display: none !important;
}

.report-chat[hidden] {
    display: none !important;
}

.report-chat__toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--rc-primary);
    color: #fff;
    box-shadow: 0 12px 32px rgba(27, 56, 103, 0.35);
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 9996;
    opacity: 1;
    transform: translateY(0);
    transition: background 0.2s ease;
}

.report-chat__toggle::before {
    content: '\f4ad';
    /* comment-dots */
    font-family: 'Font Awesome 6 Pro', 'Font Awesome 5 Pro', 'FontAwesome', 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 18px;
}

.report-chat__toggle:hover,
.report-chat__toggle:focus-visible {
    background: var(--rc-primary-hover);
    outline: 3px solid rgba(255, 193, 7, 0.85);
    outline-offset: 4px;
}

/* Unread badge on toggle (numeric) */
.report-chat__toggle.has-unread::after {
    content: attr(data-unread);
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    background: #C72030;
    /* red */
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-chat__panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: min(420px, 92vw);
    max-height: calc(100vh - 48px);
    background: var(--rc-bg);
    color: var(--rc-text);
    border-radius: 16px;
    border: 1px solid var(--rc-border);
    box-shadow: 0 18px 48px rgba(15, 20, 44, 0.22);
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

.report-chat__header {
    position: relative;
    padding: 14px 16px 8px 16px;
    border-bottom: 1px solid var(--rc-border);
}

.report-chat__header h2 {
    font-size: 1.05rem;
    margin: 0 0 8px 0;
}

.report-chat__controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.report-chat__select {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--rc-border);
    background: #fff;
}

.report-chat__close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--rc-border);
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: inherit;
}

.report-chat__body {
    padding: 10px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-chat__messages {
    display: block;
}

.report-chat__form .input-group {
    display: flex;
    gap: 8px;
}

.report-chat__form textarea {
    flex: 1;
    resize: vertical;
    min-height: 44px;
}

.report-chat__send {
    height: 44px;
    min-width: 44px;
    border-radius: 10px;
    border: none;
    background: var(--rc-primary);
    color: #fff;
    padding: 0 12px;
    cursor: pointer;
}

.report-chat__send:hover {
    background: var(--rc-primary-hover);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .report-chat__panel {
        right: 14px;
        left: 14px;
        width: auto;
    }
}

/* Mobile: place chat toggle bottom-left under the cookie consent reopen button */
@media (max-width: 640px) {
    .report-chat__toggle {
        left: 24px;
        right: auto;
        bottom: 80px;
        /* place between consent (24+48=72) and a11y (84) */
    }
}

/* Chat bubbles (wie im Modal) */
.direct-chat-msg {
    position: relative;
    max-width: 70%;
    margin: 1.5rem 0;
}

.direct-chat-msg:not(.right) {
    margin-right: 30%;
}

.direct-chat-msg.right {
    margin-left: 30%;
}

.direct-chat-infos {
    margin-bottom: 0.3rem;
    display: flow-root;
}

.direct-chat-name {
    font-weight: 500;
    color: #495057;
}

.direct-chat-timestamp {
    color: #6c757d;
    font-size: 0.70em;
}

.direct-chat-text {
    border-radius: .3rem;
    background: #f8f9fa;
    border: 1px solid #f1f3f5;
    color: #1f2d3d;
    padding: .6rem .75rem;
    margin: 0;
    position: relative;
    display: block;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.direct-chat-text::after,
.direct-chat-text::before {
    border: solid transparent;
    content: ' ';
    height: 0;
    width: 0;
    pointer-events: none;
    position: absolute;
    top: 10px;
}

.direct-chat-msg:not(.right) .direct-chat-text::after {
    border-width: 5px;
    border-right-color: #f1f3f5;
    left: -10px;
}

.direct-chat-msg:not(.right) .direct-chat-text::before {
    border-width: 6px;
    border-right-color: #f1f3f5;
    left: -12px;
}

.direct-chat-msg.right .direct-chat-text {
    background: var(--rc-primary);
    border-color: var(--rc-primary);
    color: #fff;
}

.direct-chat-msg.right .direct-chat-text::after,
.direct-chat-msg.right .direct-chat-text::before {
    border-left-color: var(--rc-primary);
    border-right-color: transparent;
    left: 100%;
    right: auto;
}

.direct-chat-msg.right .direct-chat-name {
    float: right !important;
}

.direct-chat-msg.right .direct-chat-timestamp {
    float: left !important;
}

.direct-chat-msg:not(.right) .direct-chat-name {
    float: left !important;
}

.direct-chat-msg:not(.right) .direct-chat-timestamp {
    float: right !important;
}
