/**
 * Modern Floating Buttons Styles
 * 
 * @package B2B_Product_Plugin
 */

/* ==========================================================================
   Floating Buttons Container
   ========================================================================== */

.b2b-floating-buttons {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
}

/* Position Classes */
.b2b-floating-buttons.bottom.right {
    bottom: 30px;
    right: 30px;
}

.b2b-floating-buttons.bottom.left {
    bottom: 30px;
    left: 30px;
}

.b2b-floating-buttons.top.right {
    top: 30px;
    right: 30px;
}

.b2b-floating-buttons.top.left {
    top: 30px;
    left: 30px;
}

/* Legacy support */
.b2b-floating-buttons.right {
    top: 50%;
    transform: translateY(-50%);
    right: 30px;
}

.b2b-floating-buttons.left {
    top: 50%;
    transform: translateY(-50%);
    left: 30px;
}

/* ==========================================================================
   Individual Floating Button
   ========================================================================== */

.floating-button {
    position: relative;
    margin: 0;
}

.floating-button .btn-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    text-decoration: none;
    color: #fff;
    padding: 0;
    overflow: visible;
    width: 48px;
    height: 48px;
    position: relative;
    border-radius: 8px;
}

.floating-button .btn-link:hover {
    text-decoration: none;
    color: #fff;
}

.floating-button .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 5px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.floating-button .btn-icon:hover {
    box-shadow: none;
}

.floating-button .btn-icon svg {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

.floating-button .btn-text {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--b2b-primary-color, #007cba);
    color: white;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1;
    pointer-events: none;
    border: none;
}

/* Text positioning based on button container position */
.b2b-floating-buttons.bottom.right .floating-button .btn-text,
.b2b-floating-buttons.top.right .floating-button .btn-text,
.b2b-floating-buttons.right .floating-button .btn-text {
    right: 60px;
}

.b2b-floating-buttons.bottom.left .floating-button .btn-text,
.b2b-floating-buttons.top.left .floating-button .btn-text,
.b2b-floating-buttons.left .floating-button .btn-text {
    left: 60px;
}

.floating-button:hover .btn-text {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* ==========================================================================
   Button Type Specific Styles
   ========================================================================== */

/* Phone Button */
.floating-button.phone .btn-icon {
    background: #4a4a4a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-button.phone .btn-link:hover {
    color: white;
}

.floating-button.phone:hover .btn-icon {
    background: #ff8000;
    border-color: #ff8000;
}

/* WhatsApp Button */
.floating-button.whatsapp .btn-icon {
    background: #4a4a4a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-button.whatsapp .btn-link:hover {
    color: white;
}

.floating-button.whatsapp:hover .btn-icon {
    background: var(--b2b-primary-color, #007cba);
    border-color: var(--b2b-primary-color, #007cba);
}

/* WeChat Button */
.floating-button.wechat .btn-icon {
    background: #4a4a4a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-button.wechat .btn-link:hover {
    color: white;
}

.floating-button.wechat:hover .btn-icon {
    background: var(--b2b-primary-color, #007cba);
    border-color: var(--b2b-primary-color, #007cba);
}

/* WeChat QR Code on Hover */
.floating-button.wechat .wechat-qr {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 120px;
    height: 120px;
    overflow: hidden;
}

.b2b-floating-buttons.bottom.left .floating-button.wechat .wechat-qr,
.b2b-floating-buttons.top.left .floating-button.wechat .wechat-qr,
.b2b-floating-buttons.left .floating-button.wechat .wechat-qr {
    right: auto;
    left: 60px;
}

.floating-button.wechat:hover .wechat-qr {
    opacity: 1;
    visibility: visible;
}

.floating-button.wechat .wechat-qr img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}

.floating-button.wechat .wechat-qr::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

/* Arrow pointing to button - right side */
.b2b-floating-buttons.bottom.right .floating-button.wechat .wechat-qr::before,
.b2b-floating-buttons.top.right .floating-button.wechat .wechat-qr::before,
.b2b-floating-buttons.right .floating-button.wechat .wechat-qr::before {
    left: 100%;
    transform: translateY(-50%);
    border-left-color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
}

/* Arrow pointing to button - left side */
.b2b-floating-buttons.bottom.left .floating-button.wechat .wechat-qr::before,
.b2b-floating-buttons.top.left .floating-button.wechat .wechat-qr::before,
.b2b-floating-buttons.left .floating-button.wechat .wechat-qr::before {
    right: 100%;
    transform: translateY(-50%);
    border-right-color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
}

/* Email Button */
.floating-button.email .btn-icon {
    background: #4a4a4a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-button.email .btn-link:hover {
    color: white;
}

.floating-button.email:hover .btn-icon {
    background: var(--b2b-primary-color, #007cba);
    border-color: var(--b2b-primary-color, #007cba);
}

/* Back to Top Button */
.floating-button.back-to-top .btn-icon {
    background: #6c757d;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-button.back-to-top .btn-link:hover {
    color: white;
}

.floating-button.back-to-top:hover .btn-icon {
    background: var(--b2b-primary-color, #007cba);
    border-color: var(--b2b-primary-color, #007cba);
}



/* ==========================================================================
   WeChat QR Code Modal
   ========================================================================== */

.b2b-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.b2b-modal .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 300px;
    width: 90%;
}

.b2b-modal .close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.b2b-modal .close:hover {
    color: #333;
}

.b2b-modal h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4rem;
    font-weight: 600;
}

.b2b-modal #wechat-qr-code {
    margin-bottom: 20px;
}

.b2b-modal #wechat-qr-code img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.b2b-modal .wechat-id {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.b2b-modal .wechat-id strong {
    color: #1AAD19;
    font-weight: 600;
}

/* ==========================================================================
   Animation Effects
   ========================================================================== */

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


.floating-button:nth-child(2) {
    animation-delay: 0.8s;
}

.floating-button:nth-child(3) {
    animation-delay: 1.6s;
}

.floating-button:nth-child(4) {
    animation-delay: 2.4s;
}

.floating-button:nth-child(5) {
    animation-delay: 3.2s;
}

.floating-button:hover {
    animation: none;
}


/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .b2b-floating-buttons {
        right: 20px;
        gap: 6px;
    }
    
    .b2b-floating-buttons.left {
        left: 20px;
    }
    
    .floating-button .btn-link {
        width: 44px;
        height: 44px;
    }
    
    .floating-button .btn-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
    
    .floating-button .btn-icon svg {
        width: 22px;
        height: 22px;
    }
    
    .floating-button .btn-text {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .b2b-modal .modal-content {
        padding: 20px;
        max-width: 280px;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {
    .b2b-floating-buttons {
        right: 15px;
        gap: 4px;
    }
    
    .b2b-floating-buttons.left {
        left: 15px;
    }
    
    .floating-button .btn-link {
        width: 40px;
        height: 40px;
    }
    
    .floating-button .btn-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    
    .floating-button .btn-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .floating-button .btn-text {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .b2b-modal .modal-content {
        padding: 15px;
        max-width: 250px;
        border-radius: 12px;
    }
    
    .b2b-modal h3 {
        font-size: 1.2rem;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.floating-button .btn-link:focus {
    outline: 2px solid var(--b2b-primary-color, #007cba);
    outline-offset: 2px;
}

.floating-button .btn-link:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .floating-button .btn-link {
        border: 2px solid currentColor;
    }
    
    .b2b-modal .modal-content {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .floating-button,
    .floating-button .btn-link,
    .floating-button .btn-text,
    .floating-button .btn-icon {
        animation: none;
        transition: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .b2b-floating-buttons,
    .b2b-modal {
        display: none !important;
    }
}