/* ===== Contact Float Button Plugin ===== */

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600&display=swap');

/* Wrapper */
.cfb-wrapper {
    position: fixed;
    bottom: var(--cfb-bottom, 30px);
    right: 20px;
    z-index: 99999;
    font-family: 'Be Vietnam Pro', -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* ===== POPUP ===== */
.cfb-popup {
    position: absolute;
    bottom: calc(var(--cfb-btn-size, 60px) + 16px);
    right: 0;
    width: 290px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.85) translateY(10px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cfb-popup.cfb-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
    visibility: visible;
}

/* Popup Header */
.cfb-popup-header {
    background: var(--cfb-primary, #2d6a4f);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.cfb-chat-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cfb-chat-icon svg {
    width: 24px;
    height: 24px;
}

.cfb-greeting {
    margin: 0;
    color: #fff;
    font-size: 13.5px;
    line-height: 1.55;
    font-weight: 500;
}

/* Popup Body */
.cfb-popup-body {
    padding: 8px 0;
}

/* Each Contact Item */
.cfb-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 18px;
    text-decoration: none !important;
    color: #1a1a2e !important;
    transition: background 0.18s ease;
    cursor: pointer;
}

.cfb-item:hover {
    background: #f5f7fa;
}

.cfb-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.cfb-item-icon svg {
    width: 22px;
    height: 22px;
}

/* Messenger */
.cfb-messenger .cfb-item-icon {
    background: #e8f0ff;
}

/* Phone */
.cfb-phone .cfb-item-icon {
    background: var(--cfb-primary, #2d6a4f);
}

/* Zalo */
.cfb-zalo .cfb-item-icon {
    background: #0068ff;
}
.cfb-zalo-icon {
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Affiliate */
.cfb-affiliate .cfb-item-icon {
    background: #fff1eb;
}

/* Item Text */
.cfb-item-text {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.cfb-item-label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    flex: 1;
}

.cfb-item-sub {
    font-size: 11.5px;
    color: #888;
    margin-top: 1px;
}

.cfb-item-arrow {
    font-size: 20px;
    color: #ccc;
    font-weight: 300;
    line-height: 1;
    margin-left: auto;
    padding-left: 8px;
}

/* ===== TOGGLE BUTTON ===== */
.cfb-toggle {
    width: var(--cfb-btn-size, 60px);
    height: var(--cfb-btn-size, 60px);
    border-radius: 50%;
    background: var(--cfb-primary, #2d6a4f);
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 0 4px 20px rgba(45,106,79,0.45), 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    outline: none;
    padding: 0;
}

.cfb-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(45,106,79,0.55), 0 2px 12px rgba(0,0,0,0.2);
}

.cfb-toggle:active {
    transform: scale(0.96);
}

/* Icon inside button */
.cfb-icon-chat,
.cfb-icon-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cfb-icon-chat svg,
.cfb-icon-close svg {
    width: calc(var(--cfb-btn-size, 60px) * 0.4);
    height: calc(var(--cfb-btn-size, 60px) * 0.4);
}

.cfb-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.7);
}

/* Label below icon */
.cfb-label {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    font-size: 10px;
    font-weight: 600;
    color: var(--cfb-primary, #2d6a4f);
    white-space: nowrap;
    letter-spacing: 0.3px;
    display: none; /* shown only on desktop with enough space */
}

/* Online dot */
.cfb-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 11px;
    height: 11px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: cfb-pulse 2s infinite;
}

@keyframes cfb-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    50% { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* Ripple ring around button */
.cfb-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--cfb-primary, #2d6a4f);
    animation: cfb-ring 2.5s ease-out infinite;
    opacity: 0;
}

@keyframes cfb-ring {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Open state: toggle icon */
.cfb-wrapper.is-open .cfb-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}

.cfb-wrapper.is-open .cfb-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .cfb-popup {
        width: 265px;
    }

    .cfb-popup-header {
        padding: 14px 16px;
    }

    .cfb-greeting {
        font-size: 12.5px;
    }

    .cfb-chat-icon {
        width: 38px;
        height: 38px;
    }

    .cfb-item {
        padding: 10px 14px;
        gap: 11px;
    }

    .cfb-item-icon {
        width: 36px;
        height: 36px;
    }

    .cfb-item-label {
        font-size: 13px;
    }

    .cfb-item-sub {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .cfb-popup {
        width: 240px;
        border-radius: 14px;
    }
}

/* Divider between items */
.cfb-item + .cfb-item {
    border-top: 1px solid #f0f0f0;
}
