/* Telegram Widget Styles */
.telegram-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
}

.telegram-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0088cc 0%, #00aced 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.3);
    animation: pulse 2s infinite;
}

.telegram-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 136, 204, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0); }
}

.telegram-chat {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
}

.telegram-chat.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    background: linear-gradient(135deg, #0088cc 0%, #00aced 100%);
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chat-info {
    flex: 1;
}

.chat-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.status {
    font-size: 12px;
    opacity: 0.8;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    display: flex;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease;
}

.message.bot-message {
    align-self: flex-start;
}

.message.user-message {
    align-self: flex-end;
}

.message-content {
    padding: 10px 12px;
    border-radius: 12px;
    position: relative;
}

.bot-message .message-content {
    background: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
    background: #0088cc;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 10px;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
    text-align: right;
}

.chat-input {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    font-size: 14px;
}

.chat-input input:focus {
    border-color: #0088cc;
}

.chat-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #0088cc;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.chat-input button:hover {
    background: #0077b5;
}

/* Quick Replies */
.quick-replies {
    margin: 10px 0;
}

.quick-replies p {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.quick-reply-btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    margin: 5px 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    transition: all 0.3s ease;
}

.quick-reply-btn:hover {
    background: #f8f9fa;
    border-color: #0088cc;
    transform: translateX(5px);
}

/* Telegram Direct Link */
.telegram-direct-link {
    margin-top: 15px;
}

.tg-direct-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #0088cc 0%, #00aced 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.3);
}

.tg-direct-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
    color: white;
    text-decoration: none;
}

.tg-note {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    color: #666;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingAnimation {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Temporary messages */
.message.temporary .message-content {
    opacity: 0.7;
    font-style: italic;
}

/* Message with names */
.message-content p {
    margin: 0;
    line-height: 1.4;
}

.message-content strong {
    color: #0088cc;
    font-weight: 600;
}

.user-message .message-content strong {
    color: #28a745;
}

/* Online status indicator */
.chat-header .status {
    color: #28a745;
    font-weight: 500;
}

.chat-header .status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    margin-right: 5px;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Direct Telegram link in messages */
.direct-telegram-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0088cc 0%, #00aced 100%);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    text-decoration: none;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.direct-telegram-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
    color: white;
    text-decoration: none;
}

.telegram-link-message {
    margin-top: 10px;
}

/* Dark theme for messages */
@media (prefers-color-scheme: dark) {
    .telegram-chat {
        background: #2d3748;
        color: white;
    }
    
    .chat-messages {
        background: #1a202c;
    }
    
    .bot-message .message-content {
        background: #4a5568;
        color: white;
    }
    
    .chat-input {
        background: #2d3748;
        border-top-color: #4a5568;
    }
    
    .chat-input input {
        background: #4a5568;
        border-color: #4a5568;
        color: white;
    }
}

/* Mobile adaptation */
@media (max-width: 768px) {
    .telegram-chat {
        width: 280px;
        height: 350px;
        right: -10px;
    }
}