/**
 * Telegram Chat Widget Styles
 * Modern, responsive chat interface
 */

/* ===================================
   Chat Button (Bottom Right)
   =================================== */
.telegram-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
    animation: pulse 2s ease-in-out infinite;
}

.telegram-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
}

.telegram-chat-btn.active {
    transform: scale(1);
    animation: none;
}

.chat-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(99, 102, 241, 0.7);
    }
}

/* ===================================
   Chat Window
   =================================== */
.telegram-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 520px;
    background: #1e293b;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.telegram-chat-window.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* ===================================
   Chat Header
   =================================== */
.chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-header h3 {
    margin: 0;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===================================
   Messages Container
   =================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0f172a;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.chat-welcome {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
}

.chat-welcome p {
    margin: 8px 0;
}

.chat-welcome-sub {
    font-size: 0.9rem;
    color: #64748b;
}

/* ===================================
   Message Bubbles
   =================================== */
.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.message-client {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message.message-agent {
    align-self: flex-start;
    align-items: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.message-client .message-content {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.message-agent .message-content {
    background: #334155;
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
    padding: 0 4px;
}

/* Image Messages */
.message-image .message-content {
    padding: 8px;
}

.message-image img {
    max-width: 100%;
    border-radius: 12px;
    display: block;
}

/* ===================================
   Typing Indicator
   =================================== */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    background: #1e293b;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ===================================
   Input Area
   =================================== */
.chat-input-area {
    background: #1e293b;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    flex-shrink: 0;
}

.image-preview {
    position: relative;
    margin-bottom: 12px;
    display: inline-block;
}

.image-preview img {
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.image-remove-btn:hover {
    transform: scale(1.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 12px 16px;
    color: #f1f5f9;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: #6366f1;
}

.chat-input::placeholder {
    color: #64748b;
}

.chat-image-btn,
.chat-send-btn {
    background: #334155;
    border: none;
    color: #94a3b8;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-image-btn:hover,
.chat-send-btn:hover {
    background: #475569;
    color: white;
}

.chat-send-btn {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ===================================
   Powered By
   =================================== */
.chat-powered-by {
    text-align: center;
    padding: 8px;
    background: #0f172a;
    font-size: 0.7rem;
    color: #475569;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 480px) {
    .telegram-chat-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .telegram-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .chat-messages {
        padding: 16px;
    }
}

/* ===================================
   Container
   =================================== */
#telegram-chat-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
