/* chat-widget.css - полноценный чат в виджете */
.tx-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tx-chat-icon {
    width: 55px;
    height: 55px;
    background: #ffdd22;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s;
    position: relative;
}

.tx-chat-icon:hover {
    transform: scale(1.05);
}

.tx-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.tx-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.tx-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #ffdd22;
    font-weight: 600;
}

.tx-chat-header-buttons {
    display: flex;
    gap: 8px;
}

.tx-chat-header-buttons button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tx-chat-header-buttons button:hover {
    background: rgba(0,0,0,0.1);
}

.tx-chat-dialogs {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tx-chat-dialog {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
}

.tx-chat-dialog:hover {
    background: #f8f8f8;
}

.tx-chat-dialog-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.tx-chat-dialog-info {
    flex: 1;
    min-width: 0;
}

.tx-chat-dialog-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.tx-chat-dialog-last {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-chat-unread {
    background: #dc3545;
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tx-chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tx-chat-messages-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.tx-chat-back {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tx-chat-back:hover {
    background: #f0f0f0;
}

.tx-chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8f8f8;
}

.tx-chat-message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
}

.tx-chat-message-mine {
    align-self: flex-end;
    background: #ffdd22;
    color: #000;
    border-bottom-right-radius: 4px;
}

.tx-chat-message-their {
    align-self: flex-start;
    background: white;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
}

.tx-chat-message-time {
    font-size: 0.6rem;
    color: #888;
    margin-top: 4px;
    text-align: right;
}

.tx-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
    background: #fff;
}

.tx-chat-input-area textarea {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    min-height: 36px;
    max-height: 80px;
}

.tx-chat-input-area textarea:focus {
    border-color: #ffdd22;
}

.tx-chat-input-area button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0066cc;
    border: none;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tx-chat-input-area button:hover {
    background: #0052a3;
}

.tx-chat-loading {
    text-align: center;
    padding: 20px;
    color: #888;
}

.tx-chat-empty {
    text-align: center;
    padding: 30px 20px;
    color: #888;
}

.tx-chat-empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

@media (max-width: 600px) {
    .tx-chat-window {
        width: 320px;
        right: -10px;
    }
}

/* Кнопка нового диалога */
.tx-new-dialog-top {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.tx-new-dialog-btn {
    width: 100%;
    padding: 8px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.tx-new-dialog-btn:hover {
    background: #218838;
}

.tx-chat-empty .tx-new-dialog-btn {
    margin-top: 10px;
    background: #ffdd22;
    color: #000;
}

.tx-chat-empty .tx-new-dialog-btn:hover {
    background: #e6c300;
}
