/**
 * Frontend Styles
 * 
 * @package Media_Serve_Contact_Buttons
 */

/* CSS Variables for theming */
:root {
    --mscb-primary-color: #25D366;
    --mscb-secondary-color: #ffffff;
    --mscb-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --mscb-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Widget Container */
.mscb-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Position variants */
.mscb-widget.mscb-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.mscb-widget.mscb-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* RTL Support */
[dir="rtl"] .mscb-widget.mscb-position-bottom-right {
    right: auto;
    left: 20px;
}

[dir="rtl"] .mscb-widget.mscb-position-bottom-left {
    left: auto;
    right: 20px;
}

/* CTA Bubble */
.mscb-cta-bubble {
    position: absolute;
    bottom: 75px;
    right: 0;
    background: var(--mscb-secondary-color);
    color: #333;
    padding: 12px 40px 12px 16px;
    border-radius: 24px;
    box-shadow: var(--mscb-shadow);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    animation: mscb-bubble-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mscb-position-bottom-left .mscb-cta-bubble {
    right: auto;
    left: 0;
}

[dir="rtl"] .mscb-cta-bubble {
    padding: 12px 16px 12px 40px;
}

[dir="rtl"] .mscb-position-bottom-right .mscb-cta-bubble {
    right: auto;
    left: 0;
}

[dir="rtl"] .mscb-position-bottom-left .mscb-cta-bubble {
    left: auto;
    right: 0;
}

.mscb-cta-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    color: #666;
}

[dir="rtl"] .mscb-cta-close {
    right: auto;
    left: 8px;
}

.mscb-cta-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mscb-cta-close svg {
    width: 16px;
    height: 16px;
}

/* Main Button */
.mscb-main-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--mscb-primary-color);
    color: var(--mscb-secondary-color);
    box-shadow: var(--mscb-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    border: none;
    outline: none;
    padding: 0;
}

.mscb-main-button:hover {
    transform: scale(1.1);
    box-shadow: var(--mscb-shadow-lg);
}

.mscb-main-button:active {
    transform: scale(0.95);
}

.mscb-main-icon,
.mscb-close-icon {
    position: absolute;
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mscb-main-icon svg,
.mscb-close-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.mscb-main-icon {
    opacity: 1;
    transform: rotate(0deg);
}

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

.mscb-widget.mscb-open .mscb-main-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

.mscb-widget.mscb-open .mscb-close-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Channels Menu */
.mscb-channels-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mscb-position-bottom-left .mscb-channels-menu {
    right: auto;
    left: 0;
}

[dir="rtl"] .mscb-position-bottom-right .mscb-channels-menu {
    right: auto;
    left: 0;
}

[dir="rtl"] .mscb-position-bottom-left .mscb-channels-menu {
    left: auto;
    right: 0;
}

.mscb-widget.mscb-open .mscb-channels-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Channel Button */
.mscb-channel-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--mscb-secondary-color);
    border-radius: 28px;
    box-shadow: var(--mscb-shadow);
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    animation: mscb-channel-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) backwards;
}

.mscb-channel-button:nth-child(1) { animation-delay: 0.05s; }
.mscb-channel-button:nth-child(2) { animation-delay: 0.1s; }
.mscb-channel-button:nth-child(3) { animation-delay: 0.15s; }
.mscb-channel-button:nth-child(4) { animation-delay: 0.2s; }
.mscb-channel-button:nth-child(5) { animation-delay: 0.25s; }

.mscb-channel-button:hover {
    transform: translateX(-4px);
    box-shadow: var(--mscb-shadow-lg);
}

.mscb-position-bottom-left .mscb-channel-button:hover {
    transform: translateX(4px);
}

[dir="rtl"] .mscb-channel-button:hover {
    transform: translateX(4px);
}

[dir="rtl"] .mscb-position-bottom-left .mscb-channel-button:hover {
    transform: translateX(-4px);
}

.mscb-channel-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--channel-color);
}

.mscb-channel-icon svg {
    width: 100%;
    height: 100%;
}

.mscb-channel-label {
    font-weight: 500;
}

/* Specific channel colors */
.mscb-channel-whatsapp:hover { background-color: #25D366; color: white; }
.mscb-channel-messenger:hover { background-color: #0084FF; color: white; }
.mscb-channel-phone:hover { background-color: #34B7F1; color: white; }
.mscb-channel-email:hover { background-color: #EA4335; color: white; }
.mscb-channel-telegram:hover { background-color: #0088cc; color: white; }

.mscb-channel-button:hover .mscb-channel-icon {
    color: white;
}

/* Animations */
@keyframes mscb-bubble-in {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes mscb-channel-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mscb-widget {
        bottom: 15px;
        right: 15px;
    }

    .mscb-widget.mscb-position-bottom-left {
        left: 15px;
    }

    .mscb-main-button {
        width: 50px;
        height: 50px;
    }

    .mscb-main-icon,
    .mscb-close-icon {
        width: 24px;
        height: 24px;
    }

    .mscb-cta-bubble {
        max-width: 200px;
        font-size: 13px;
        padding: 10px 36px 10px 14px;
        bottom: 65px;
    }

    .mscb-channels-menu {
        bottom: 65px;
    }

    .mscb-channel-button {
        padding: 10px 14px;
        font-size: 13px;
        gap: 10px;
    }

    .mscb-channel-icon {
        width: 20px;
        height: 20px;
    }
}

/* Accessibility */
.mscb-main-button:focus-visible,
.mscb-channel-button:focus-visible,
.mscb-cta-close:focus-visible {
    outline: 2px solid var(--mscb-primary-color);
    outline-offset: 2px;
}

/* Print - Hide widget */
@media print {
    .mscb-widget {
        display: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .mscb-main-button,
    .mscb-channel-button {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mscb-widget,
    .mscb-widget *,
    .mscb-widget *::before,
    .mscb-widget *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
