.rc-widget {
    --rc-accent: var(--mh-accent, var(--c-primary, var(--wp--preset--color--primary, #897d4b)));
    --rc-accent-hover: var(--mh-accent-hover, var(--c-primary-500, var(--wp--preset--color--primary, #6b6140)));
    --rc-surface: var(--c-primary-150, var(--c-primary-100, color-mix(in srgb, var(--rc-accent) 24%, #fff)));
    --rc-surface-strong: var(--rc-accent-hover);
    --rc-text-on-accent: var(--c-white, #fff);
    --rc-shadow: color-mix(in srgb, var(--rc-accent) 40%, transparent);
    --rc-bottom: 20px;
    --rc-side: 20px;
}

.rc-widget.rc-pos-right #rc-btn,
.rc-widget.rc-pos-right #rc-panel {
    left: auto;
    right: var(--rc-side);
}

.rc-widget #rc-btn {
    position: fixed;
    left: var(--rc-side);
    bottom: var(--rc-bottom);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--rc-accent);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 5px 15px var(--rc-shadow);
    transition: transform 0.2s, background 0.2s;
    border: none;
    padding: 0;
}

.rc-widget #rc-btn:hover {
    transform: scale(1.08);
    background: var(--rc-accent-hover);
}

.rc-widget #rc-btn img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 50%;
    pointer-events: none;
}

.rc-widget #rc-panel {
    position: fixed;
    left: var(--rc-side);
    bottom: calc(var(--rc-bottom) + 70px);
    padding: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 9999;
    min-width: 280px;
    max-width: min(340px, calc(100vw - 40px));
    transform: translateY(8px);
}

.rc-widget #rc-panel.rc-show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.rc-widget .rc-item {
    display: flex;
    flex-direction: row-reverse;
    backdrop-filter: blur(10px);
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 8px var(--rc-shadow);
    background: transparent;
}

.rc-widget .rc-item:last-child {
    margin-bottom: 0;
}

.rc-widget .rc-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--rc-shadow);
}

.rc-widget .rc-item .rc-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--rc-surface);
    border-radius: 50%;
    flex-shrink: 0;
    padding: 5px;
    box-sizing: content-box;
}

.rc-widget .rc-item .rc-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    background: var(--rc-surface-strong);
    box-sizing: content-box;
    padding: 6px;
    border-radius: 50%;
    box-shadow: 1px 1px 5px 0 var(--rc-shadow);
}

.rc-widget .rc-span {
    background: var(--rc-surface);
    padding: 10px 4px;
    border-radius: 12px;
    flex: 1;
    min-width: 0;
}

.rc-widget .rc-span span {
    display: block;
    background: var(--rc-surface-strong);
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--rc-text-on-accent);
    box-shadow: 1px 1px 5px 0 var(--rc-shadow);
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

@media (max-width: 768px) {
    .rc-widget {
        --rc-side: 15px;
        --rc-bottom: 15px;
    }

    .rc-widget #rc-panel {
        min-width: 260px;
    }

    .rc-widget #rc-btn {
        width: 56px;
        height: 56px;
    }
}

/* --- Animations --- */

.rc-widget {
    --rc-anim-duration: 3s;
}

.rc-widget #rc-btn {
    animation-duration: var(--rc-anim-duration);
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.rc-widget.rc-anim-pulse #rc-btn {
    animation-name: rc-pulse;
}

.rc-widget.rc-anim-shake #rc-btn {
    animation-name: rc-shake;
}

.rc-widget.rc-anim-bounce #rc-btn {
    animation-name: rc-bounce;
}

.rc-widget.rc-anim-float #rc-btn {
    animation-name: rc-float;
}

.rc-widget.rc-anim-wiggle-icon #rc-btn img {
    animation: rc-wiggle var(--rc-anim-duration) ease-in-out infinite;
}

.rc-widget.rc-anim-glow #rc-btn {
    animation-name: rc-glow;
}

.rc-widget .rc-badge-icon {
    position: fixed;
    left: calc(var(--rc-side) + 68px);
    bottom: calc(var(--rc-bottom) + 14px);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.4) translateX(-8px);
}

.rc-widget.rc-pos-right .rc-badge-icon {
    left: auto;
    right: calc(var(--rc-side) + 68px);
    transform: scale(0.4) translateX(8px);
}

.rc-widget.rc-anim-badge-pop .rc-badge-icon {
    animation: rc-badge-pop var(--rc-anim-duration) ease-in-out infinite;
}

.rc-widget .rc-badge-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

@keyframes rc-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

@keyframes rc-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes rc-bounce {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-4px); }
}

@keyframes rc-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes rc-wiggle {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-12deg); }
    40% { transform: rotate(12deg); }
    60% { transform: rotate(-8deg); }
    80% { transform: rotate(8deg); }
}

@keyframes rc-glow {
    0%, 100% {
        box-shadow: 0 5px 15px var(--rc-shadow);
    }
    50% {
        box-shadow: 0 5px 25px var(--rc-shadow), 0 0 20px var(--rc-accent);
    }
}

@keyframes rc-badge-pop {
    0%, 70%, 100% {
        opacity: 0;
        transform: scale(0.4) translateX(-8px);
    }
    10%, 40% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

.rc-widget.rc-pos-right.rc-anim-badge-pop .rc-badge-icon {
    animation-name: rc-badge-pop-rtl;
}

@keyframes rc-badge-pop-rtl {
    0%, 70%, 100% {
        opacity: 0;
        transform: scale(0.4) translateX(8px);
    }
    10%, 40% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

.rc-widget #rc-btn:hover {
    animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
    .rc-widget #rc-btn,
    .rc-widget #rc-btn img,
    .rc-widget .rc-badge-icon {
        animation: none !important;
    }
}

/* --- Integrated help popup on contact FAB --- */

.rc-widget.rc-has-help {
    direction: rtl;
}

.rc-widget .rc-help-bubble {
    position: fixed;
    left: var(--rc-side);
    bottom: calc(var(--rc-bottom) + 72px);
    width: min(300px, calc(100vw - 40px));
    background: var(--rc-help-popup-bg, #ffffff);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 18px 16px 16px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.96);
    transition: opacity 0.28s ease, transform 0.28s ease;
    z-index: 9999;
}

.rc-widget.rc-pos-right .rc-help-bubble {
    left: auto;
    right: var(--rc-side);
}

.rc-widget .rc-help-bubble.rc-show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.rc-widget .rc-help-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.rc-widget .rc-help-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #b0b0b0;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.rc-widget .rc-help-close:hover {
    color: #666;
}

.rc-widget .rc-help-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: auto;
}

.rc-widget .rc-help-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rc-widget .rc-help-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--rc-help-title-color, var(--rc-accent));
    text-align: center;
    line-height: 1.5;
}

.rc-widget .rc-help-greeting,
.rc-widget .rc-help-body {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--rc-help-text-color, #4a4a4a);
    text-align: center;
}

.rc-widget .rc-help-greeting {
    margin-bottom: 4px;
}

.rc-widget .rc-help-cta {
    display: block;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--rc-help-accent, var(--rc-accent));
    color: var(--rc-help-text-on-accent, var(--rc-text-on-accent));
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.rc-widget .rc-help-cta:hover {
    background: var(--rc-help-accent-hover, var(--rc-accent-hover));
    color: var(--rc-help-text-on-accent, var(--rc-text-on-accent));
}

.rc-widget.rc-has-help #rc-panel {
    background: var(--rc-help-popup-bg, #ffffff);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 16px;
}

.rc-widget.rc-has-help .rc-help-intro {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.rc-widget.rc-has-help .rc-item {
    box-shadow: none;
    background: transparent;
    margin-bottom: 6px;
}

.rc-widget.rc-has-help .rc-item:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .rc-widget .rc-help-bubble {
        width: min(280px, calc(100vw - 30px));
    }
}
