/**
 * Shois Chat Button — T07 Bubblegum Morphic Template
 *
 * Playful candy aesthetic with bubblegum pink, jelly animations,
 * polka dots, wavy header arc, and candy shimmer effects.
 * Type: Bubble Popup
 *
 * @package ShoisChatButton
 */

/* ─── Design Tokens ─────────────────────────────────── */
.shcb-template-bubblegum {
    --scb-primary: #FF6B9D;
    --scb-secondary: #A78BFA;
    --scb-bg: #FEFCFF;
    --shcb-header-bg: linear-gradient(135deg, #FF6B9D 0%, color-mix(in srgb, #FF6B9D 65%, #A78BFA 40%) 100%);
    --shcb-header-text: #ffffff;
    --scb-text: #3D2B5E;
    --scb-text-light: rgba(61, 43, 94, 0.6);
    --shcb-cta-bg: #FF6B9D;
    --shcb-cta-text: #ffffff;
    --scb-shadow: 0 30px 70px rgba(167,139,250,0.22), 0 10px 28px rgba(255,107,157,0.12);
    --scb-shadow-btn: 0 8px 24px rgba(255,107,157,0.45), 0 3px 8px rgba(0,0,0,0.1);
    --scb-radius-popup: 24px;
    --scb-font: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --_candy-b: #A78BFA;
    --_candy-c: #34D399;
    --_candy-d: #FBBF24;
    --_candy-e: #60A5FA;
    --_p-glow: color-mix(in srgb, var(--scb-primary) 35%, transparent);
    --_p-fade: color-mix(in srgb, var(--scb-primary) 12%, transparent);
    --_p-border: color-mix(in srgb, var(--scb-primary) 25%, transparent);
    --_text-dim: color-mix(in srgb, var(--scb-text) 60%, transparent);
    --_text-sub: color-mix(in srgb, var(--scb-text) 35%, transparent);
    --_shadow-card: 0 2px 8px rgba(167,139,250,0.1), 0 6px 20px rgba(167,139,250,0.08);
}


/* ─── Trigger Button — Jelly Blob ───────────────────── */
.shcb-template-bubblegum .shcb-trigger-btn {
    background: linear-gradient(145deg, var(--scb-primary), color-mix(in srgb, var(--scb-primary) 75%, var(--_candy-b) 30%));
    border: none;
    box-shadow:
        0 0 0 3px rgba(255,255,255,0.4),
        0 0 0 5px color-mix(in srgb, var(--scb-primary) 18%, transparent),
        0 8px 24px rgba(255,107,157,0.45),
        0 3px 8px rgba(0,0,0,0.1),
        inset 0 2px 0 rgba(255,255,255,0.4),
        inset 0 -2px 0 rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    overflow: hidden;
}

/* Candy gloss */
.shcb-template-bubblegum .shcb-trigger-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.1) 35%, transparent 65%);
    pointer-events: none;
}

.shcb-template-bubblegum .shcb-trigger-btn:hover {
    transform: scale(1.1) rotate(8deg);
    box-shadow:
        0 0 0 3px rgba(255,255,255,0.5),
        0 0 0 7px color-mix(in srgb, var(--scb-primary) 22%, transparent),
        0 14px 32px rgba(255,107,157,0.55),
        0 4px 12px rgba(0,0,0,0.12);
    animation: shcb-bg-jelly-idle 0.6s ease-in-out infinite;
}

.shcb-template-bubblegum .shcb-trigger-btn:active {
    transform: scale(0.88);
    animation: shcb-bg-jelly-squish 0.4s ease !important;
}

@keyframes shcb-bg-jelly-idle {
    0%,100% { border-radius: 50%; }
    25%     { border-radius: 58% 42% 55% 45% / 48% 52% 48% 52%; }
    50%     { border-radius: 42% 58% 45% 55% / 52% 48% 52% 48%; }
    75%     { border-radius: 55% 45% 58% 42% / 45% 55% 45% 55%; }
}

@keyframes shcb-bg-jelly-squish {
    0%   { transform: scale(0.88) scaleX(1.2) scaleY(0.8); }
    40%  { transform: scale(1.05) scaleX(0.95) scaleY(1.05); }
    70%  { transform: scale(0.97) scaleX(1.02) scaleY(0.98); }
    100% { transform: scale(1); }
}

.shcb-template-bubblegum .shcb-trigger-icon svg {
    fill: white;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}

/* Trigger label */
.shcb-template-bubblegum .shcb-trigger-label {
    font-weight: 700;
    color: var(--scb-text);
    background: white;
    box-shadow: var(--_shadow-card);
}

/* Pulse ring — candy colors */
.shcb-template-bubblegum .shcb-pulse-ring {
    border-color: color-mix(in srgb, var(--scb-primary) 30%, transparent);
}


/* ─── Popup ─────────────────────────────────────────── */
.shcb-template-bubblegum .shcb-popup {
    background: var(--scb-bg);
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--scb-primary) 12%, transparent),
        0 30px 70px rgba(167,139,250,0.22),
        0 10px 28px rgba(255,107,157,0.12),
        0 3px 8px rgba(0,0,0,0.06);
}


/* ─── Header — Candy Gradient + Blobs ───────────────── */
.shcb-template-bubblegum .shcb-popup-header {
    background: linear-gradient(135deg, var(--scb-primary) 0%, color-mix(in srgb, var(--scb-primary) 65%, var(--_candy-b) 40%) 100%);
    position: relative;
    overflow: hidden;
    padding: 22px 20px 48px;
}

/* Floating blobs */
.shcb-template-bubblegum .shcb-popup-header::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -10px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    animation: shcb-bg-blob-float 5s ease-in-out infinite;
}

.shcb-template-bubblegum .shcb-popup-header::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 30px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    animation: shcb-bg-blob-float 6s ease-in-out 0.5s infinite;
    pointer-events: none;
}

@keyframes shcb-bg-blob-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-10px) scale(1.1); }
}

.shcb-template-bubblegum .shcb-header-text {
    position: relative;
    z-index: 2;
}

.shcb-template-bubblegum .shcb-header-title {
    font-family: 'Fredoka One', 'Nunito', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.shcb-template-bubblegum .shcb-header-subtitle {
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0.75;
}

/* Close — round white */
.shcb-template-bubblegum .shcb-close-btn {
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    z-index: 3;
    transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

.shcb-template-bubblegum .shcb-close-btn svg {
    stroke: white;
}

.shcb-template-bubblegum .shcb-close-btn:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.1) rotate(90deg);
}


/* ─── Body ──────────────────────────────────────────── */
.shcb-template-bubblegum .shcb-popup-body {
    background: var(--scb-bg);
    z-index: 2;
}

/* Welcome — candy gradient border */
.shcb-template-bubblegum .shcb-welcome-message {
    border-radius: 16px;
    padding: 12px 14px 12px 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--_candy-b) 8%, transparent), color-mix(in srgb, var(--scb-primary) 5%, transparent));
    border: 1.5px solid color-mix(in srgb, var(--_candy-b) 18%, transparent);
    position: relative;
    overflow: hidden;
}

.shcb-template-bubblegum .shcb-welcome-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 3.5px;
    background: linear-gradient(180deg, var(--scb-primary), var(--_candy-b));
    border-radius: 0 3px 3px 0;
}

.shcb-template-bubblegum .shcb-welcome-message p {
    color: var(--_text-dim);
    font-size: 13px;
    line-height: 1.7;
}


/* ─── Chips ─────────────────────────────────────────── */
.shcb-template-bubblegum .shcb-chip {
    background: color-mix(in srgb, var(--_candy-b) 8%, transparent);
    border: 1.5px solid color-mix(in srgb, var(--scb-primary) 18%, transparent);
    color: var(--scb-primary);
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.22s ease;
}

.shcb-template-bubblegum .shcb-chip:hover {
    background: var(--_p-fade);
    border-color: var(--_p-border);
    transform: translateY(-1px);
}


/* ─── Agent Cards — Candy Glass ─────────────────────── */
.shcb-template-bubblegum .shcb-agent-card {
    background: white;
    border: 1.5px solid rgba(167,139,250,0.12);
    border-radius: 18px;
    padding-right: 38px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 1px 0 rgba(255,255,255,1) inset,
        0 2px 6px rgba(167,139,250,0.09),
        0 6px 18px rgba(167,139,250,0.07);
    transition: border-color 0.22s, box-shadow 0.25s, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

/* Candy shimmer top edge */
.shcb-template-bubblegum .shcb-agent-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--scb-primary), var(--_candy-b), var(--_candy-c), var(--_candy-d), var(--_candy-e), transparent);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease, left 0.4s ease, right 0.4s ease;
}

/* Arrow */
.shcb-template-bubblegum .shcb-agent-card::after {
    content: '›';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    font-weight: 300;
    color: color-mix(in srgb, var(--scb-primary) 35%, transparent);
    transition: color 0.2s, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
}

.shcb-template-bubblegum .shcb-agent-card:hover {
    border-color: color-mix(in srgb, var(--scb-primary) 28%, transparent);
    box-shadow:
        0 1px 0 rgba(255,255,255,1) inset,
        0 4px 14px rgba(255,107,157,0.15),
        0 10px 28px rgba(167,139,250,0.14);
    transform: translateY(-3px) scale(1.01);
}

.shcb-template-bubblegum .shcb-agent-card:hover::before {
    opacity: 1;
    left: 0%;
    right: 0%;
}

.shcb-template-bubblegum .shcb-agent-card:hover::after {
    color: var(--scb-primary);
    transform: translateY(-50%) translateX(4px) scale(1.2);
}


/* ─── Avatar — Candy pill with wiggle ───────────────── */
.shcb-template-bubblegum .shcb-agent-avatar {
    border-radius: 14px;
}

.shcb-template-bubblegum .shcb-avatar-initials {
    font-weight: 800;
    font-size: 18px;
    box-shadow:
        0 3px 12px rgba(255,107,157,0.35),
        0 0 0 2px rgba(255,255,255,0.7),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

.shcb-template-bubblegum .shcb-agent-card:hover .shcb-agent-avatar {
    animation: shcb-bg-wiggle 0.5s ease;
}

@keyframes shcb-bg-wiggle {
    0%   { transform: rotate(0); }
    20%  { transform: rotate(-10deg) scale(1.08); }
    40%  { transform: rotate(10deg) scale(1.1); }
    60%  { transform: rotate(-6deg) scale(1.05); }
    80%  { transform: rotate(4deg); }
    100% { transform: rotate(0); }
}


/* ─── Agent Info ────────────────────────────────────── */
.shcb-template-bubblegum .shcb-agent-name {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--scb-text);
    position: relative;
    display: inline-block;
}

/* Rainbow underline on hover */
.shcb-template-bubblegum .shcb-agent-name::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    right: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--scb-primary), var(--_candy-b), var(--_candy-c));
    border-radius: 2px;
    transition: right 0.35s cubic-bezier(0.16,1,0.3,1);
}

.shcb-template-bubblegum .shcb-agent-card:hover .shcb-agent-name::after {
    right: 0;
}

.shcb-template-bubblegum .shcb-agent-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--_text-sub);
}

.shcb-template-bubblegum .shcb-agent-status:has(.shcb-status-online) {
    color: var(--_candy-c);
}

.shcb-template-bubblegum .shcb-status-online {
    background: var(--_candy-c);
    box-shadow: 0 0 6px rgba(52,211,153,0.5);
    animation: shcb-bg-dot-pop 2s ease-in-out infinite;
}

@keyframes shcb-bg-dot-pop {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(0.4); opacity: 0.3; }
}

.shcb-template-bubblegum .shcb-status-offline {
    background: rgba(61,43,94,0.2);
}


/* ─── Footer ────────────────────────────────────────── */
.shcb-template-bubblegum .shcb-popup-footer {
    background: var(--scb-bg);
    z-index: 2;
}

.shcb-template-bubblegum .shcb-powered-by {
    font-size: 11px;
    font-weight: 700;
    color: var(--_text-sub);
}


/* ─── Badge ─────────────────────────────────────────── */
.shcb-template-bubblegum .shcb-badge {
    background: var(--scb-primary);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(255,107,157,0.4);
}


/* ─── Stagger Entry ─────────────────────────────────── */
.shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-welcome-message {
    animation: shcb-bg-pop-entry 0.5s cubic-bezier(0.16,1,0.3,1) 0.06s both;
}
.shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-chips {
    animation: shcb-bg-pop-entry 0.5s cubic-bezier(0.16,1,0.3,1) 0.12s both;
}
.shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-agent-card:nth-child(1) {
    animation: shcb-bg-pop-entry 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.18s both;
}
.shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-agent-card:nth-child(2) {
    animation: shcb-bg-pop-entry 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.26s both;
}
.shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-agent-card:nth-child(3) {
    animation: shcb-bg-pop-entry 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.34s both;
}
.shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-popup-footer {
    animation: shcb-bg-pop-entry 0.5s cubic-bezier(0.16,1,0.3,1) 0.34s both;
}

@keyframes shcb-bg-pop-entry {
    from { opacity: 0; transform: scale(0.88) translateY(14px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}


/* ─── Reduced Motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .shcb-template-bubblegum .shcb-trigger-btn:hover {
        animation: none;
    }
    .shcb-template-bubblegum .shcb-popup-header::before,
    .shcb-template-bubblegum .shcb-popup-header::after {
        animation: none;
    }
    .shcb-template-bubblegum .shcb-status-online {
        animation: none;
    }
    .shcb-template-bubblegum .shcb-agent-card:hover .shcb-agent-avatar {
        animation: none;
    }
    .shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-welcome-message,
    .shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-chips,
    .shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-agent-card,
    .shcb-template-bubblegum .shcb-popup.shcb-popup-visible .shcb-popup-footer {
        animation: none;
    }
}
