/* ==========================================================================
   Global Floating Contact & Scroll System - Intrinsic Security
   ========================================================================== */

/* Main Container - Fixed Bottom Right */
.global-floating-system {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: calc(24px + env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 9999;
    pointer-events: none; /* Allows click-through outside actual buttons */
}

/* Enable pointer events for active interactive children */
.global-floating-system > * {
    pointer-events: auto;
}

/* Common Button Styles */
.global-floating-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    text-decoration: none;
    cursor: pointer;
    border-radius: 50%;
    position: relative;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1),
                box-shadow 0.3s ease,
                background-color 0.3s ease,
                opacity 0.3s ease,
                visibility 0.3s ease;
}

/* --------------------------------------------------------------------------
   1. Scroll Up Arrow Control
   -------------------------------------------------------------------------- */
.global-floating-arrow {
    width: 44px;
    height: 44px;
    background-color: var(--primary-color, #010535);
    color: #ffffff;
    font-size: 16px;
    box-shadow: 0 4px 16px rgba(1, 5, 53, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.9);
}

.global-floating-arrow.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.global-floating-arrow:hover {
    background-color: var(--accent-color, #3662CC);
    color: #ffffff;
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 8px 22px rgba(54, 98, 204, 0.4);
}

.global-floating-arrow:focus-visible {
    box-shadow: 0 0 0 3px rgba(54, 98, 204, 0.4);
}

/* --------------------------------------------------------------------------
   2. Floating WhatsApp Button
   -------------------------------------------------------------------------- */
.global-floating-wa {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #ffffff;
    font-size: 28px;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.38);
}

.global-floating-wa i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.global-floating-wa:hover {
    color: #ffffff;
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 12px 30px rgba(37, 211, 102, 0.55);
}

.global-floating-wa:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.5);
}

/* Gentle Pulse Ring Animation */
.global-floating-wa::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid #25D366;
    opacity: 0;
    animation: global-wa-pulse 3s infinite ease-out;
    pointer-events: none;
}

@keyframes global-wa-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.4);
        opacity: 0;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Desktop Tooltip Pill */
.global-floating-tooltip {
    position: absolute;
    right: 66px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: var(--primary-color, #010535);
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 20px;
    font-family: var(--default-font, "DM Sans", sans-serif);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(1, 5, 53, 0.2);
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Tooltip Little Arrow Tip */
.global-floating-tooltip::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 6px;
    border-style: solid;
    border-color: transparent transparent transparent var(--primary-color, #010535);
}

/* Hover Show Tooltip */
.global-floating-wa:hover .global-floating-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* --------------------------------------------------------------------------
   3. Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .global-floating-system {
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        right: calc(18px + env(safe-area-inset-right, 0px));
        gap: 10px;
    }

    .global-floating-wa {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .global-floating-arrow {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    /* Hide text tooltip on small mobile screens to prevent clutter */
    .global-floating-tooltip {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   4. Print Media & Reduced Motion Accessibility
   -------------------------------------------------------------------------- */
@media print {
    .global-floating-system {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .global-floating-btn,
    .global-floating-arrow,
    .global-floating-tooltip {
        transition: none !important;
        transform: none !important;
    }

    .global-floating-wa::before {
        animation: none !important;
    }
}
