/* ===========================================================
   WhatsApp Float Chat — Frontend Styles
   =========================================================== */

.wafc-widget {
    --wafc-brand: #25D366;
    --wafc-brand-dark: #128C7E;
    --wafc-bg: #ECE5DD;
    --wafc-bubble: #ffffff;
    --wafc-text: #303030;
    --wafc-muted: #667781;
    --wafc-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Floating trigger button ---------- */
.wafc-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 60px;
    height: 60px;
    padding: 0;
    background: var(--wafc-brand);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    font-size: 15px;
    font-weight: 600;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    position: relative;
}

.wafc-trigger:hover {
    background: var(--wafc-brand-dark);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.5);
}

.wafc-trigger:focus-visible {
    outline: 3px solid rgba(37, 211, 102, 0.5);
    outline-offset: 3px;
}

.wafc-trigger .wafc-icon-open,
.wafc-trigger .wafc-icon-close {
    width: 30px;
    height: 30px;
}

.wafc-trigger .wafc-icon-close {
    display: none;
}

.wafc-widget.is-open .wafc-trigger .wafc-icon-open {
    display: none;
}

.wafc-widget.is-open .wafc-trigger .wafc-icon-close {
    display: inline-block;
}

.wafc-trigger-text {
    display: none;
}

/* Pulse animation on the trigger */
.wafc-trigger::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--wafc-brand);
    opacity: 0.4;
    z-index: -1;
    animation: wafc-pulse 2s ease-out infinite;
}

.wafc-widget.is-open .wafc-trigger::before {
    display: none;
}

@keyframes wafc-pulse {
    0%   { transform: scale(1);   opacity: 0.5; }
    100% { transform: scale(1.4); opacity: 0;   }
}

/* ---------- Chat panel ---------- */
.wafc-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--wafc-shadow);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.wafc-widget.is-open .wafc-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Panel header */
.wafc-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--wafc-brand-dark);
    color: #fff;
    position: relative;
}

.wafc-avatar {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.wafc-avatar svg {
    border-radius: 50%;
    background: #fff;
}

.wafc-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #4ade80;
    border: 2px solid var(--wafc-brand-dark);
    border-radius: 50%;
}

.wafc-header-text {
    flex: 1;
    line-height: 1.3;
    min-width: 0;
}

.wafc-header-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wafc-header-text span {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wafc-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.wafc-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* Panel body */
.wafc-panel-body {
    padding: 22px 16px;
    background: var(--wafc-bg);
    background-image:
        radial-gradient(circle at 25px 25px, rgba(0, 0, 0, 0.02) 2px, transparent 2px),
        radial-gradient(circle at 75px 75px, rgba(0, 0, 0, 0.02) 2px, transparent 2px);
    background-size: 100px 100px;
    min-height: 140px;
}

.wafc-bubble {
    background: var(--wafc-bubble);
    border-radius: 0 8px 8px 8px;
    padding: 10px 12px 6px;
    max-width: 85%;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    position: relative;
    animation: wafc-fade-in 0.4s ease 0.1s both;
}

.wafc-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent var(--wafc-bubble) transparent transparent;
}

.wafc-bubble-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--wafc-brand-dark);
    margin-bottom: 2px;
}

.wafc-bubble p {
    margin: 0 0 4px;
    font-size: 14px;
    color: var(--wafc-text);
    line-height: 1.4;
    word-wrap: break-word;
}

.wafc-bubble-time {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--wafc-muted);
}

@keyframes wafc-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Panel footer */
.wafc-panel-footer {
    padding: 14px 16px 16px;
    background: #fff;
    text-align: center;
}

.wafc-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--wafc-brand);
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.wafc-start-btn:hover,
.wafc-start-btn:focus {
    background: var(--wafc-brand-dark);
    color: #fff;
    transform: translateY(-1px);
}

.wafc-powered {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--wafc-muted);
    letter-spacing: 0.3px;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 480px) {
    .wafc-widget {
        bottom: 16px;
        right: 16px;
    }

    .wafc-panel {
        width: calc(100vw - 32px);
        bottom: 72px;
    }

    .wafc-trigger {
        width: 56px;
        height: 56px;
    }
}