/* ===== TELEGRAM FLOATING BUTTON ===== */
.telegram-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(42, 171, 238, 0.4);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    text-decoration: none;
    border: none;
    /* Reset for button tag */
}

.telegram-fab:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 8px 25px rgba(42, 171, 238, 0.5);
}

.telegram-fab svg {
    margin-right: 2px;
    /* Visual correction for the icon */
    margin-top: 2px;
}

.telegram-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #2AABEE;
    opacity: 0;
    z-index: -1;
    animation: telegram-pulse-animation 2s infinite;
}

.telegram-pulse::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 2px solid #2AABEE;
    opacity: 0;
    animation: telegram-pulse-animation 2s infinite 0.5s;
}

@keyframes telegram-pulse-animation {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* ===== CHAT WIDGET ===== */
.telegram-widget {
    position: fixed;
    bottom: 130px;
    /* Raised to prevent overlap with FAB button */
    right: 30px;
    width: 350px;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 999;
}

.telegram-widget.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
}

.chat-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 1;
}

.online-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #44eb44;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 5px rgba(68, 235, 68, 0.8);
    animation: online-pulse 2s infinite;
}

@keyframes online-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(68, 235, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(68, 235, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(68, 235, 68, 0);
    }
}

/* Body */
.chat-body {
    padding: 20px;
    height: auto;
    max-height: 400px;
    flex: 1;
    overflow-y: auto;
    background-color: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.admin {
    background-color: white;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.user {
    background-color: #2AABEE;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.chat-timestamp {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
    text-align: right;
}

/* Footer */
.chat-footer {
    padding: 15px;
    background-color: white;
    border-top: 1px solid #ebeef2;
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: 1px solid #dfe3e8;
    border-radius: 20px;
    padding: 10px 15px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    height: 42px;
    line-height: 20px;
}

.chat-input:focus {
    outline: none;
    border-color: #2AABEE;
}

.chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #2AABEE;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.chat-send:hover {
    background-color: #229ED9;
}

.chat-send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 640px) {
    .telegram-fab {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .telegram-widget {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 2000;
    }

    .chat-body {
        flex: 1;
        height: auto;
    }
}