/**
 * BANCY Contact Button - 前端样式
 * 悬浮联系按钮样式，采用现代化设计系统
 */

/* ============================================
   设计令牌 - Design Tokens
   ============================================ */
:root {
    --bancy-z-index: 99999;
    --bancy-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* 阴影系统 */
    --bancy-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --bancy-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --bancy-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --bancy-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --bancy-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* 动画时间 */
    --bancy-duration-fast: 150ms;
    --bancy-duration-normal: 200ms;
    --bancy-duration-slow: 300ms;

    /* 缓动函数 */
    --bancy-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --bancy-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --bancy-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   容器定位
   ============================================ */
#bancy-contact-wrapper {
    position: fixed;
    z-index: var(--bancy-z-index);
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 14px;
    font-family: var(--bancy-font);
}

/* ============================================
   按钮基础样式
   ============================================ */
.bancy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    text-decoration: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.bancy-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* ============================================
   主按钮样式
   ============================================ */
.bancy-main-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    color: #fff;
    position: relative;
    z-index: 10;
    box-shadow: var(--bancy-shadow-xl);
    transition: all var(--bancy-duration-normal) var(--bancy-ease-out);
}

.bancy-main-btn::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: inherit;
    filter: blur(12px);
    opacity: 0.4;
    z-index: -1;
    transition: opacity var(--bancy-duration-normal) var(--bancy-ease-out);
}

.bancy-main-btn:hover {
    transform: scale(1.08);
    box-shadow: var(--bancy-shadow-2xl);
}

.bancy-main-btn:hover::before {
    opacity: 0.6;
}

.bancy-main-btn:active {
    transform: scale(0.95);
}

.bancy-main-btn .bancy-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--bancy-duration-normal) var(--bancy-ease-spring);
}

.bancy-main-btn .bancy-icon-close {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-90deg) scale(0.5);
}

.bancy-main-btn.active .bancy-icon-open {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.5);
}

.bancy-main-btn.active .bancy-icon-close {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

/* ============================================
   联系方式列表
   ============================================ */
.bancy-contact-list {
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.bancy-contact-list.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   联系方式按钮
   ============================================ */
.bancy-contact-btn {
    height: 52px;
    border-radius: 26px;
    padding: 0 22px 0 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    gap: 12px;
    white-space: nowrap;
    box-shadow: var(--bancy-shadow-lg);
    backdrop-filter: blur(8px);
    transition: all var(--bancy-duration-normal) var(--bancy-ease-out);

    /* 初始隐藏状态 */
    opacity: 0;
    transform: translateX(30px) scale(0.9);
}

.bancy-contact-btn svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.bancy-contact-list.active .bancy-contact-btn {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.bancy-contact-btn:hover {
    transform: translateX(-8px) scale(1.02);
    box-shadow: var(--bancy-shadow-xl);
}

.bancy-contact-btn:active {
    transform: translateX(-4px) scale(0.98);
}

/* 标签文字 */
.bancy-label {
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ============================================
   动画效果 - 逐个展开
   ============================================ */
.bancy-animated .bancy-contact-list.active .bancy-contact-btn:nth-child(1) {
    transition-delay: 50ms;
}

.bancy-animated .bancy-contact-list.active .bancy-contact-btn:nth-child(2) {
    transition-delay: 100ms;
}

.bancy-animated .bancy-contact-list.active .bancy-contact-btn:nth-child(3) {
    transition-delay: 150ms;
}

.bancy-animated .bancy-contact-list.active .bancy-contact-btn:nth-child(4) {
    transition-delay: 200ms;
}

.bancy-animated .bancy-contact-list.active .bancy-contact-btn:nth-child(5) {
    transition-delay: 250ms;
}

.bancy-animated .bancy-contact-list.active .bancy-contact-btn:nth-child(6) {
    transition-delay: 300ms;
}

.bancy-animated .bancy-contact-list.active .bancy-contact-btn:nth-child(7) {
    transition-delay: 350ms;
}

/* 收起时更快的动画 */
.bancy-animated .bancy-contact-list:not(.active) .bancy-contact-btn {
    transition-delay: 0ms !important;
    transition-duration: var(--bancy-duration-fast);
}

/* ============================================
   各联系方式渐变色
   ============================================ */
.bancy-whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.bancy-email {
    background: linear-gradient(135deg, #EA4335 0%, #B31412 100%);
}

.bancy-phone {
    background: linear-gradient(135deg, #34A853 0%, #1E7E34 100%);
}

.bancy-wechat {
    background: linear-gradient(135deg, #07C160 0%, #059849 100%);
}

.bancy-telegram {
    background: linear-gradient(135deg, #2AABEE 0%, #0088cc 100%);
}

.bancy-messenger {
    background: linear-gradient(135deg, #00B2FF 0%, #006AFF 100%);
}

.bancy-custom {
    background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
}

/* ============================================
   微信二维码弹窗
   ============================================ */
.bancy-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: calc(var(--bancy-z-index) + 10);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--bancy-duration-normal) var(--bancy-ease-out);
}

.bancy-modal.active {
    opacity: 1;
    visibility: visible;
}

.bancy-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bancy-modal-content {
    position: relative;
    background: #fff;
    padding: 32px;
    border-radius: 20px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: var(--bancy-shadow-2xl);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--bancy-duration-slow) var(--bancy-ease-spring);
}

.bancy-modal.active .bancy-modal-content {
    transform: scale(1) translateY(0);
}

.bancy-modal-content h3 {
    margin: 0 0 24px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.bancy-modal-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    box-shadow: var(--bancy-shadow);
}

.bancy-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all var(--bancy-duration-fast) var(--bancy-ease-out);
}

.bancy-modal-close:hover {
    background: #e8e8e8;
    color: #333;
    transform: rotate(90deg);
}

/* ============================================
   脉冲动画效果
   ============================================ */
@keyframes bancy-pulse {

    0%,
    100% {
        box-shadow:
            var(--bancy-shadow-xl),
            0 0 0 0 rgba(var(--bancy-pulse-color, 37, 211, 102), 0.5);
    }

    50% {
        box-shadow:
            var(--bancy-shadow-xl),
            0 0 0 12px rgba(var(--bancy-pulse-color, 37, 211, 102), 0);
    }
}

.bancy-main-btn:not(.active) {
    animation: bancy-pulse 2.5s ease-in-out infinite;
}

/* ============================================
   移动端适配
   ============================================ */
@media (max-width: 768px) {
    .bancy-main-btn {
        width: 58px;
        height: 58px;
    }

    .bancy-main-btn svg {
        width: 26px;
        height: 26px;
    }

    .bancy-contact-btn {
        height: 48px;
        padding: 0 18px 0 14px;
        font-size: 13px;
        gap: 10px;
        border-radius: 24px;
    }

    .bancy-contact-btn svg {
        width: 22px;
        height: 22px;
    }

    .bancy-modal-content {
        padding: 28px;
        border-radius: 16px;
    }
}

/* 小屏手机 */
@media (max-width: 375px) {
    .bancy-main-btn {
        width: 54px;
        height: 54px;
    }

    .bancy-contact-btn {
        height: 44px;
        padding: 0 16px 0 12px;
        font-size: 12px;
    }

    .bancy-contact-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* ============================================
   减少动画偏好
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    .bancy-main-btn,
    .bancy-contact-btn,
    .bancy-modal,
    .bancy-modal-content,
    .bancy-modal-close {
        transition: none;
    }

    .bancy-main-btn:not(.active) {
        animation: none;
    }
}

/* ============================================
   打印时隐藏
   ============================================ */
@media print {
    #bancy-contact-wrapper {
        display: none !important;
    }