/* Telegram Widget Styles */
.telegram-widget {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
}
.telegram-icon {
width: 60px;
height: 60px;
background-color: #0088cc;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
position: relative;
}
.telegram-icon:hover {
transform: scale(1.1);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.telegram-icon svg {
width: 30px;
height: 30px;
fill: white;
}
/* Red dot on Telegram button */
.status-dot {
position: absolute;
width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid white;
}
.telegram-icon .status-dot {
top: 5px;
right: 5px;
background-color: #ff4444;
}
.telegram-popup {
position: absolute;
bottom: 70px;
right: 0;
width: 320px;
background-color: white;
border-radius: 12px;
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
overflow: hidden;
display: none;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.popup-header {
background-color: white;
padding: 15px;
display: flex;
align-items: center;
border-bottom: 1px solid #eee;
position: relative;
}
.user-avatar {
width: 50px;
height: 50px;
border-radius: 50%;
margin-right: 12px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.user-avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Green dot on avatar */
.user-avatar .status-dot {
bottom: 4px;
right: 8px;
background-color: #4CAF50;
width: 10px;
height: 10px;
border: 2px solid white;
}
.user-info {
flex: 1;
}
.user-name {
font-weight: bold;
font-size: 1.1rem;
color: #333;
}
.user-status {
font-size: 0.85rem;
color: #666;
margin-top: 3px;
}
.close-btn {
position: absolute;
top: 15px;
right: 15px;
background: none;
border: none;
font-size: 1.2rem;
color: #999;
cursor: pointer;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: all 0.2s;
}
.close-btn:hover {
background-color: #f5f5f5;
color: #333;
}
.popup-body {
padding: 15px;
max-height: 300px;
overflow-y: auto;
background-color: #e9f6e9;
}
.message {
background-color: white;
border-radius: 18px;
padding: 12px 16px;
margin-bottom: 12px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
max-width: 85%;
align-self: flex-start;
}
.message-content {
font-size: 0.95rem;
line-height: 1.4;
}
.message-content div {
margin-bottom: 5px;
}
.message-content div:last-child {
margin-bottom: 0;
}
.popup-footer {
background-color: #e8f5e9;
padding: 15px;
text-align: center;
border-top: 1px solid #e0e0e0;
}
.chat-button {
display: inline-flex;
align-items: center;
justify-content: center;
background-color: #0088cc;
color: white;
padding: 12px 20px;
border-radius: 24px;
text-decoration: none;
font-weight: bold;
transition: background-color 0.3s;
width: 100%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.chat-button svg {
width: 20px;
height: 20px;
fill: white;
margin-right: 8px;
}
.chat-button:hover {
background-color: #0077b3;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
/* Responsive Design */
@media (max-width: 768px) {
.telegram-popup {
width: 300px;
right: -10px;
}
}
@media (max-width: 480px) {
.telegram-popup {
width: 280px;
right: -20px;
}
}
document.addEventListener('DOMContentLoaded', function() {
const telegramIcon = document.getElementById('telegramIcon');
const telegramPopup = document.getElementById('telegramPopup');
const closePopup = document.getElementById('closePopup');
let isPopupOpen = false;
// Toggle popup visibility
telegramIcon.addEventListener('click', function() {
if (isPopupOpen) {
telegramPopup.style.display = 'none';
} else {
telegramPopup.style.display = 'block';
}
isPopupOpen = !isPopupOpen;
});
// Close popup when clicking close button
closePopup.addEventListener('click', function() {
telegramPopup.style.display = 'none';
isPopupOpen = false;
});
// Close popup when clicking outside
document.addEventListener('click', function(event) {
if (isPopupOpen &&
!telegramPopup.contains(event.target) &&
!telegramIcon.contains(event.target)) {
telegramPopup.style.display = 'none';
isPopupOpen = false;
}
});
});