/* ==========================================================================
   Telegram Floating Button - Front-End Stylesheet
   ========================================================================== */

.tgfb-container {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    pointer-events: none; /* Let container be click-through, button & tooltip enable events */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tgfb-container * {
    box-sizing: border-box;
    pointer-events: auto;
}

/* --- Screen Positions --- */
.tgfb-pos-bottom-left {
    bottom: 20px;
    left: 20px;
    flex-direction: row;
}

.tgfb-pos-bottom-right {
    bottom: 20px;
    right: 20px;
    flex-direction: row-reverse;
}

.tgfb-pos-top-left {
    top: 20px;
    left: 20px;
    flex-direction: row;
}

.tgfb-pos-top-right {
    top: 20px;
    right: 20px;
    flex-direction: row-reverse;
}

/* --- Sizes --- */
.tgfb-size-small .tgfb-button {
    width: 48px;
    height: 48px;
}
.tgfb-size-small .tgfb-icon {
    width: 24px;
    height: 24px;
}

.tgfb-size-medium .tgfb-button {
    width: 56px;
    height: 56px;
}
.tgfb-size-medium .tgfb-icon {
    width: 28px;
    height: 28px;
}

.tgfb-size-large .tgfb-button {
    width: 64px;
    height: 64px;
}
.tgfb-size-large .tgfb-icon {
    width: 32px;
    height: 32px;
}

/* --- Main Button --- */
.tgfb-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    border-radius: 50%;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(36, 161, 222, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, background 0.3s ease;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.tgfb-button:hover,
.tgfb-button:focus {
    transform: translateY(-4px) scale(1.07);
    box-shadow: 0 12px 28px rgba(36, 161, 222, 0.55), 0 4px 10px rgba(0, 0, 0, 0.18);
    background: linear-gradient(135deg, #33b3f5 0%, #1c92cb 100%);
}

.tgfb-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 12px rgba(36, 161, 222, 0.4);
}

.tgfb-icon {
    display: block;
    fill: #ffffff;
    margin-right: 2px; /* Subtle offset to visually center paper airplane */
    margin-top: 1px;
    transition: transform 0.3s ease;
}

.tgfb-button:hover .tgfb-icon {
    transform: translate(1px, -1px) scale(1.05);
}

/* --- Pulse Wave Ring Animation --- */
.tgfb-pulse-ring {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(36, 161, 222, 0.6);
    z-index: -1;
    pointer-events: none;
}

.tgfb-has-pulse .tgfb-pulse-ring {
    display: block;
    animation: tgfb-pulse-wave 2.2s infinite ease-out;
}

@keyframes tgfb-pulse-wave {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    70% {
        transform: scale(1.55);
        opacity: 0;
    }
    100% {
        transform: scale(1.55);
        opacity: 0;
    }
}

/* --- Tooltip Styling --- */
.tgfb-tooltip {
    position: relative;
    background: #1e293b;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Arrow indicators */
.tgfb-pos-bottom-left .tgfb-tooltip::before,
.tgfb-pos-top-left .tgfb-tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-style: solid;
    border-color: transparent #1e293b transparent transparent;
}

.tgfb-pos-bottom-right .tgfb-tooltip::before,
.tgfb-pos-top-right .tgfb-tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #1e293b;
}

/* Tooltip Display Modes */
.tgfb-tooltip-hover .tgfb-tooltip {
    transform: translateX(-4px);
}

.tgfb-container:hover .tgfb-tooltip-hover .tgfb-tooltip,
.tgfb-button:hover + .tgfb-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.tgfb-tooltip-always .tgfb-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.tgfb-tooltip-disabled .tgfb-tooltip {
    display: none !important;
}

/* --- Mobile Viewport Rules --- */
@media (max-width: 600px) {
    .tgfb-hide-mobile {
        display: none !important;
    }
    
    .tgfb-container {
        gap: 8px;
    }
    
    .tgfb-tooltip {
        font-size: 12px;
        padding: 6px 10px;
    }
}
