/* Telegram Chat Widget - Frontend Styles */

/* Chat Button */
.tcw-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0088cc;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 999998;
    text-decoration: none;
}

.tcw-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.tcw-chat-button.tcw-hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.tcw-chat-button svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.tcw-chat-button.tcw-position-left {
    right: auto;
    left: 20px;
}

.tcw-chat-button.tcw-position-center {
    right: 50%;
    transform: translateX(50%);
}

/* Chat Window */
.tcw-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 999999;
}

.tcw-chat-window.tcw-open {
    display: flex !important;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Chat Header */
.tcw-chat-header {
    background: #0088cc;
    color: #fff;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tcw-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tcw-agent-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.tcw-agent-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.tcw-agent-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.8;
}

.tcw-close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    font-size: 24px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tcw-close-btn:hover {
    opacity: 1;
}

/* Chat Body */
.tcw-chat-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Lead Form */
.tcw-lead-form-container {
    padding: 30px 20px;
    display: none;
}

.tcw-lead-form h3 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #333;
}

.tcw-lead-form p {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
}

.tcw-form-group {
    margin-bottom: 15px;
}

.tcw-form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.tcw-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.tcw-form-group input:focus {
    outline: none;
    border-color: #0088cc;
}

.tcw-form-group input:required {
    border-left: 3px solid #0088cc;
}

.tcw-submit-btn {
    width: 100%;
    padding: 12px;
    background: #0088cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tcw-submit-btn:hover {
    background: #0077b3;
}

/* Messages Container */
.tcw-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

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

.tcw-messages-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Welcome Message */
.tcw-welcome-message {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tcw-welcome-message h4 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #333;
}

.tcw-welcome-message p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Messages */
.tcw-message {
    margin-bottom: 15px;
    display: flex;
}

.tcw-message-visitor {
    justify-content: flex-end;
}

.tcw-message-agent {
    justify-content: flex-start;
}

.tcw-message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
}

.tcw-message-visitor .tcw-message-content {
    background: #0088cc;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tcw-message-agent .tcw-message-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tcw-message-system {
    justify-content: center;
}

.tcw-message-system .tcw-message-content {
    background: #fff3cd;
    color: #856404;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tcw-message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #0088cc;
}

.tcw-message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.tcw-message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.6;
}

/* Chat Input */
.tcw-chat-input {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
}

.tcw-input-wrapper {
    display: flex;
    gap: 10px;
}

.tcw-message-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    transition: border-color 0.2s;
}

.tcw-message-input:focus {
    outline: none;
    border-color: #0088cc;
}

.tcw-send-btn {
    width: 42px;
    height: 42px;
    background: #0088cc;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.tcw-send-btn:hover {
    background: #0077b3;
}

.tcw-send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .tcw-chat-window {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .tcw-chat-header {
        border-radius: 0;
    }
    
    .tcw-chat-input {
        border-radius: 0;
    }
    
    .tcw-chat-button {
        bottom: 15px;
        right: 15px;
    }
}

/* Animations */
@keyframes tcw-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.tcw-chat-button.tcw-has-notification {
    animation: tcw-pulse 2s infinite;
}

/* Online Status */
.tcw-online-status {
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    border: 2px solid #fff;
    position: absolute;
    bottom: 2px;
    right: 2px;
}

.tcw-online-status.offline {
    background: #999;
}

/* Loading */
.tcw-loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.tcw-loading::after {
    content: '...';
    animation: tcw-dots 1.5s infinite;
}

@keyframes tcw-dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}
